-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
Docs page(s)
https://eslint.org/docs/latest/use/configure/configuration-files#excluding-files-with-ignores
What documentation issue do you want to solve?
I was checking the flat config and was checking the ignores / files patterns.
Documentation specifies that
If ignores is used without files and there are other keys (such as rules), then the configuration object applies to all files except the ones specified in ignores
So using the config below should match all the files except the ignored one. Because,
Effectively, this is like having files set to **/*.
export default [
{
ignores: ["**/*.config.js"],
rules: {
semi: "error"
}
}
];
To test this I created a fail.txt
in the root. Apparently with the configuration file above it didn't match fail.txt
. Maybe it's because files
default to **/*.js
, **/*.cjs
and **/*.mjs
.
If that's the case docs confused me because it says if an ignore pattern used without files it should match all files except the ignored ones.
What confused me most is, I also tested removing ignores and setting a files
pattern like below:
export default [
{
files: ["**/*"],
rules: {
semi: "error"
}
}
];
Eslint didn't match fail.txt
again.
With files
set to ['**/*']
when I run npx eslint --inspect-config
I can see fail.txt
matches with 1 config object.
So, I am not sure if I completely misunderstood the concept, or docs are incorrect or is there a bug.
What do you think is the correct solution?
- Fix the docs if they are incorrect or make it clear.
- Fix the bug if there is.
Participation
- I am willing to submit a pull request for this change.
Additional comments
OS: Kubuntu 22.04
node version: 20.11.1
eslint version: 9.3.0
Metadata
Metadata
Assignees
Labels
Type
Projects
Status