-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
Environment
Node version: v16.14.0
npm version: v8.3.1
Local ESLint version: v8.24.0 (Currently used)
Global ESLint version: Not found
Operating System: win32 10.0.19044
What parser are you using?
Default (Espree)
What did you do?
Project structure:
my-app/
├── foo/
│ └── bar/
│ └── a.js
└── eslint.config.js
// eslint.config.js
module.exports = {
ignores: ["foo/bar"]
};
Command 1:
eslint "foo/**" -f tap
Command 2:
eslint "foo/bar/**" -f tap
Command 3:
eslint foo/bar/a.js -f tap
What did you expect to happen?
I would expect the same result from all 3 commands. Since config ignores
patterns match files (not directories), the foo/bar/a.js
file should be linted.
What actually happened?
Command 1:
Oops! Something went wrong! :(
ESLint: 8.24.0
You are linting "foo/**", but all of the files matching the glob pattern "foo/**" are ignored.
If you don't want to lint these files, remove the pattern "foo/**" from the list of arguments passed to ESLint.
If you do want to lint these files, try the following solutions:
* Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored.
* Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument.
Command 2:
Oops! Something went wrong! :(
ESLint: 8.24.0
You are linting "foo/bar/**", but all of the files matching the glob pattern "foo/bar/**" are ignored.
If you don't want to lint these files, remove the pattern "foo/bar/**" from the list of arguments passed to ESLint.
If you do want to lint these files, try the following solutions:
* Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored.
* Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument.
Command 3:
TAP version 13
1..1
ok 1 - D:\tmp\my-app\foo\bar\a.js
Participation
- I am willing to submit a pull request for this issue.
Additional comments
Command 3 works as intended because it doesn't go through globby
.
With expandDirectories: true
(default), globby converts ignore: ["foo/bar"]
to ignore: ["foo/bar/**"]
when it finds that foo/bar
is a directory, so that's the direct reason why commands 1 and 2 do not work as we expect.
However, when I try with expandDirectories: false
here, there's still an inconsistency that seems to be in fast-glob
:
Command 1:
Oops! Something went wrong! :(
ESLint: 8.24.0
You are linting "foo/**", but all of the files matching the glob pattern "foo/**" are ignored.
If you don't want to lint these files, remove the pattern "foo/**" from the list of arguments passed to ESLint.
If you do want to lint these files, try the following solutions:
* Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored.
* Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument.
Command 2:
TAP version 13
1..1
ok 1 - D:\tmp\my-app\foo\bar\a.js
Command 3:
TAP version 13
1..1
ok 1 - D:\tmp\my-app\foo\bar\a.js
So, foo/bar
ignore pattern ignores everything in the directory foo/bar
when search pattern is foo/**
but doesn't when search pattern is foo/bar/**
.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status