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: can't escape ]
in .eslintignore
#15642
Comments
Hi @beltekylevi, thanks for the issue! This seems to be a bug in ignore v4.0.6: const ignore = require("ignore");
// logs `false` with ignore v4.0.6, `true` with ignore v5.2.0
console.log(
ignore().add("src/\\[index\\].js").ignores("src/[index].js")
); The bug was fixed in v5.1.5 ("fixes escaping for square brackets"), but We could update the dependency in That update seems a bit risky though, and eslintrc will be replaced by the new config system in the next major release anyway. @nzakas what do you think, should we switch to ignore v5.2.0 in |
I’d like to avoid anything that changes how eslintrc behaves at this point, as that will make the new config system work more complicated. If we can upgrade without affecting any existing tests, then I think that’s okay, but if we need to change any existing tests then we should wait for the new config system. |
I tried upgrading |
Let's keep it open until we update |
* fix: escaping for square brackets in ignore patterns Fixes #15642 * remove file to fix its filename * re-add file to fix its filename * use github:eslint/eslintrc main branch * use @eslint/eslintrc@1.2.1
Many thanks for your work. |
* fix: escaping for square brackets in ignore patterns Fixes eslint#15642 * remove file to fix its filename * re-add file to fix its filename * use github:eslint/eslintrc main branch * use @eslint/eslintrc@1.2.1
Environment
Node version: v14.17.0
npm version: v8.3.0
Local ESLint version: v8.9.0 (Currently used)
Global ESLint version: Not found
Operating System: darwin 21.2.0
What parser are you using?
Default (Espree)
What did you do?
Configuration
I've set up minimal example repository to reproduce the issue but I'll describe the issue here as well.
I have a few files and some of them contain special characters like
[
.I'd like to ignore all of them so I have them listed in an
.eslintignore
using\
to escape the special characters.What did you expect to happen?
All files listed in
.eslintignore
to be ignored, zero errors.What actually happened?
Two of the files won't be ignored when I lint them using ESLint.
Participation
Additional comments
The same glob patterns work in
.gitignore
.The text was updated successfully, but these errors were encountered: