fix(oxfmt): Use format_config for external_options override#18252
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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
format_config for external_options override
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the oxfmt configuration resolver where overrides weren't being applied correctly to options passed to external formatters (Prettier). The fix changes external_options to be constructed from format_config instead of raw_config, ensuring overrides are properly applied.
Changes:
- Modified
build_and_validate()to serializeformat_configforexternal_optionsinstead of cloningraw_config - Updated the slow path in
resolve_options()with the same change for consistency - Added detailed comments explaining the trade-off: plugin-specific options are no longer preserved, but overrides now work correctly
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/oxfmt/src/core/config.rs | Changed external_options initialization from raw_config to serialized format_config in both fast and slow paths, with updated comments explaining the trade-off |
| apps/oxfmt/test/cli/oxfmtrc_overrides/snapshots/oxfmtrc_overrides.test.ts.snap | Updated test snapshot showing the bug fix - Prettier options override test now passes (exit code 0 instead of 1) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
d673577 to
864b4ab
Compare
# Oxlint ### ⚡ Performance - 1a247f1 linter/no-redeclare: Avoid repeated PHF hashmap lookups (#18248) (overlookmotel) ### 📚 Documentation - 8a294d5 oxfmt, oxlint: Update logo (#18242) (Dunqing) # Oxfmt ### 🐛 Bug Fixes - 864b4ab oxfmt: Use `format_config` for `external_options` override (#18252) (leaysgur) - 90ce4b7 oxfmt: Restore `customGroups` handling lost (#18243) (leaysgur) ### 📚 Documentation - 8a294d5 oxfmt, oxlint: Update logo (#18242) (Dunqing) Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com>

Fixes #18246