Skip to content

Commit 03f0970

Browse files
committed
fix(formatter): should not indent BinaryLikeExpression when it is an argument of Boolean
1 parent ff397d5 commit 03f0970

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

crates/oxc_formatter/src/write/binary_like_expression.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ impl<'a, 'b> BinaryLikeExpression<'a, 'b> {
170170
// TODO(prettier): Why not include `NewExpression` ???
171171
!matches!(parent.parent(), AstNodes::Argument(argument) if matches!(argument.parent, AstNodes::CallExpression(_)))
172172
}
173+
AstNodes::Argument(argument) => {
174+
// https://github.com/prettier/prettier/issues/18057#issuecomment-3472912112
175+
matches!(argument.parent, AstNodes::CallExpression(call) if call.arguments.len() == 1 &&
176+
matches!(&call.callee, Expression::Identifier(ident) if ident.name == "Boolean"))
177+
}
173178
_ => false,
174179
}
175180
}

tasks/prettier_conformance/snapshots/prettier.js.snap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ js compatibility: 698/749 (93.19%)
55
| Spec path | Failed or Passed | Match ratio |
66
| :-------- | :--------------: | :---------: |
77
| js/arrows/comment.js | 💥💥 | 88.89% |
8-
| js/call/boolean/boolean.js | 💥 | 77.88% |
8+
| js/call/boolean/boolean.js | 💥 | 97.12% |
99
| js/class-comment/misc.js | 💥 | 72.73% |
1010
| js/class-comment/superclass.js | 💥 | 95.35% |
1111
| js/comments/15661.js | 💥💥 | 55.17% |

0 commit comments

Comments
 (0)