refactor(formatter/sort_imports): Wrap every Comment with label#22514
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. |
Comment with label
Merging this PR will not alter performance
Comparing Footnotes
|
Merge activity
|
|
/oxfmt-ecosys |
…2514) Standardize how the `sort_imports` IR transform identifies comments. Previously it mixed two strategies: - a label (`JsLabels::AlignableBlockComment`) for multi-line block comments only - and a textual prefix check (`text.starts_with("//") || "/*")`) for everything else The textual path was fragile against IR shapes that don't fit the assumption, formatted JSDoc emitting a `Token`/`Text` mix is the most visible case (see #22486). This PR unifies both paths under a single label: every emitted comment is wrapped in `JsLabels::Comment`, and classification becomes a pure structural check.
Oxfmt Ecosystem CI
|
1e587b0 to
8ee946f
Compare
eb06c47 to
c9f506e
Compare

Standardize how the
sort_importsIR transform identifies comments.Previously it mixed two strategies:
JsLabels::AlignableBlockComment) for multi-line block comments onlytext.starts_with("//") || "/*")) for everything elseThe textual path was fragile against IR shapes that don't fit the assumption, formatted JSDoc emitting a
Token/Textmix is the most visible case (see #22486).This PR unifies both paths under a single label: every emitted comment is wrapped in
JsLabels::Comment, and classification becomes a pure structural check.