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
Bug: [new config system] ignores
does not work without files
#17103
Comments
I am able to reproduce this. This is happening because configs without Maybe @nzakas can advise the best course of action here. |
This is a bug, the configuration object should not apply to file paths that match its
There are two cases:
eslint/docs/src/use/configure/configuration-files-new.md Lines 119 to 132 in 5ea15d9
|
Thanks for the clarification @mdjermanovic. Sometimes it's hard to know if it's the implementation that doesn't match the docs or vice-versa. That said, I find the headline of the example mentioned above confusing, as it should actually read (bold is my correction):
As for the bug, it needs to be fixed in @filetvignon would you like to submit a pull request? |
Yes, I think we should fix that in the docs. |
Just catching up on this now. This does look like a bug, and the docs could be clearer, I'd suggest something more along the lines of this:
|
When a config has `ignores` and not `files`, plus at least one other key, it should match all files that don't match `ignores` and the other keys should be merged into the resulting config. Prior to this, such a config was always merged in regardless if the filename matched `ignores`; after this change, it correctly merges in only when `ignores` matches. Refs eslint/eslint#17103
* fix: Config with just ignores should check ignores When a config has `ignores` and not `files`, plus at least one other key, it should match all files that don't match `ignores` and the other keys should be merged into the resulting config. Prior to this, such a config was always merged in regardless if the filename matched `ignores`; after this change, it correctly merges in only when `ignores` matches. Refs eslint/eslint#17103 * Update ignores logic * Update tests/config-array.test.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> --------- Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
I pushed a new version of @humanwhocodes/config-array, but I won't have time to integrate into ESLint before traveling for next week. |
I can take this, but it seems that the new version 0.11.9 hasn't been released. The release workflow failed on https://github.com/humanwhocodes/config-array/actions/runs/4961978783/jobs/8879447925 |
Sorry about that, should be published now. |
* fix: Config with just ignores should check ignores When a config has `ignores` and not `files`, plus at least one other key, it should match all files that don't match `ignores` and the other keys should be merged into the resulting config. Prior to this, such a config was always merged in regardless if the filename matched `ignores`; after this change, it correctly merges in only when `ignores` matches. Refs eslint/eslint#17103 * Update ignores logic * Update tests/config-array.test.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> --------- Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Environment
Node version: 18.16.0
npm version: 9.6.4
Local ESLint version: 8.38.0
Global ESLint version: N/A
Operating System: Ubuntu 22.04 (WSL)
What parser are you using?
Default (Espree)
What did you do?
Configuration
./error.js
and./warn.js
:Then run
eslint .
What did you expect to happen?
What actually happened?
Link to Minimal Reproducible Example
https://github.com/filetvignon/eslint-bug-ignores
Participation
Additional comments
I set 2 configuration objects: one with a rule all files and another to change that rule for all files EXCEPT
error.js
.I omitted the
files
property in these objects; although the documentation recommends usingignores
withfiles
, it states that this should work and omittingfiles
should be the same as usingfiles: '**/*'
.In reality, it works only if I explicitly set
files
in the second configuration object:The text was updated successfully, but these errors were encountered: