Skip to content

refactor(formatter/oxfmtrc): Fix up Oxfmtrc and oxfmtrc.rs#16933

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-16-refactor_formatter_oxfmtrc_fix_up_oxfmtrc.rs
Dec 16, 2025
Merged

refactor(formatter/oxfmtrc): Fix up Oxfmtrc and oxfmtrc.rs#16933
graphite-app[bot] merged 1 commit intomainfrom
12-16-refactor_formatter_oxfmtrc_fix_up_oxfmtrc.rs

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Dec 16, 2025

This is a refactoring related to the Oxfmtrc struct.

  • Clearly state that defined in oxc_formatter is temporary
    • Also changed export path
  • Remove useless default attribute from Oxfmtrc
    • Defaults are resolved by into_options()
  • Mark all SortImportsConfig fields as Option
    • Aligned with Oxfmtrc, needed for Node.js API
  • Move from_file() to oxc_language_server, which only used by here

@github-actions github-actions bot added A-cli Area - CLI A-editor Area - Editor and Language Server A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Dec 16, 2025
Copy link
Member Author

leaysgur commented Dec 16, 2025


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.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 16, 2025

CodSpeed Performance Report

Merging #16933 will not alter performance

Comparing 12-16-refactor_formatter_oxfmtrc_fix_up_oxfmtrc.rs (5ea9f08) with main (c897794)1

Summary

✅ 42 untouched
⏩ 3 skipped2

Footnotes

  1. No successful run was found on main (ce943c6) during the generation of this report, so c897794 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@leaysgur leaysgur force-pushed the 12-16-refactor_formatter_oxfmtrc_fix_up_oxfmtrc.rs branch from f3c0a66 to 5ed57f9 Compare December 16, 2025 04:06
@leaysgur leaysgur changed the title refactor(formatter/oxfmtrc): Fix up oxfmtrc.rs refactor(formatter/oxfmtrc): Fix up Oxfmtrc and oxfmtrc.rs Dec 16, 2025
@leaysgur leaysgur marked this pull request as ready for review December 16, 2025 04:28
Copilot AI review requested due to automatic review settings December 16, 2025 04:28
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 refactors the Oxfmtrc configuration struct to improve its design and maintainability. The primary goals are to clarify that the struct's current location in oxc_formatter is temporary (due to circular dependencies), remove unnecessary default attributes that are handled elsewhere, align SortImportsConfig fields with the Option-based pattern used throughout Oxfmtrc, and move the from_file() method to its only user (oxc_language_server).

Key Changes:

  • Added documentation explaining why Oxfmtrc is temporarily in oxc_formatter instead of apps/oxfmt
  • Removed #[default] attributes from config enums since defaults are resolved during into_options() conversion
  • Changed all SortImportsConfig fields to Option types with improved documentation showing defaults
  • Moved from_file() method from oxfmtrc.rs to oxc_language_server as it's the only consumer
  • Restructured module exports: oxfmtrc is now a public module, and parse_utils content moved to service/mod.rs

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/oxc_formatter/src/oxfmtrc.rs Added explanatory comments, removed enum #[default] attributes, changed SortImportsConfig to use Option fields, removed from_file() method, refactored into_options() to handle Option unwrapping
crates/oxc_formatter/src/lib.rs Changed oxfmtrc from private module to public, simplified service exports
crates/oxc_formatter/src/service/mod.rs Merged parse_utils.rs content directly into mod.rs
crates/oxc_formatter/src/service/parse_utils.rs File deleted (content moved to mod.rs)
crates/oxc_formatter/Cargo.toml Removed json-strip-comments dependency (moved to language server)
crates/oxc_language_server/src/formatter/server_formatter.rs Added from_file() method, updated imports to new oxfmtrc module path
crates/oxc_language_server/Cargo.toml Added json-strip-comments dependency
apps/oxfmt/src/core/config.rs Updated imports to use new oxfmtrc module path
Test files and schemas Updated imports and regenerated JSON schemas with new descriptions showing default values
Cargo.lock Reflects dependency movement between crates

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

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 16, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 16, 2025

Merge activity

This is a refactoring related to the `Oxfmtrc` struct.

- Clearly state that defined in `oxc_formatter` is temporary
  - Also changed export path
- Remove useless `default` attribute from `Oxfmtrc`
  - Defaults are resolved by `into_options()`
- Mark all `SortImportsConfig` fields as `Option`
  - Aligned with `Oxfmtrc`, needed for Node.js API
- Move `from_file()` to `oxc_language_server`, which only used by here
@graphite-app graphite-app bot force-pushed the 12-16-refactor_formatter_oxfmtrc_fix_up_oxfmtrc.rs branch from 5ea9f08 to ca28355 Compare December 16, 2025 11:39
@graphite-app graphite-app bot merged commit ca28355 into main Dec 16, 2025
22 checks passed
@graphite-app graphite-app bot deleted the 12-16-refactor_formatter_oxfmtrc_fix_up_oxfmtrc.rs branch December 16, 2025 11:47
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 16, 2025
qinyuhang pushed a commit to qinyuhang/oxc that referenced this pull request Jan 22, 2026
…roject#16933)

This is a refactoring related to the `Oxfmtrc` struct.

- Clearly state that defined in `oxc_formatter` is temporary
  - Also changed export path
- Remove useless `default` attribute from `Oxfmtrc`
  - Defaults are resolved by `into_options()`
- Mark all `SortImportsConfig` fields as `Option`
  - Aligned with `Oxfmtrc`, needed for Node.js API
- Move `from_file()` to `oxc_language_server`, which only used by here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-editor Area - Editor and Language Server A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants