-
Notifications
You must be signed in to change notification settings - Fork 26.8k
Adds eslint config extends with only whitespace rules enabled #1749
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
Conversation
6048e77
to
ec1c6af
Compare
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.
Can we also add this to the readmes?
@@ -0,0 +1 @@ | |||
require('../eslint-config-airbnb-base/whitespace'); |
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 think this will need extra react-specific whitespace rules?
ec1c6af
to
2f94973
Compare
Adds a change to eslint-config-airbnb and eslint-config-airbnb-base to pull a list of rules from the project root and return a config with all rules turned off except the whitespace rules explicitly listed in the array. Also adds entry point data to readme.
2f94973
to
6373dab
Compare
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.
Thanks, this looks great!
const { CLIEngine } = require('eslint'); | ||
|
||
function onlyErrorOnRules(rulesToError, config) { | ||
const errorsOnly = { ...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.
This object spread property in nodejs is introduced at version 8+. If this file is meant to be run with nodejs 8+, then we don't need to depend on more lib e.g. object.entries
, Object.entries
already exists there.
I can make a PR to clean this. What do you think, @ljharb?
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.
Even if we convert this file to be compatible with nodejs 4 which is declared in package.json, we still don't need this extra dependency, since eslint already depends on lodash, then we can add it too and use _.forEach.
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.
Whoops, this should use object.assign
instead of spread.
There’s no cost to an extra dev dep, and I’d prefer not to use lodash.
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 see, then we need to change array destructuring at line 10 too.
I'll make a PR, ok?
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.
Sure.
Adds a change to pull in the eslint config from the project root, turn off all rules except the whitespace rules explicitly listed in the array.
This list is hardcoded for now, if there are any that I'm missing please let me know: