Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Update ESLint (#377)
Browse files Browse the repository at this point in the history
* Remove npm-shrinkwrap

The shrinkwrap file is a pain to work with:

- it makes it confusing to update modules since npm-shrinkwrap.json silently overrides package.json
- npm-shrinkwrap.json diffs are huge and not really human readable

It seems close enough to just specify strict version ranges instead. The
likelihood that something breaks due to a recursive dependency update seems
small compared to the pain the shrinkwrap causes.

* Update ESLint to 2.x
  • Loading branch information
gaearon committed May 20, 2016
1 parent 1497edc commit dfe8977
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 16,703 deletions.
6 changes: 3 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
parser: babel-eslint

extends:
- ./node_modules/fbjs-scripts/eslint/.eslintrc
- ./node_modules/fbjs-scripts/eslint/.eslintrc.js

plugins:
- react
Expand All @@ -19,17 +19,17 @@ rules:
eol-last: 2
indent: [2, 2, {SwitchCase: 1}]
jsx-quotes: 2
keyword-spacing: 2
max-len: 0
no-multi-spaces: 2
no-redeclare: 2
no-shadow: 2
no-unused-expressions: 2
no-unused-vars: [2, {args: none}]
prefer-const: 2
quotes: [2, single, avoid-escape]
space-after-keywords: 2
space-before-blocks: 2
space-before-function-paren: 2
strict: [2, global]

# JSX
# Our transforms set this automatically
Expand Down
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.*node_modules/babel.*
.*node_modules/classnames.*
.*node_modules/json-loader.*
.*node_modules/json5.*
.*node_modules/node-libs-browser.*
.*node_modules/webpack.*
.*node_modules/fbjs/flow.*
Expand Down
2 changes: 2 additions & 0 deletions agent/Agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ class Agent extends EventEmitter {
if (renderer && this.reactInternals[renderer].getNativeFromReactElement) {
return this.reactInternals[renderer].getNativeFromReactElement(component);
}
return null;
}

selectFromDOMNode(node: Object, quiet?: boolean) {
Expand Down Expand Up @@ -271,6 +272,7 @@ class Agent extends EventEmitter {
return this.getId(component);
}
}
return null;
}

_setProps({id, path, value}: {id: ElementID, path: Array<string>, value: any}) {
Expand Down
5 changes: 3 additions & 2 deletions agent/Bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,16 @@ class Bridge {

_handleCall(name: string, args: Array<any>, callback: number) {
if (!this._callers[name]) {
return console.warn('unknown call: "' + name + '"');
console.warn('unknown call: "' + name + '"');
return;
}
args = !Array.isArray(args) ? [args] : args;
var result;
try {
result = this._callers[name].apply(null, args);
} catch (e) {
console.error('Failed to call', e);
return undefined;
return;
}
this._wall.send({
type: 'callback',
Expand Down
4 changes: 3 additions & 1 deletion backend/attachRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ function attachRenderer(hook: Hook, rid: string, renderer: ReactRenderer): Helpe
extras.getNativeFromReactElement = function(component) {
try {
return renderer.Mount.getNode(component._rootNodeID);
} catch (e) {}
} catch (e) {
return undefined;
}
};

extras.getReactElementFromNative = function(node) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/DataView/DataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class DataItem extends React.Component {
<div
onContextMenu={e => {
if (typeof this.props.showMenu === 'function') {
return this.props.showMenu(e, this.props.value, this.props.path, this.props.name);
this.props.showMenu(e, this.props.value, this.props.path, this.props.name);
}
}}
style={styles.preview}
Expand Down
1 change: 1 addition & 0 deletions frontend/DataView/previewComplex.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function previewComplex(data: Object) {
</span>
);
}
return null;
}

module.exports = previewComplex;
13 changes: 8 additions & 5 deletions frontend/decorate.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ module.exports = function(options: Options, Component: any): any {

componentWillMount() {
if (!this.context[storeKey]) {
return console.warn('no store on context...');
console.warn('no store on context...');
return;
}
this._update = () => this.forceUpdate();
if (!options.listeners) {
return undefined;
return;
}
this._listeners = options.listeners(this.props, this.context[storeKey]);
this._listeners.forEach(evt => {
Expand All @@ -80,7 +81,8 @@ module.exports = function(options: Options, Component: any): any {

componentWillUnmount() {
if (!this.context[storeKey]) {
return console.warn('no store on context...');
console.warn('no store on context...');
return;
}
this._listeners.forEach(evt => {
this.context[storeKey].off(evt, this._update);
Expand All @@ -99,10 +101,11 @@ module.exports = function(options: Options, Component: any): any {

componentWillUpdate(nextProps, nextState) {
if (!this.context[storeKey]) {
return console.warn('no store on context...');
console.warn('no store on context...');
return;
}
if (!options.listeners) {
return undefined;
return;
}
var listeners = options.listeners(this.props, this.context[storeKey]);
var diff = arrayDiff(listeners, this._listeners);
Expand Down
3 changes: 2 additions & 1 deletion frontend/dirToDest.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = function(dir: Dir, bottom: boolean, collapsed: boolean, hasChil
return 'firstChild';
}
}
return null;
}

return null;
};
Loading

0 comments on commit dfe8977

Please sign in to comment.