-
-
Notifications
You must be signed in to change notification settings - Fork 724
Implement proper deep merging for settings, env, and globals in config extension and overrides #14940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
There was a problem hiding this 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 implements ESLint-compatible deep merge semantics for config extension and overrides. Previously, settings, env, and globals were replaced entirely when extending configs or using overrides. Now these fields are properly merged, allowing incremental configuration changes without redeclaring entire objects.
Key Changes:
- Added deep merge methods to all plugin settings types and
OxlintSettings - Implemented merge logic for
envandglobals - Added
settingsfield support to overrides with deep merge behavior
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| npm/oxlint/configuration_schema.json | Added settings field to override schema definition |
| crates/oxc_linter/src/snapshots/schema_json.snap | Updated schema snapshot with settings in overrides |
| crates/oxc_linter/src/config/settings/vitest.rs | Added merge method and is_empty helper to VitestPluginSettings |
| crates/oxc_linter/src/config/settings/react.rs | Added merge method and is_empty helper to ReactPluginSettings |
| crates/oxc_linter/src/config/settings/next.rs | Added merge method to NextPluginSettings |
| crates/oxc_linter/src/config/settings/mod.rs | Added merge and merge_into methods to OxlintSettings |
| crates/oxc_linter/src/config/settings/jsx_a11y.rs | Added merge method to JSXA11yPluginSettings |
| crates/oxc_linter/src/config/settings/jsdoc.rs | Added merge method and is_empty helper to JSDocPluginSettings |
| crates/oxc_linter/src/config/oxlintrc.rs | Updated to use merge methods for settings, env, and globals |
| crates/oxc_linter/src/config/overrides.rs | Added settings field to OxlintOverride struct |
| crates/oxc_linter/src/config/globals.rs | Added merge method to OxlintGlobals |
| crates/oxc_linter/src/config/env.rs | Added merge method to OxlintEnv |
| crates/oxc_linter/src/config/config_store.rs | Integrated settings merging in override resolution and added accessor methods |
| crates/oxc_linter/src/config/config_builder.rs | Added settings to override building and comprehensive merge tests |
| crates/oxc_linter/fixtures/extends_config/merge/*.json | Added test fixtures for merge behavior validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9b23573 to
f7a08f0
Compare
CodSpeed Performance ReportMerging #14940 will not alter performanceComparing Summary
Footnotes
|
f7a08f0 to
37c6e3f
Compare
|
CI Tests pass for me locally (macOS) so I'm not sure what's going on there. Looks like maybe just whitespace. |
ah I actually ran into the same problem in the last few weeks with that snapshot, if you revert the changes to that snapshot it should pass |
| Finished in <variable>ms on 43 files using 1 threads. | ||
| ---------- | ||
| CLI result: LintFoundErrors | ||
| Error running tsgolint: "exit status: exit status: 2"---------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably need to run pnpm i and re-run the test cases - this snapshot change looks incorrect.
|
Have we discussed whether this would be considered a breaking change? |
37c6e3f to
c1edd11
Compare
Yes, this was written with AI. However, I have manually reviewed all of it and it seems correct and high quality to me. That said, I am new to this codebase.
Problem
When extending configs or using overrides,
settings,env, andglobalswere completely replaced instead of being merged. This meant you had to redeclare entire configuration objects even if you only wanted to change one value.Solution
Implemented deep merge semantics (ESLint compatible) for config extension and added settings support to overrides:
Config Extension (
extends)components,attributes): Merged recursively - both parent and child entries are preserved, child overrides on conflictformComponents,rootDir): Replaced, not merged (ESLint v9 behavior)polymorphicPropName, booleans): Child overrides parentFile Overrides (
overrides)Changes
merge()methods to all plugin settings types (JSXA11yPluginSettings,ReactPluginSettings,NextPluginSettings,JSDocPluginSettings,VitestPluginSettings)OxlintSettings::merge()to orchestrate deep merging across all plugin settingsOxlintEnv::merge()andOxlintGlobals::merge()for deep mergeOxlintrc::merge()to use new merge methodssettingsfield toOxlintOverridestructPartialEqto settings structs for comparison optimizationTesting
fixtures/extends_config/merge/Example (Deep Merge)
Result (Deep Merge):
{ "browser": true, "node": true }— Both mergedpolymorphicPropName: "component"— Child overridescomponents: { "Link": "a", "Button": "button" }— Both merged{ "formComponents": ["CustomForm"] }— Added from childThis matches ESLint's deep merge behavior where nested objects are recursively merged but arrays are replaced.