fix(formatter): merge the right side of LogicalExpression if it's a LogicalExpression and both have the same operator#14097
Merged
graphite-app[bot] merged 1 commit intomainfrom Sep 29, 2025
Conversation
Member
Author
LogicalExpression if it's a LogicalExpression and both have the same operator
CodSpeed Instrumentation Performance ReportMerging #14097 will not alter performanceComparing Summary
Footnotes
|
305f21b to
20ecffb
Compare
20ecffb to
a044f67
Compare
4e5d480 to
763ef82
Compare
a044f67 to
7cad4d7
Compare
Contributor
Merge activity
|
763ef82 to
ce44f65
Compare
ce44f65 to
c75e179
Compare
7cad4d7 to
acc4f32
Compare
c75e179 to
cb29117
Compare
acc4f32 to
6792579
Compare
6792579 to
9976dde
Compare
… `LogicalExpression` and both have the same `operator` (#14097) I wrote the implementation, and it isn't a port from anywhere. This is to align with [Prettier's unbalancing LogicalExpression](https://github.com/prettier/prettier/blob/7584432401a47a26943dd7a9ca9a8e032ead7285/src/language-js/parse/postprocess/index.js#L64-L69) behavior. We can't use the same approach that Prettier does because our AST isn't mutable, so we have to do the same thing in the formatting phase, which makes the code a little hard to understand. However, our own is more performant.
9976dde to
ed33fad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

I wrote the implementation, and it isn't a port from anywhere. This is to align with Prettier's unbalancing LogicalExpression behavior.
We can't use the same approach that Prettier does because our AST isn't mutable, so we have to do the same thing in the formatting phase, which makes the code a little hard to understand. However, our own is more performant.