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
overrides
from config in npm package looks for files in node_modules
#12278
Comments
Thank you for your report. Would you provide minimal repro steps? eslint/lib/cli-engine/config-array-factory.js Lines 493 to 496 in 00d2c5b
|
Ah, after re-read, it looks intentional behavior. Because you use |
Yes, this is how it works but it prevents you from using a valid config file which happens to be located in the node_modules and uses overrides in nested configs. There should be at least a way to provide the alternative base path for file matchers. |
To clarify, is this the same issue as #11558? (glob-based configuration along with |
It seems like you are correct. I can see it as the same issue once I read its full description. This is what is executed behind the scenes in the script which uses eslint with the config located elswehere: eslint --no-eslintrc --config /Users/gziolo/PhpstormProjects/gutenberg-examples/node_modules/@wordpress/scripts/config/.eslintrc.js --ignore-path /Users/gziolo/PhpstormProjects/gutenberg-examples/node_modules/@wordpress/scripts/config/.eslintignore . By the way, |
From https://github.com/WordPress/gutenberg/blob/1c35075833c6fba8619ee0dcfe4596e610ceef48/packages/scripts/config/.eslintignore, it's intentional behavior because those patterns don't start with |
Thank you for confirming. I'm closing this issue as a duplicate of #11558. It's intentional behavior, but I think we should change the behavior in the next major version. |
That's very interesting to learn. It looks like a lucky coincidence it works properly then. Thanks for opening eslint/rfcs/pull/37 which should change it to more anticipated behavior. |
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint
Please show your full configuration:
Configuration
I use the config file which is published to npm package when running ESLint.
Config file is located in
node_modules/@wordpress/scripts/config/.eslintrc.js
:The config file used in
extends
contains overrides as shown below:What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
It looks like
overrides
inherits alsobasePath
for filtering files from the location of the config file when usingextend
making it not that much useful when consuming config published to npm. Related PR where I discovered it: WordPress/gutenberg-examples#87 (comment)I reported in under #12032 (comment). It was only partially fixed with #12205.
What did you expect to happen?
Overrides in the config file match against my project rather than the folder where the config file is located in
node_modules
subfolder.What actually happened? Please include the actual, raw output from ESLint.
This is the line which sets
basePath
based on the location of the file:eslint/lib/cli-engine/config-array-factory.js
Line 485 in 00d2c5b
Example of the override:
which obviously can't match any files in the project.
Are you willing to submit a pull request to fix this bug?
I'm happy to do it if I get some guidelines what would be the best way to address it.
The text was updated successfully, but these errors were encountered: