fix(formatter,oxfmt): Remove redundant space after soft_line_break_or_space#20562
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. |
Merging this PR will not alter performance
Comparing Footnotes
|
Merge activity
|
…_space (#20562) Fixes #20548 Remove redundant `Space` elements that immediately followed `soft_line_break_or_space()` in three places: - Arrow function chain signatures - `class ... extends` with member expressions - `interface ... extends` with member expressions This, in turn, fixes the js-in-vue issue. --- The root cause is that `to_prettier_doc` cannot fully replicate the oxc_formatter printer's runtime behavior (e.g. deduplication of spaces). While this commit fixes the three identified IR-level issues, there are other known divergences between the printer and `to_prettier_doc` (e.g. `Space` → `StartTag` → `Space` patterns around comments) that will be addressed separately... TL;DR, converting between Prettier Doc and oxc_formatter IR doesn't seem to be straightforward after all. 🥲
b7b44ae to
d35b25f
Compare

Fixes #20548
Remove redundant
Spaceelements that immediately followedsoft_line_break_or_space()in three places:class ... extendswith member expressionsinterface ... extendswith member expressionsThis, in turn, fixes the js-in-vue issue.
The root cause is that
to_prettier_doccannot fully replicate the oxc_formatter printer's runtime behavior (e.g. deduplication of spaces).While this commit fixes the three identified IR-level issues, there are other known divergences between the printer and
to_prettier_doc(e.g.Space→StartTag→Spacepatterns around comments) that will be addressed separately...TL;DR, converting between Prettier Doc and oxc_formatter IR doesn't seem to be straightforward after all. 🥲