-
-
Notifications
You must be signed in to change notification settings - Fork 787
refactor(oxfmt): Split overridable format options #18019
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
refactor(oxfmt): Split overridable format options #18019
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. |
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 pull request refactors the format configuration structure by splitting overridable format options into a separate FormatConfig struct. This improves the organization and separation of concerns between per-file formatting options and global configuration like ignore patterns.
Changes:
- Introduced new
FormatConfigstruct containing all formatting options that can be overridden per-file - Restructured
Oxfmtrcto use flattenedFormatConfigand keep onlyignore_patternsat the top level - Modified
OxfmtOptionsto containFormatOptionsdirectly instead of having them separated - Updated
into_options()to return(OxfmtOptions, Vec<String>)instead of(FormatOptions, OxfmtOptions) - Converted
populate_prettier_configfrom instance method to standalone function
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/oxfmt/src/core/oxfmtrc.rs | Introduces FormatConfig struct, refactors Oxfmtrc and OxfmtOptions, updates into_options() signature and converts populate_prettier_config to standalone function, updates all tests |
| apps/oxfmt/src/core/config.rs | Updates to use new OxfmtOptions structure, imports populate_prettier_config as function, updates field access to use format_config, contains a critical bug with incorrect variable name |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
93f88e0 to
fe82698
Compare
Merge activity
|
Preparation for #17585. - Extract format related parts from `Oxfmtrc` to reuse as `overrides`. - Since using `serde(flatten)`, no user facing changes - Refine `OxfmtOptions` - Before: `Oxfmtrc` - `oxc_formatter::FormatOptions` - After: `Oxfmtrc` - `ignorePatterns`(not overridable)
fe82698 to
de72378
Compare

Preparation for #17585.
Oxfmtrcto reuse asoverrides.serde(flatten), no user facing changesOxfmtOptionsOxfmtrc-oxc_formatter::FormatOptionsOxfmtrc-ignorePatterns(not overridable)