-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Scripts: Add missing root flag to the default Eslint config #13483
Conversation
bb3e158
to
e23f449
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.
Trying to test this, I still see that ESLint will inherit rules from parent directories.
I think we need to use--either instead of or in addition-- the --no-eslintrc-js
parameter when falling back to the default-provided configuration.
https://eslint.org/docs/user-guide/command-line-interface#--no-eslintrc
Here:
[ '--config', fromConfigRoot( '.eslintrc.js' ) ] : |
To:
[ '--no-eslintrc', '--config', fromConfigRoot( '.eslintrc.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.
Added the proposed change. Feel free to merge if it makes sense to you.
I see this line in ESlint docs and it suddenly makes everything clear:
Thanks for catching it. I didn't think about configs located outside of the project at all. Never stop learning :) |
Kudos @aduth for changes applied 🥇 I will merge as soon as Travis will turn green. |
* Scripts: Add missing root flag to the default Eslint config * scripts: Instruct ESLint to avoid config discovery in defaulting
* Scripts: Add missing root flag to the default Eslint config * scripts: Instruct ESLint to avoid config discovery in defaulting
Description
Extracted from #13394 based on a suggestion from @aduth:
https://github.com/WordPress/gutenberg/pull/13394/files#r249797548
This PR adds missing
root
flag in the default ESlint config which works as explained in the docs (https://eslint.org/docs/user-guide/configuring):Testing
Not sure how to test with the recent configs added which depend on the
.eslintrc.js
in the root folder. Otherwise I would remove it and check whethernpm run lint-js
works.