refactor(formatter): adjust implementations of Function and ArrowFunctionExpression#16035
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. |
CodSpeed Performance ReportMerging #16035 will not alter performanceComparing Summary
Footnotes
|
c76ff3c to
66bab34
Compare
d922b54 to
76fddc3
Compare
76fddc3 to
b478d7f
Compare
b478d7f to
e1f3d4d
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the formatter implementations for Function and ArrowFunctionExpression in preparation for removing Format::fmt_with_options. The changes establish a cleaner pattern where formatting types provide explicit constructor methods and a public format() method, with the Format trait implementation delegating to this method.
Key changes:
- Introduced
new()andnew_with_options()constructors forFormatFunctionandFormatJsArrowFunctionExpression - Added public
format()methods that contain the actual formatting logic - Renamed
call_arg_layoutfield to the more descriptivecall_argument_layoutthroughout the codebase
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_formatter/src/write/mod.rs | Removed FormatWrite implementation for ArrowFunctionExpression (moved to dedicated file) |
| crates/oxc_formatter/src/write/function.rs | Reorganized code: moved FormatWrite impl to top, added new/new_with_options/format methods, updated Format trait to delegate to format() |
| crates/oxc_formatter/src/write/arrow_function_expression.rs | Added FormatWrite impl (moved from mod.rs), added new/new_with_options/format methods, renamed call_arg_layout to call_argument_layout, updated Format trait to delegate to format() |
| crates/oxc_formatter/src/write/call_arguments.rs | Updated all call sites to use new constructors instead of fmt_with_options(), fixed field name from call_arg_layout to call_argument_layout |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
…tionExpression (#16035) Pure refactor, I am going to remove `Format::fmt_with_options`
e1f3d4d to
a4b70c3
Compare
…tionExpression (oxc-project#16035) Pure refactor, I am going to remove `Format::fmt_with_options`

Pure refactor, I am going to remove
Format::fmt_with_options