Skip to content

fix(config): child config is overridden by parent config#21041

Closed
Leonabcd123 wants to merge 1 commit intooxc-project:mainfrom
Leonabcd123:fix/nested-configs
Closed

fix(config): child config is overridden by parent config#21041
Leonabcd123 wants to merge 1 commit intooxc-project:mainfrom
Leonabcd123:fix/nested-configs

Conversation

@Leonabcd123
Copy link
Copy Markdown
Contributor

@Leonabcd123 Leonabcd123 commented Apr 4, 2026

Fixes #21030, Fixes #20904

The problem was that when trying to resolve the current config file when linting some file, we walk up that file's ancestors until we find a nested config that applies to that directory, but we don't check whether the base config file applies to it. This means that if the file structure looks something like this:

oxlint.config.ts
dir/
  oxlint.config.ts
  file_to_lint.ts     

and our cwd was dir, and we ran oxlint file_to_lint.ts, the base config file would be dir/oxlint.config.ts (because it's in the current working directory) and the nested config would be oxlint.config.ts, so when resolving the final config file for file_to_lint.ts, dir/oxlint.config.ts would be skipped (because we don't check whether the base config applies), and thus oxlint.config.ts would be the one to take effect.

This pr makes it so we also check whether the base config applies to the current file, as well as nested configs.

@Leonabcd123 Leonabcd123 requested a review from camc314 as a code owner April 4, 2026 14:04
@github-actions github-actions Bot added A-linter Area - Linter C-bug Category - Bug labels Apr 4, 2026
@Leonabcd123 Leonabcd123 changed the title fix(config): child config overrides aren't applied fix(config): child config is overridden by parent config Apr 4, 2026
Copy link
Copy Markdown
Member

@Sysix Sysix left a comment

Choose a reason for hiding this comment

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

Thank you for the fix. I could test it locally it, your approach works and fixes both bugs.
I think your fix is not resolving the core problem.
The function caller will fall back to the base config, if no nested config is found. We want this code path to trigger.
I created a test and a fix in #21051 which resolve the underlying problem.
Your PR helped me to identify the root problem. Thank you for that!

@Sysix Sysix closed this Apr 4, 2026
@Leonabcd123 Leonabcd123 deleted the fix/nested-configs branch April 4, 2026 19:21
graphite-app Bot pushed a commit that referenced this pull request Apr 5, 2026
Fixes #21030, Fixes #20904, Obsoletes #21041

Nested config search did include the configs outside the current working directory. Resolving the config did find first the nested config outside the `cwd`, before falling back to the base config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-bug Category - Bug

Projects

None yet

2 participants