-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update eslint, use babel-eslint, eslint-plugin-react, fixes #1370
Conversation
@@ -129,7 +146,7 @@ | |||
"no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block | |||
"no-undefined": 0, // disallow use of undefined variable (off by default) | |||
"no-undef-init": 1, // disallow use of undefined when initializing variables | |||
"no-unused-vars": [1, {"vars": "all", "args": "none"}], // disallow declaration of variables that are not used in the code | |||
// "no-unused-vars": [1, {"vars": "all", "args": "none"}], // disallow declaration of variables that are not used in the code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should of made a comment for that sorry (or just remove it).
It's replaced with "react/jsx-uses-vars": 1,
in line 54 because of issues with jsx/eslint. ESLint isn't supporting it so it's recommended to use eslint-plugin-react
ESLint supports only the JSX syntax not the semantic of react. http://eslint.org/blog/2015/03/eslint-0.17.0-released/
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
https://github.com/eslint/eslint/search?q=no-unused-vars+for+jsx&type=Issues&utf8=%E2%9C%93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know! However, it looks like this still shouldn't be disabled. The jsx-uses-vars docs say:
This rule has no effect if the no-unused-vars rule is not enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok - good to know xd - will add it back. Probably need to use these rules at some point instead of just recommending it.
And from Travis - not sure what can be done about this? /Users/travis/build/facebook/react-native/node_modules/jstransform/node_modules/commoner/test/source/widget/share.js: WidgetShare
Duplicate module provider
/Users/travis/build/facebook/react-native/node_modules/babel-eslint/node_modules/babel-core/node_modules/regenerator/node_modules/commoner/test/source/widget/share.js: |
Yup :) I've integrated the .eslintrc & package.json parts of it into a commit internally (in conjunction with #259). This will be synced up here soon. I'm going to hold off on the lint fixes for now -- the extra arguments to functions are good for documentation (how will this function be called) even if they aren't used, and I think the convention is to double-quote jsx params Thanks for the work! |
Ah ok! |
the packager now uses babel and the linter uses babel-eslint. is there anything else that needs to be done with this? |
No this just fixed a few of the lint errors but that can be done seperately - will close. |
While working on babel/babel-eslint#108, @wincent mentioned I could check out react-native for examples of flow type usage.
In order to test I updated eslint": "0.21.2", fix deprecated rules, add config to support es6/jsx/react, add babel-eslint. I figured I could do a PR with some fixes (mostly unused parameters, quotes, semicolons etc) to see if it's wanted?
You should be able to then use
"lint": "./node_modules/.bin/eslint Examples Libraries"
(I didn't fix anything in Libraries yet)