-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Updating ESlint to ^4.15.0 and adding new rules to config #3723
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Seems like our code doesn't pass our preset now. |
.eslintrc
Outdated
"curly": "warn" | ||
"curly": "warn", | ||
"getter-return": "error", | ||
"function-paren-newline": ["error", "multiline"], |
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.
As far as I can see this is a style rule. We don't enable any style rules in this preset.
I have removed the style based rule and ran --fix over the packages. Turns out I was not running the correct eslint command. Is there a standard for running this across all the packages? Fingers crossed this passes 🤞 |
.eslintrc
Outdated
"curly": "warn" | ||
"curly": "warn", | ||
"getter-return": "error", | ||
"implicit-arrow-linebreak": ["error", "beside"] |
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.
Seems like another style rule?
Removed implicit-arrow-linebreak rule. and updated PR description to reflect added rules. |
.eslintrc
Outdated
@@ -12,6 +12,7 @@ | |||
"rules": { | |||
"no-console": "off", | |||
"strict": ["error", "global"], | |||
"curly": "warn" | |||
"curly": "warn", | |||
"getter-return": "error" |
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.
Isn't this our own eslintrc
? To update the rules of our config, you'd need to change eslint-config-react-app/index.js
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 good catch, I'll update the config
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.
Is it worth keeping this new rule in the root eslint config for development work?
I have added the new rule to |
@@ -239,6 +239,7 @@ module.exports = { | |||
'Please use import() instead. More info: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting', | |||
}, | |||
], | |||
'getter-return': 'error', |
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.
Let's make this a warning rather than an error?
package.json
Outdated
@@ -14,7 +14,7 @@ | |||
"precommit": "lint-staged" | |||
}, | |||
"devDependencies": { | |||
"eslint": "^4.4.1", |
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.
This version is not very relevant to our users. You want to change the one in packages/react-scripts/package.json
instead.
packages/react-scripts/package.json
Outdated
@@ -32,7 +32,7 @@ | |||
"chalk": "1.1.3", | |||
"css-loader": "0.28.7", | |||
"dotenv": "4.0.0", | |||
"eslint": "4.10.0", | |||
"eslint": "^4.15.0", |
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.
This needs to be pinned, like before.
I have changed the rule to warn and pinned the version of eslint. :) |
@gaearon thanks for all your help with this PR. 😃 |
Thanks! |
* Updating ESlint to ^4.15.0 and adding new rules to config * remoning style rule and auto fixing breakages from new rules * Removing implicit-arrow-linebreak style rule * adding new rule to eslint config project * updating react scripts eslint version * Pinning version. * Changing getter-return to warn * Update package.json * Update .eslintrc
* Updating ESlint to ^4.15.0 and adding new rules to config * remoning style rule and auto fixing breakages from new rules * Removing implicit-arrow-linebreak style rule * adding new rule to eslint config project * updating react scripts eslint version * Pinning version. * Changing getter-return to warn * Update package.json * Update .eslintrc
* Updating ESlint to ^4.15.0 and adding new rules to config * remoning style rule and auto fixing breakages from new rules * Removing implicit-arrow-linebreak style rule * adding new rule to eslint config project * updating react scripts eslint version * Pinning version. * Changing getter-return to warn * Update package.json * Update .eslintrc
* Updating ESlint to ^4.15.0 and adding new rules to config * remoning style rule and auto fixing breakages from new rules * Removing implicit-arrow-linebreak style rule * adding new rule to eslint config project * updating react scripts eslint version * Pinning version. * Changing getter-return to warn * Update package.json * Update .eslintrc
* Updating ESlint to ^4.15.0 and adding new rules to config * remoning style rule and auto fixing breakages from new rules * Removing implicit-arrow-linebreak style rule * adding new rule to eslint config project * updating react scripts eslint version * Pinning version. * Changing getter-return to warn * Update package.json * Update .eslintrc
* Updating ESlint to ^4.15.0 and adding new rules to config * remoning style rule and auto fixing breakages from new rules * Removing implicit-arrow-linebreak style rule * adding new rule to eslint config project * updating react scripts eslint version * Pinning version. * Changing getter-return to warn * Update package.json * Update .eslintrc
* Updating ESlint to ^4.15.0 and adding new rules to config * remoning style rule and auto fixing breakages from new rules * Removing implicit-arrow-linebreak style rule * adding new rule to eslint config project * updating react scripts eslint version * Pinning version. * Changing getter-return to warn * Update package.json * Update .eslintrc
* Updating ESlint to ^4.15.0 and adding new rules to config * remoning style rule and auto fixing breakages from new rules * Removing implicit-arrow-linebreak style rule * adding new rule to eslint config project * updating react scripts eslint version * Pinning version. * Changing getter-return to warn * Update package.json * Update .eslintrc
* Updating ESlint to ^4.15.0 and adding new rules to config * remoning style rule and auto fixing breakages from new rules * Removing implicit-arrow-linebreak style rule * adding new rule to eslint config project * updating react scripts eslint version * Pinning version. * Changing getter-return to warn * Update package.json * Update .eslintrc
Fixes #3341
I have updated the eslint dependency to 4.15.0 and enabled some non-controversial rules.
The newest rules added since the previous version 4.4.x are below, rules starred have been enabled:
This has not affected any code and no fixes have been needed. Let me know if anything else is needed or more/less rules should be enabled.
Thanks