feat: support ! negation patterns in ignore matching#590
Merged
chenjiahan merged 1 commit intomainfrom Apr 3, 2026
Merged
Conversation
Deploying rslint with
|
| Latest commit: |
4af9a2c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://46d5e54f.rslint.pages.dev |
| Branch Preview URL: | https://fix-go-negation-ignore-20260.rslint.pages.dev |
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements support for ! negation patterns in ignore configurations, aligning with ESLint v10 semantics. The changes include sequential pattern evaluation where later patterns override earlier ones, cross-entry global ignore merging, and comprehensive new tests. Documentation has also been updated to clarify the usage of negation with different glob patterns. Feedback suggests refactoring the path matching logic in isFileIgnored to reduce code duplication by using a closure.
dae5d34 to
d5373f6
Compare
Align isFileIgnored with ESLint v10 semantics: evaluate ignore patterns sequentially where later patterns override earlier ones. A `!` prefix negates (re-includes) a file that was previously matched by an earlier ignore pattern. Global ignore entries are merged before evaluating, so negation works across separate entries.
d5373f6 to
4af9a2c
Compare
chenjiahan
approved these changes
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isFileIgnoredwith ESLint v10 semantics: evaluate ignore patterns sequentially where later patterns override earlier ones!prefix negates (re-includes) a file that was previously matched by an earlier ignore pattern!negation works across separate global ignore entries!is now supported (was previously marked as unsupported)Examples:
Known difference from ESLint v10:
{ ignores: ['dir/**', '!dir/keep.ts'] }— In ESLint v10,dir/**blocks directory traversal so!cannot re-include duringeslint .. In rslint, files from tsconfig Programs bypass directory traversal, so!re-includes at the file matching level. This is a file discovery architecture difference (to be addressed in the files-driven-lint PR), not an ignore matching logic issue. Usingdir/**/*instead ofdir/**produces identical behavior in both tools.Related Links
Checklist