You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The contents of bad.js (see above) are to be placed in the following places, relative to the root of
the project:
lint/bad.js
lint/not-ignored/bad.js
lint/.ignored/bad.js
Then simply run npx eslint ..
What did you expect to happen?
I would expect that the only two files linted here would be the first two (i.e. lint/bad.js and lint/not-ignored/bad.js).
What actually happened?
All three files are being included (and linted), see command output below:
Command output
$ npx eslint .
{cwd}/lint/.ignored/bad.js
1:5 error 'a' is assigned a value but never used no-unused-vars
{cwd}/lint/bad.js
1:7 error 'a' is assigned a value but never used no-unused-vars
{cwd}/lint/not-ignored/bad.js
1:5 error 'a' is assigned a value but never used no-unused-vars
✖ 3 problems (3 errors, 0 warnings)
If I specify an ignore pattern that ignores "dotted directories" then it correctly ignore that file. But I didn't expect to have to specify this. See command output below:
Command output
$ npx eslint --ignore-pattern '**/.*'.
{cwd}/lint/bad.js
1:7 error 'a' is assigned a value but never used no-unused-vars
{cwd}/lint/no-ignore/bad.js
1:5 error 'a' is assigned a value but never used no-unused-vars
✖ 2 problems (2 errors, 0 warnings)
Note that attempting this "please do actually ignore dotted directories" configuration inside an .eslintignore file doesn't seem to work, but it may be that I don't have the syntax quite right there, or maybe they don't work with flat configs and I haven't seen it in the docs.
I am willing to submit a pull request for this issue.
Additional comments
I can only assume I have done something wrong here, but I can't for the life of me see what it is! I do wonder if the semantics of eslint are quite different when using the new flat config, and maybe the docs aren't quite up-to-date with that?
The text was updated successfully, but these errors were encountered:
This works as intended. New flat-config use minimatch syntax to match files for linting which by default ignores directory or files starts with dot in their name unless {dot:true} is set, here we can see
This works as intended. In flat config, dotfiles and dotfolders are not ignored by default.
Note that attempting this "please do actually ignore dotted directories" configuration inside an .eslintignore file doesn't seem to work, but it may be that I don't have the syntax quite right there, or maybe they don't work with flat configs and I haven't seen it in the docs.
The pattern is good, but flat config doesn't support .eslintignore files. You can specify ignore patterns directly in eslint.config.js:
Environment
Node version: v21.2.0
npm version: 10.2.3
Local ESLint version: v8.57.0
Global ESLint version: not installed globally
Operating System: macOS 13.6.2
What parser are you using?
Default (Espree)
What did you do?
Configuration
Using the flat config style, file:
eslint.config.js
with"type": "module"
inpackage.json
.`bad.js` file contents
The contents of
bad.js
(see above) are to be placed in the following places, relative to the root ofthe project:
lint/bad.js
lint/not-ignored/bad.js
lint/.ignored/bad.js
Then simply run
npx eslint .
.What did you expect to happen?
I would expect that the only two files linted here would be the first two (i.e.
lint/bad.js
andlint/not-ignored/bad.js
).What actually happened?
All three files are being included (and linted), see command output below:
Command output
If I specify an ignore pattern that ignores "dotted directories" then it correctly ignore that file. But I didn't expect to have to specify this. See command output below:
Command output
Note that attempting this "please do actually ignore dotted directories" configuration inside an
.eslintignore
file doesn't seem to work, but it may be that I don't have the syntax quite right there, or maybe they don't work with flat configs and I haven't seen it in the docs.Link to Minimal Reproducible Example
https://github.com/alexrussell/eslint-ignore-demo
Participation
Additional comments
I can only assume I have done something wrong here, but I can't for the life of me see what it is! I do wonder if the semantics of eslint are quite different when using the new flat config, and maybe the docs aren't quite up-to-date with that?
The text was updated successfully, but these errors were encountered: