-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
archived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyESLint is working incorrectlyrepro:neededThis issue should include a reproducible exampleThis issue should include a reproducible example
Description
Environment
Node version: v16.14.0
npm version: v8.3.1
Local ESLint version: v8.23.1 (Currently used)
Global ESLint version: Not found
Operating System: win32 10.0.19044
What parser are you using?
Default (Espree)
What did you do?
Folder structure:
my-app/
├── docs1/
│ └── foo.md
├── docs2/
│ └── bar.md
└── eslint.config.js
Config file:
// eslint.config.js
module.exports = [{
files: ["docs*/**/*.md"]
}];
Content of .md
files is not important.
Command:
eslint docs1 -f tap
What did you expect to happen?
TAP version 13
1..1
ok 1 - D:\tmp\my-app\docs1\foo.md
What actually happened?
TAP version 13
1..2
ok 1 - D:\tmp\my-app\docs1\foo.md
ok 2 - D:\tmp\my-app\docs2\bar.md
Participation
- I am willing to submit a pull request for this issue.
Additional comments
This happens because we are passing the docs*/**/*.md
pattern to globby. The pattern is correctly selected as a pattern that can match files inside the docs1
directory, but it can also match files outside the docs1
directory.
Some solutions could be to:
- Calculate a new pattern that would match like
docs*/**/*.md
but only inside thedocs1
directory. This seems very complex. - Keep passing the
docs*/**/*.md
pattern to globby, and after the globby call filter out results that are not inside thedocs1
directory. This should work at the end, but globby will still traverse directories outsidedocs1
, which seems wrong. - Pass
docs1/**/*
to globby, and after the globby call filter out results that are not matched bydocs*/**/*.md
. This should work, and I think it's a better approach than 2.
Metadata
Metadata
Assignees
Labels
archived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyESLint is working incorrectlyrepro:neededThis issue should include a reproducible exampleThis issue should include a reproducible example
Type
Projects
Status
Complete