Skip to content

refactor(formatter): remove SortImportsTransform abstraction#22075

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/05-02-refactor_formatter_remove_sortimportstransform_abstraction
May 7, 2026
Merged

refactor(formatter): remove SortImportsTransform abstraction#22075
graphite-app[bot] merged 1 commit into
mainfrom
om/05-02-refactor_formatter_remove_sortimportstransform_abstraction

Conversation

@overlookmotel

@overlookmotel overlookmotel commented May 2, 2026

Copy link
Copy Markdown
Member

Pure refactor. After #22065, SortImportsTransform serves no purpose. Convert its only method transform to a free function.

No substantive changes - the PR purely makes that one change and removes a level of indentation. Only exception is fixing a typo in 1 comment ("fush" -> "flush").

overlookmotel commented May 2, 2026

Copy link
Copy Markdown
Member Author

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 changes, fast-track this PR to the front of 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-hq

codspeed-hq Bot commented May 2, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 44 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing om/05-02-refactor_formatter_remove_sortimportstransform_abstraction (79aa43d) with om/05-02-refactor_formatter_sortimportstransform_transform_return_vec_not_option_vec_ (f539758)2

Open in CodSpeed

Footnotes

  1. 7 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.

  2. No successful run was found on om/05-02-refactor_formatter_sortimportstransform_transform_return_vec_not_option_vec_ (51ec2d4) during the generation of this report, so 44c59e7 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@camc314 camc314 added the A-formatter Area - Formatter label May 2, 2026
@overlookmotel overlookmotel marked this pull request as ready for review May 2, 2026 12:25
Copilot AI review requested due to automatic review settings May 2, 2026 12:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the formatter’s import-sorting IR transform by removing the now-redundant SortImportsTransform wrapper and moving its transform method to a standalone function, reducing indentation and simplifying call sites.

Changes:

  • Replace SortImportsTransform::transform(...) with a free transform(...) function.
  • Remove the SortImportsTransform struct/impl wrapper and flatten indentation accordingly.

Comment thread crates/oxc_formatter/src/ir_transform/sort_imports/mod.rs
Comment thread crates/oxc_formatter/src/ir_transform/sort_imports/mod.rs Outdated
@overlookmotel overlookmotel force-pushed the om/05-02-refactor_formatter_remove_sortimportstransform_abstraction branch 2 times, most recently from 81c2f78 to d71939d Compare May 2, 2026 12:50
@overlookmotel overlookmotel force-pushed the om/05-02-refactor_formatter_sortimportstransform_transform_return_vec_not_option_vec_ branch from b7045ab to f539758 Compare May 2, 2026 12:50
@overlookmotel overlookmotel added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label May 3, 2026
@graphite-app graphite-app Bot force-pushed the om/05-02-refactor_formatter_sortimportstransform_transform_return_vec_not_option_vec_ branch 2 times, most recently from 801f277 to 51ec2d4 Compare May 3, 2026 20:49
@graphite-app graphite-app Bot force-pushed the om/05-02-refactor_formatter_remove_sortimportstransform_abstraction branch from d71939d to 79aa43d Compare May 3, 2026 20:49
@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label May 7, 2026

leaysgur commented May 7, 2026

Copy link
Copy Markdown
Member

Merge activity

Pure refactor. After #22065, `SortImportsTransform` serves no purpose. Convert its only method `transform` to a free function.

No substantive changes - the PR purely makes that one change and removes a level of indentation. Only exception is fixing a typo in 1 comment ("fush" -> "flush").
@graphite-app graphite-app Bot force-pushed the om/05-02-refactor_formatter_sortimportstransform_transform_return_vec_not_option_vec_ branch from 51ec2d4 to 5de13ff Compare May 7, 2026 02:22
@graphite-app graphite-app Bot force-pushed the om/05-02-refactor_formatter_remove_sortimportstransform_abstraction branch from 79aa43d to b036558 Compare May 7, 2026 02:23
Base automatically changed from om/05-02-refactor_formatter_sortimportstransform_transform_return_vec_not_option_vec_ to main May 7, 2026 02:27
@graphite-app graphite-app Bot merged commit b036558 into main May 7, 2026
30 checks passed
@graphite-app graphite-app Bot deleted the om/05-02-refactor_formatter_remove_sortimportstransform_abstraction branch May 7, 2026 02:28
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants