Skip to content

fix(oxlint/cli): report error when nested config could not be parsed#18504

Merged
graphite-app[bot] merged 1 commit intomainfrom
01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed
Jan 26, 2026
Merged

fix(oxlint/cli): report error when nested config could not be parsed#18504
graphite-app[bot] merged 1 commit intomainfrom
01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Jan 24, 2026

fixed the TODO where we skipped reporting the error when the oxlintrc config could not be created from a file.
Refactored the code a bit so we searched only for the file paths first and then creating the Oxlintrc directly and passing it to the store builder.
The refactoring should us allow creating a helper function and combining it with LSP, where it knows already the config paths from a walker.

fn create_nested_configs(
root_path: &Path,
external_linter: Option<&ExternalLinter>,
external_plugin_store: &mut ExternalPluginStore,
nested_ignore_patterns: &mut Vec<(Vec<String>, PathBuf)>,
extended_paths: &mut FxHashSet<PathBuf>,
) -> FxHashMap<PathBuf, Config> {
let paths = ConfigWalker::new(root_path).paths();
let mut nested_configs =
FxHashMap::with_capacity_and_hasher(paths.capacity(), FxBuildHasher);
for path in paths {
let file_path = Path::new(&path);
let Some(dir_path) = file_path.parent() else {
continue;
};
let Ok(oxlintrc) = Oxlintrc::from_file(file_path) else {
warn!("Skipping invalid config file: {}", file_path.display());
continue;
};
// Collect ignore patterns and their root
nested_ignore_patterns.push((oxlintrc.ignore_patterns.clone(), dir_path.to_path_buf()));
let Ok(config_store_builder) = ConfigStoreBuilder::from_oxlintrc(
false,
oxlintrc,
external_linter,
external_plugin_store,
) else {
warn!("Skipping config (builder failed): {}", file_path.display());
continue;
};
extended_paths.extend(config_store_builder.extended_paths.clone());
let config = config_store_builder.build(external_plugin_store).unwrap_or_else(|err| {
warn!("Failed to build nested config for {}: {:?}", dir_path.display(), err);
ConfigStoreBuilder::empty().build(external_plugin_store).unwrap()
});
nested_configs.insert(dir_path.to_path_buf(), config);
}
nested_configs
}

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI labels Jan 24, 2026
Copy link
Member Author

Sysix commented Jan 24, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the C-bug Category - Bug label Jan 24, 2026
@Sysix Sysix force-pushed the 01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed branch from 3ac4344 to e537979 Compare January 24, 2026 19:52
@Sysix Sysix changed the base branch from main to graphite-base/18504 January 24, 2026 22:35
@Sysix Sysix force-pushed the 01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed branch from e537979 to abd3dcf Compare January 24, 2026 22:35
@Sysix Sysix force-pushed the graphite-base/18504 branch from 94a9973 to f039b0b Compare January 24, 2026 22:35
@Sysix Sysix changed the base branch from graphite-base/18504 to 01-24-refactor_oxlint_move_--print-config_into_a_own_file January 24, 2026 22:35
@Sysix Sysix changed the base branch from 01-24-refactor_oxlint_move_--print-config_into_a_own_file to graphite-base/18504 January 25, 2026 12:27
@Sysix Sysix force-pushed the 01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed branch from abd3dcf to 8b45bf6 Compare January 25, 2026 12:27
@Sysix Sysix changed the base branch from graphite-base/18504 to 01-25-refactor_oxlint_outputformatter.all_rules_accept_enabled_rules_and_simplify_run_rules_logic January 25, 2026 12:27
@Sysix Sysix changed the base branch from 01-25-refactor_oxlint_outputformatter.all_rules_accept_enabled_rules_and_simplify_run_rules_logic to graphite-base/18504 January 25, 2026 12:46
@Sysix Sysix force-pushed the graphite-base/18504 branch from 5468a31 to 6c44707 Compare January 25, 2026 12:46
@Sysix Sysix force-pushed the 01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed branch from 8b45bf6 to 57b7de3 Compare January 25, 2026 12:46
@Sysix Sysix changed the base branch from graphite-base/18504 to 01-25-test_oxlint_use_sub_directory_for_tsconfig_option_test January 25, 2026 12:47
@Sysix Sysix changed the base branch from 01-25-test_oxlint_use_sub_directory_for_tsconfig_option_test to graphite-base/18504 January 25, 2026 13:30
@Sysix Sysix force-pushed the 01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed branch from 57b7de3 to 6f81f22 Compare January 25, 2026 13:30
@Sysix Sysix changed the base branch from graphite-base/18504 to 01-25-test_oxlint_fix_nested_config_duplicate_fixture January 25, 2026 13:30
@Sysix Sysix force-pushed the 01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed branch from 6f81f22 to 53745b1 Compare January 25, 2026 13:43
@Sysix Sysix marked this pull request as ready for review January 25, 2026 13:44
@Sysix Sysix requested a review from camc314 as a code owner January 25, 2026 13:44
@Sysix Sysix requested a review from Copilot January 25, 2026 13:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes error reporting when nested oxlint configuration files cannot be parsed. Previously, invalid nested configs were silently skipped (as noted by a TODO comment). The refactoring now properly reports parse errors and returns an error status to the CLI.

Changes:

  • Refactored config loading to separate path discovery from config parsing
  • Added proper error handling and reporting for invalid nested configuration files
  • Added test coverage with fixtures and snapshot for the invalid nested config scenario

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/oxlint/src/lint.rs Refactored get_nested_configs to use FxHashSet<PathBuf> for path discovery, added error handling for Oxlintrc::from_file, renamed helper function to find_oxlint_config_path_in_directory, and added test case
apps/oxlint/src/snapshots/[email protected] Snapshot of expected error output when encountering an invalid nested config
apps/oxlint/fixtures/invalid_config_nested/.oxlintrc.json Valid root config file for test fixture
apps/oxlint/fixtures/invalid_config_nested/invalid/.oxlintrc.json Invalid nested config file (references unknown plugin) for test fixture
apps/oxlint/fixtures/invalid_config_nested/invalid/foo.ts TypeScript file to trigger config discovery in test fixture

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

graphite-app bot pushed a commit that referenced this pull request Jan 25, 2026
The test would fail when nested configs are reporting errors in #18504
@graphite-app graphite-app bot changed the base branch from 01-25-test_oxlint_fix_nested_config_duplicate_fixture to graphite-base/18504 January 25, 2026 17:13
graphite-app bot pushed a commit that referenced this pull request Jan 25, 2026
graphite-app bot pushed a commit that referenced this pull request Jan 25, 2026
The test would fail when nested configs are reporting errors in #18504
graphite-app bot pushed a commit that referenced this pull request Jan 25, 2026
@graphite-app graphite-app bot force-pushed the 01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed branch from e2dab66 to 3a22043 Compare January 25, 2026 18:18
@graphite-app graphite-app bot force-pushed the graphite-base/18504 branch from a259951 to a3c773b Compare January 25, 2026 18:18
@graphite-app graphite-app bot changed the base branch from graphite-base/18504 to 01-25-test_oxlint_fix_nested_config_duplicate_fixture January 25, 2026 18:18
@graphite-app graphite-app bot force-pushed the 01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed branch from 3a22043 to b07c74d Compare January 25, 2026 18:18
Base automatically changed from 01-25-test_oxlint_fix_nested_config_duplicate_fixture to main January 25, 2026 18:27
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Jan 26, 2026
Copy link
Contributor

camc314 commented Jan 26, 2026

Merge activity

…18504)

fixed the TODO where we skipped reporting the error when the oxlintrc config could not be created from a file.
Refactored the code a bit so we searched only for the file paths first and then creating the `Oxlintrc` directly and passing it to the store builder.
The refactoring should us allow creating a helper function and combining it with LSP, where it knows already the config paths from a walker.
https://github.com/oxc-project/oxc/blob/94a9973ba810129118d92e085c579a3f20c82dc6/apps/oxlint/src/lsp/server_linter.rs#L271-L312
@graphite-app graphite-app bot force-pushed the 01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed branch from b07c74d to 0ff4cea Compare January 26, 2026 15:33
@graphite-app graphite-app bot merged commit 0ff4cea into main Jan 26, 2026
19 checks passed
@graphite-app graphite-app bot deleted the 01-24-fix_oxlint_cli_report_error_when_nested_config_could_not_be_parsed branch January 26, 2026 15:39
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 26, 2026
camc314 added a commit that referenced this pull request Feb 2, 2026
# Oxlint
### 💥 BREAKING CHANGES

- b34a155 linter/plugins: [**BREAKING**] `RuleTester` set
`context.filename` to absolute path (#18702) (overlookmotel)

### 🚀 Features

- 1753209 linter/vscode: Run extension when JS configs are detected
(#18832) (camc314)
- c962dd2 linter/lsp: Implement support for oxlint.config.ts (#18826)
(camc314)
- da32203 linter: Auto generate oxlint.config.ts types (#18597)
(camc314)
- 19b4df7 oxlint: Introduce `defineConfig` helper (#18596) (camc314)
- ea97231 linter: Implement `oxlint.config.ts` support (#17563)
(camc314)
- 17ca42d linter: Implement `react/no-multi-comp` rule. (#18794)
(connorshea)
- 88f30e0 linter/plugins: Move eslint compatible plugin conversion to
`eslintCompatPlugin` function (#18791) (overlookmotel)
- 2a72794 linter/plugins: `RuleTester` take `cwd` property (#18756)
(overlookmotel)
- 9f533db linter: Add `find_prev_token_within` method for token search
(#18769) (camc314)
- 772ea70 linter: Introduce `load_js_configs` napi callback (#18767)
(camc314)
- e9690c1 linter: Introduce `DiscoveredConfig` in preparation for JS
configs (#18674) (camc314)
- 558b588 linter/prefer-namespace-keyword: Move to correctness (#18733)
(camc314)
- 7a5c268 oxlint/lsp: Support `jsPlugins` (#17840) (Sysix)
- c07497c linter/prefer-modern-dom-apis: Implement suggestion (#17965)
(Mikhail Baev)
- 8531bc9 linter: Implement `prefer-const` (#18687) (camchenry)
- 8670b18 parser: Error on ambient class accessor implementations
(#18592) (camc314)
- 6b8a5ae linter: Add `eslint-plugin-import/no-nodejs-modules` rule
(#18006) (Mikhail Baev)
- 04f400d linter/no-duplicates: Add support for `considerQueryString`
option (#18657) (camc314)
- 3b7f260 linter/consistent-generic-constructor: Implement fixer
(#18616) (camc314)
- 794f9e4 linter/prefer-exponentation-operator: Implement suggestion
(#18602) (camc314)
- 773d916 linter: `eslint/sort_keys` ignore leading and trailing spreads
in auto-fix (#18485) (Lonami)
- 20d4ede linter: Implement `import/no-relative-parent-imports` rule
(#18513) (Valentin Maerten)
- 0da45ef vscode: Fallback to globally installed oxlint/oxfmt packages
(#18007) (Sysix)

### 🐛 Bug Fixes

- a3417b1 linter/plugins: Clear state when reloading workspace (#18837)
(overlookmotel)
- c879992 linter: Error on arrays passed in as config (#18822) (camc314)
- 5c80422 linter/tsdown: Ensure relative path for globals import starts
with `./` (#18820) (camc314)
- 7419dfb linter: Remove invalid debug assersion, add test (#18819)
(camc314)
- 0ca6269 ci: Fix the repo path normalization logic for tests on
Windows. (#18815) (connorshea)
- c7b0a65 linter: Fix config option docs for `react/jsx-boolean-value`
rule. (#18811) (connorshea)
- cce374e linter/prefer-const: Replace entire declaration over just the
`let` kw (#18814) (camc314)
- 41f92d1 linter: Error when given config options for a lint rule that
has no config options defined. (#18809) (connorshea)
- 0867a36 linter/consistent-index-object-style: False positive with
mapped + generic types (#18801) (camc314)
- 1d34b42 linter: Fix 32 bit build (#18783) (camc314)
- 95df577 linter/plugins: Handle error from `destroyWorkspace` (#18763)
(overlookmotel)
- b3261dc linter: Fix the curly rule config to enforce the shape of the
config and emit correct docs (#18743) (connorshea)
- d981978 linter/plugins: Use non-blocking mode when calling
`destroyWorkspace` (#18762) (overlookmotel)
- 3f43d4c linter: Accept bools as valid values for `fixable` (#18772)
(camc314)
- 005910a linter/plugins: Support plugins outside of workspace (#18755)
(overlookmotel)
- fd92711 vscode: Use `fsPath` for workspace mapping (#18728) (Sysix)
- 358b2c1 linter/consistent-generic-constructors: Check bounds when
searching for `:` token (#18745) (connorshea)
- abd0c28 linter/capitalized-comments: Fix generated rule option docs
(#18748) (connorshea)
- d90a9f6 linter: Add more tests for `prefer-const`'s fixer and fix its
invalid behavior. (#18747) (connorshea)
- f82011b oxlint/lsp: Disable JS plugins support in LSP except in tests
(#18727) (overlookmotel)
- 94505c8 linter/jest: Change `prefer-spy-on` autofix to suggestion
(#18152) (Ben Lowery)
- 6ec1112 linter: Mark unused disable directive fix as suggestion
(#18703) (ddmoney420)
- 49609ec linter/no-useless-constructor: Consider argument
transformation as used (#18706) (ddmoney420)
- 40218de linter: Fix behavior of
jsx-a11y/no-static-element-interactions rule. (#17817) (connorshea)
- db9751d linter/no-html-link-for-pages: Handle `target=_blank`
correctly (#18693) (camc314)
- e440b78 linter/plugins: Pass all args to CFG event handlers when 2
rules use same handler (#18683) (overlookmotel)
- b393430 linter/curly: Fix multi-or-nest and consistent conflict
(#18660) (camc314)
- 2e1fbc2 linter/plugins: Implement `context.parserPath` (#18644)
(overlookmotel)
- 34951ed linter/plugins: `filename` option takes precedence over
`parserOptions.lang` in `RuleTester` (#18643) (overlookmotel)
- 28df160 linter/plugins: Allow line number passed to `report` to be 0
(#18642) (overlookmotel)
- 14fabec vscode: Use built-in `getWorkspaceFolder` for detecting the
right workspace of a given uri (#18583) (Sysix)
- 0ff4cea oxlint/cli: Report error when nested config could not be
parsed (#18504) (Sysix)

### ⚡ Performance

- 9862224 linter/plugins: Reduce cost of workspaces (#18758)
(overlookmotel)
- 6bc0bde linter: Remove string allocation (#18725) (overlookmotel)
- 3a6b41e linter/plugins: Replace ESLint Traverser with lightweight
traverseNode (#18529) (Rintaro Itokawa)

### 📚 Documentation

- dd1a653 linter: Fix doc comment for ignoreStateless config option.
(#18808) (connorshea)
- 5909085 linter/plugins: Add doc comments (#18753) (overlookmotel)
- ffe53a3 linter: Update lint function docs (#18766) (camc314)
- b82faec linter: Glob for any css module for no-unassigned-import
(#18713) (Ben Stickley)
- cd86347 linter: Mark some react rules as unsupported, misc docs
improvements (#18617) (connorshea)
- 23401d8 linter: Update fixes and suggestions status for tsgolint rules
(#18619) (camchenry)
# Oxfmt
### 🚀 Features

- ee30de9 oxfmt: Add config migration from biome (#18638) (Luca Fischer)

### 🐛 Bug Fixes

- e754b18 oxfmt/migrate-prettier: Set `experimentalSortPackagejson:
false` by default (#18831) (leaysgur)
- a83c266 formatter: Keep decorated function pattern hugged when params
break (#18830) (Dunqing)
- 0c8efe1 formatter: Quote numeric property keys with `quoteProps:
consistent` (#18803) (Dunqing)
- 9c14c3e formatter: Ignore comment does not work for sequence
expressions in arrow function body (#18799) (Dunqing)
- 54984ae formatter: Handle leading comments in arrow function sequence
expressions (#18798) (Dunqing)
- 61bb2b5 formatter: Correctly expand JSX returned from arrow callbacks
in JSX expression containers (#18797) (Dunqing)
- 34ee194 formatter: Tailwindcss sorting doesn't work for object
property keys (#18773) (Dunqing)
- 48f1e35 oxfmt: Prevent ThreadsafeFunction crash on Node.js exit
(#18723) (Boshen)
- e96adca formatter: Follow Prettier's approach for for-in initializer
parentheses (#18695) (Dunqing)
- 1215a6f formatter: Preserve quote for class property key in TypeScript
(#18692) (Dunqing)
- 059acae formatter: Incorrect comments placement for union type in
`TSTypeIntersection` (#18690) (Dunqing)
- c3d05c1 formatter,oxfmt: Handle CRLF with embedded formatting (#18686)
(leaysgur)
- 7cb3085 formatter: Preserve comments on rest elements (#18649)
(Dunqing)
- 21984dd formatter: Preserve type cast comments on rest parameters
(#18648) (Dunqing)
- 2f70254 formatter: Don't add extra semicolon on suppressed class
properties (#18631) (Dunqing)
- ac1ff4e oxfmt: Use `empty_line` IR for empty xxx-in-js line (#18623)
(leaysgur)
- 8f76900 oxfmt: Dedent xxx-in-js templates before calling prettier
(#18622) (leaysgur)
- 6b726ef oxfmt: Trim whitespace only xxx-in-js templates (#18621)
(leaysgur)

Co-authored-by: camc314 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments