Skip to content

Bug: [new config system] Patterns cannot re-ignore #16416

Description

@mdjermanovic

Environment

Node version: v16.14.0
npm version: v8.3.1
Local ESLint version: main branch
Global ESLint version: Not found
Operating System: win32 10.0.19044

What parser are you using?

Default (Espree)

What did you do?

my-app/
├── a.js
└── eslint.config.js
// eslint.config.js
module.exports = [{
  ignores: [
      "*.js",
      "!a*.js",
      "a.js"
  ]
}];

Command:

eslint a.js -f tap

What did you expect to happen?

I'd expect a.js to be ignored. It should be possible to re-ignore previously unignored files. In other words, the last pattern that matches the file should determine whether the file is ignored: if it's non-negative then the file is ignored, if it's negative then the file is not ignored,

(unless the file is in an ignored directory, in which case the file is ignored regardless of patterns that match the file itself).

What actually happened?

TAP version 13
1..1
ok 1 - D:\tmp\my-app\a.js

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

The same applies to directories. I believe that the code that determines whether a directory is ignored should be the same as the code that determines whether a file is ignored by ignore patterns, except that we should make sure that the directory path ends with a / so that it can match with patterns that end with /.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    archived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyrepro:neededThis issue should include a reproducible example

    Type

    No type

    Projects

    • Status
      Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions