fix: filter nested configs covered by parent global ignores#589
Merged
fix: filter nested configs covered by parent global ignores#589
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements logic to filter out nested configuration files that reside within directories ignored by a parent configuration's global ignores, aligning the behavior with ESLint v10. The changes include new utility functions for pattern matching and directory traversal, along with comprehensive test cases to verify the filtering logic. The review feedback suggests simplifying the directory pattern cleaning using a regular expression and optimizing the **/ pattern matching logic for better readability and conciseness.
49e2b93 to
17882aa
Compare
Deploying rslint with
|
| Latest commit: |
f578bcd
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://373574a9.rslint.pages.dev |
| Branch Preview URL: | https://fix-config-discovery-respect.rslint.pages.dev |
f578bcd to
65287fe
Compare
Align config discovery with ESLint v10 behavior: when a parent config has global ignores (entry with only `ignores`), nested configs in those ignored directories are filtered out. This prevents fixture/test configs from being independently executed when the root config intends to ignore their directories. In ESLint v10, `directoryFilter` in `globSearch()` calls `isDirectoryIgnored()` before entering a directory, so configs in globally ignored dirs are never discovered. rslint previously discovered ALL nested configs unconditionally via `findJSConfigsInDir`, then each config was processed independently. Key rules: - Only global ignores (entry with only `ignores`) filter nested configs - Entry-level ignores (files + ignores + rules) do NOT filter - Supports dir/**, **/dir/**, dir/ patterns - Intermediate config ignores only affect their own children
65287fe to
6d71bd3
Compare
chenjiahan
approved these changes
Apr 2, 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
directoryFilterchecksisDirectoryIgnored()before entering a directory, so configs in globally ignored dirs are never foundfindJSConfigsInDir, then each config was processed independently — parent ignores had no effect on nested config discoveryBefore: Root config
{ ignores: ['__tests__/**'] }→__tests__/fixtures/rslint.config.jsstill discovered and executed independentlyAfter: Root config
{ ignores: ['__tests__/**'] }→__tests__/fixtures/rslint.config.jsfiltered out, not executedKey rules:
ignores, no other fields) filter nested configs — aligned with ESLint flat config semantics{ files, ignores, rules }) do NOT filter nested configsdir/**,**/dir/**, anddir/patternsRelated Links
globSearchdirectoryFilter:lib/eslint/eslint-helpers.jsChecklist