Skip to content

fix: filter nested configs covered by parent global ignores#589

Merged
fansenze merged 1 commit intomainfrom
fix/config-discovery-respect-ignores-20260402
Apr 2, 2026
Merged

fix: filter nested configs covered by parent global ignores#589
fansenze merged 1 commit intomainfrom
fix/config-discovery-respect-ignores-20260402

Conversation

@fansenze
Copy link
Copy Markdown
Contributor

@fansenze fansenze commented Apr 2, 2026

Summary

  • Align config discovery with ESLint v10 behavior: parent config's global ignores now prevent nested configs in ignored directories from being discovered
  • In ESLint v10, directoryFilter checks isDirectoryIgnored() before entering a directory, so configs in globally ignored dirs are never found
  • rslint previously discovered ALL nested configs unconditionally via findJSConfigsInDir, then each config was processed independently — parent ignores had no effect on nested config discovery

Before: Root config { ignores: ['__tests__/**'] }__tests__/fixtures/rslint.config.js still discovered and executed independently

After: Root config { ignores: ['__tests__/**'] }__tests__/fixtures/rslint.config.js filtered out, not executed

Key rules:

  • Only global ignores (entry with only ignores, no other fields) filter nested configs — aligned with ESLint flat config semantics
  • Entry-level ignores ({ files, ignores, rules }) do NOT filter nested configs
  • Supports dir/**, **/dir/**, and dir/ patterns
  • Single-config projects are unaffected

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/rslint/src/utils/config-discovery.ts Outdated
Comment thread packages/rslint/src/utils/config-discovery.ts
@fansenze fansenze force-pushed the fix/config-discovery-respect-ignores-20260402 branch 4 times, most recently from 49e2b93 to 17882aa Compare April 2, 2026 06:27
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 2, 2026

Deploying rslint with  Cloudflare Pages  Cloudflare Pages

Latest commit: f578bcd
Status: ✅  Deploy successful!
Preview URL: https://373574a9.rslint.pages.dev
Branch Preview URL: https://fix-config-discovery-respect.rslint.pages.dev

View logs

@fansenze fansenze force-pushed the fix/config-discovery-respect-ignores-20260402 branch 14 times, most recently from f578bcd to 65287fe Compare April 2, 2026 09:09
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
@fansenze fansenze force-pushed the fix/config-discovery-respect-ignores-20260402 branch from 65287fe to 6d71bd3 Compare April 2, 2026 09:11
@fansenze fansenze merged commit a5613e8 into main Apr 2, 2026
10 of 11 checks passed
@fansenze fansenze deleted the fix/config-discovery-respect-ignores-20260402 branch April 2, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants