Skip to content

Commit

Permalink
enabled eslint for packages/*/src and fixed errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Havunen committed Dec 18, 2016
1 parent df68afe commit e91cbc8
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 53 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*.min.js
packages/inferno/dist/*
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@
"no-var": 2,
"prefer-spread": 2
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"karma:ie": "karma start config/karma.conf.js --browsers=IE",
"karma:all": "npm run karma:firefox && npm run karma:chrome && npm run karma:ie",
"lint": "npm run lint:ts && npm run lint:js",
"lint:js": "eslint config examples src test",
"lint:js": "eslint config examples src test packages/*/src",
"lint:ts": "tslint src/**/*.ts src/**/*.tsx test/**/*.ts",
"packages:purge": "rimraf node_modules",
"packages:reinstall": "npm run packages:purge && npm install",
Expand Down
2 changes: 1 addition & 1 deletion packages/inferno-compat/lib/EventPluginHub.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// so generates no-ops for now, we probably need to make this actually work?
module.exports = {
injection: {
injectEventPluginsByName: function() {}
injectEventPluginsByName: function () {}
}
};
14 changes: 7 additions & 7 deletions packages/inferno-compat/lib/EventPluginUtils.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
function isEndish(topLevelType) {
return topLevelType === 'topMouseUp' ||
return topLevelType === 'topMouseUp' ||
topLevelType === 'topTouchEnd' ||
topLevelType === 'topTouchCancel';
}

function isMoveish(topLevelType) {
return topLevelType === 'topMouseMove' ||
return topLevelType === 'topMouseMove' ||
topLevelType === 'topTouchMove';
}
function isStartish(topLevelType) {
return topLevelType === 'topMouseDown' ||
return topLevelType === 'topMouseDown' ||
topLevelType === 'topTouchStart';
}

module.exports = {
isEndish: isEndish,
isMoveish: isMoveish,
isStartish: isStartish
}
isEndish: isEndish,
isMoveish: isMoveish,
isStartish: isStartish
};
2 changes: 1 addition & 1 deletion packages/inferno-compat/lib/EventPropagators.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// so generates no-ops for now, we probably need to make this actually work?
module.exports = {
accumulateTwoPhaseDispatches: function() {}
accumulateTwoPhaseDispatches: function () {}
};
2 changes: 1 addition & 1 deletion packages/inferno-compat/lib/SyntheticUIEvent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// so generates no-ops for now, we probably need to make this actually work?
module.exports = {
SyntheticUIEvent: function() {
SyntheticUIEvent: function () {
return {};
}
};
22 changes: 11 additions & 11 deletions packages/inferno-compat/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const ARR = [];
const Children = {
map(children, fn, ctx) {
children = Children.toArray(children);
if (ctx && ctx!==children) fn = fn.bind(ctx);
if (ctx && ctx !== children) {fn = fn.bind(ctx);}
return children.map(fn);
},
forEach(children, fn, ctx) {
children = Children.toArray(children);
if (ctx && ctx!==children) fn = fn.bind(ctx);
if (ctx && ctx !== children) {fn = fn.bind(ctx);}
children.forEach(fn);
},
count(children) {
Expand All @@ -31,7 +31,7 @@ const Children = {
},
only(children) {
children = Children.toArray(children);
if (children.length!==1) throw new Error('Children.only() expects only one child.');
if (children.length !== 1) {throw new Error('Children.only() expects only one child.');}
return children[0];
},
toArray(children) {
Expand All @@ -42,18 +42,18 @@ const Children = {
let currentComponent = null;

Component.prototype.isReactComponent = {};
Component.prototype._beforeRender = function() {
Component.prototype._beforeRender = function () {
currentComponent = this;
};
Component.prototype._afterRender = function() {
Component.prototype._afterRender = function () {
currentComponent = null;
};

const version = '15.4.1';

function normalizeProps(name, props) {
if ((name === 'input' || name === 'textarea') && props.onChange) {
const eventName = props.type === 'checkbox' ? 'onclick' : 'oninput'
const eventName = props.type === 'checkbox' ? 'onclick' : 'oninput';

if (!props[eventName]) {
props[eventName] = props.onChange;
Expand Down Expand Up @@ -89,15 +89,15 @@ const injectStringRefs = (originalFunction) => {
}
return originalFunction(name, props, ...children);
};
}
};

const createElement = injectStringRefs(infernoCreateElement);
const cloneElement = injectStringRefs(cloneVNode);

// Credit: preact-compat - https://github.com/developit/preact-compat :)
function shallowDiffers (a, b) {
for (let i in a) if (!(i in b)) return true;
for (let i in b) if (a[i] !== b[i]) return true;
function shallowDiffers(a, b) {
for (let i in a) {if (!(i in b)) {return true;}}
for (let i in b) {if (a[i] !== b[i]) {return true;}}
return false;
}

Expand All @@ -108,7 +108,7 @@ function PureComponent(props, context) {
PureComponent.prototype = new Component({}, {});
PureComponent.prototype.shouldComponentUpdate = function (props, state) {
return shallowDiffers(this.props, props) || shallowDiffers(this.state, state);
}
};

class WrapperComponent extends Component {
getChildContext() {
Expand Down
2 changes: 1 addition & 1 deletion packages/inferno-dom/inferno-dom.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
throw new Error('`inferno-dom` has been deprecated in 1.0! Use core `inferno` instead!')
throw new Error('`inferno-dom` has been deprecated in 1.0! Use core `inferno` instead!');
2 changes: 1 addition & 1 deletion packages/inferno-mobx/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Provider from '../../../build/mobx/Provider';
import {trackComponents, renderReporter, componentByNodeRegistery} from '../../../build/mobx/makeReactive';
import { trackComponents, renderReporter, componentByNodeRegistery } from '../../../build/mobx/makeReactive';
import connect from '../../../build/mobx/connect';
import inject from '../../../build/mobx/inject';

Expand Down
2 changes: 1 addition & 1 deletion packages/inferno-redux/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import connect from '../../../build/redux/connect';

export default {
Provider,
connect,
connect
};
4 changes: 2 additions & 2 deletions packages/inferno-test-utils/src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import isValidElement from '../../../build/factories/isValidElement';

export {
isValidElement,
isValidElement
};

export default {
isValidElement,
isValidElement
};
2 changes: 1 addition & 1 deletion packages/inferno-vnode-flags/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ export default {
InputElement: 1 << 9,
TextareaElement: 1 << 10,
SelectElement: 1 << 11,
Void: 1 << 12,
Void: 1 << 12
};
16 changes: 8 additions & 8 deletions packages/inferno/dist/inferno-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,12 +618,12 @@ var ARR = [];
var Children = {
map: function map(children, fn, ctx) {
children = Children.toArray(children);
if (ctx && ctx!==children) { fn = fn.bind(ctx); }
if (ctx && ctx !== children) {fn = fn.bind(ctx);}
return children.map(fn);
},
forEach: function forEach(children, fn, ctx) {
children = Children.toArray(children);
if (ctx && ctx!==children) { fn = fn.bind(ctx); }
if (ctx && ctx !== children) {fn = fn.bind(ctx);}
children.forEach(fn);
},
count: function count(children) {
Expand All @@ -632,7 +632,7 @@ var Children = {
},
only: function only(children) {
children = Children.toArray(children);
if (children.length!==1) { throw new Error('Children.only() expects only one child.'); }
if (children.length !== 1) {throw new Error('Children.only() expects only one child.');}
return children[0];
},
toArray: function toArray(children) {
Expand All @@ -643,10 +643,10 @@ var Children = {
var currentComponent = null;

Component.prototype.isReactComponent = {};
Component.prototype._beforeRender = function() {
Component.prototype._beforeRender = function () {
currentComponent = this;
};
Component.prototype._afterRender = function() {
Component.prototype._afterRender = function () {
currentComponent = null;
};

Expand Down Expand Up @@ -699,9 +699,9 @@ var createElement = injectStringRefs(createElement$1);
var cloneElement = injectStringRefs(inferno.cloneVNode);

// Credit: preact-compat - https://github.com/developit/preact-compat :)
function shallowDiffers (a, b) {
for (var i in a) { if (!(i in b)) { return true; } }
for (var i$1 in b) { if (a[i$1] !== b[i$1]) { return true; } }
function shallowDiffers(a, b) {
for (var i in a) {if (!(i in b)) {return true;}}
for (var i$1 in b) {if (a[i$1] !== b[i$1]) {return true;}}
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/inferno/dist/inferno-redux.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ function connect(mapStateToProps, mapDispatchToProps, mergeProps, options) {

var index = {
Provider: Provider,
connect: connect,
connect: connect
};

return index;
Expand Down
8 changes: 4 additions & 4 deletions packages/inferno/dist/inferno-test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* Released under the MIT License.
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.Inferno = global.Inferno || {}, global.Inferno.TestUtils = global.Inferno.TestUtils || {})));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.Inferno = global.Inferno || {}, global.Inferno.TestUtils = global.Inferno.TestUtils || {})));
}(this, (function (exports) { 'use strict';

var ERROR_MSG = 'a runtime error occured! Use Inferno in development environment to find the error.';
Expand Down Expand Up @@ -42,7 +42,7 @@ function isValidElement(obj) {
}

var index = {
isValidElement: isValidElement,
isValidElement: isValidElement
};

exports.isValidElement = isValidElement;
Expand Down
2 changes: 1 addition & 1 deletion packages/inferno/dist/inferno-vnode-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var index = {
InputElement: 1 << 9,
TextareaElement: 1 << 10,
SelectElement: 1 << 11,
Void: 1 << 12,
Void: 1 << 12
};

return index;
Expand Down
4 changes: 2 additions & 2 deletions packages/inferno/dist/inferno.js
Original file line number Diff line number Diff line change
Expand Up @@ -2396,7 +2396,7 @@ function linkEvent(data, event) {
}

if (isBrowser) {
window.process = window.process || {};
window.process = window.process || {};
window.process.env = window.process.env || {
NODE_ENV: 'development'
};
Expand Down Expand Up @@ -2428,7 +2428,7 @@ var index = {
NO_OP: NO_OP,
EMPTY_OBJ: EMPTY_OBJ,

//DOM
// DOM
render: render,
findDOMNode: findDOMNode,
createRenderer: createRenderer,
Expand Down
5 changes: 0 additions & 5 deletions packages/inferno/dist/inferno.min.js.orig

This file was deleted.

6 changes: 3 additions & 3 deletions packages/inferno/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { initDevToolsHooks } from '../../../build/DOM/devtools';
import linkEvent from '../../../build/DOM/events/linkEvent';

if (isBrowser) {
window.process = window.process || {};
window.process = window.process || {};
window.process.env = window.process.env || {
NODE_ENV: 'development'
};
Expand Down Expand Up @@ -41,7 +41,7 @@ export default {
NO_OP,
EMPTY_OBJ,

//DOM
// DOM
render,
findDOMNode,
createRenderer,
Expand All @@ -61,7 +61,7 @@ export {
NO_OP,
EMPTY_OBJ,

//DOM
// DOM
render,
findDOMNode,
createRenderer,
Expand Down

0 comments on commit e91cbc8

Please sign in to comment.