Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion crates/oxc_formatter/src/write/binary_like_expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,13 @@ impl<'a> Format<'a> for BinaryLeftOrRightSide<'a, '_> {
let operator_and_right_expression = format_with(|f| {
write!(f, [space(), binary_like_expression.operator()])?;

if binary_like_expression.should_inline_logical_expression() {
let should_inline = binary_like_expression.should_inline_logical_expression();

if should_inline {
write!(f, [space()])?;
if f.comments().has_leading_own_line_comment(right.span().start) {
return write!(f, soft_line_indent_or_space(right));
}
} else {
write!(f, [soft_line_break_or_space()])?;
}
Expand Down
6 changes: 4 additions & 2 deletions crates/oxc_formatter/src/write/intersection_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ fn format_intersection_types<'a>(
write!(f, item)?;
} else {
// If no object is involved, go to the next line if it breaks
if !is_prev_object_like && !is_object_like {
write!(f, [indent(&format_args!(soft_line_break_or_space(), item))])?;
if !(is_prev_object_like || is_object_like)
|| f.comments().has_leading_own_line_comment(item.span().start)
{
write!(f, soft_line_indent_or_space(item))?;
} else {
write!(f, space())?;

Expand Down
3 changes: 1 addition & 2 deletions tasks/prettier_conformance/snapshots/prettier.js.snap.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
js compatibility: 698/749 (93.19%)
js compatibility: 699/749 (93.32%)

# Failed

Expand Down Expand Up @@ -32,7 +32,6 @@ js compatibility: 698/749 (93.19%)
| js/if/trailing_comment.js | 💥 | 91.43% |
| js/label/empty_label.js | 💥 | 66.67% |
| js/last-argument-expansion/dangling-comment-in-arrow-function.js | 💥 | 22.22% |
| js/logical-expressions/multiple-comments/17192.js | 💥 | 60.00% |
| js/object-multiline/multiline.js | 💥✨ | 22.22% |
| js/quote-props/classes.js | 💥💥✨✨ | 47.06% |
| js/quote-props/objects.js | 💥💥✨✨ | 45.10% |
Expand Down
4 changes: 1 addition & 3 deletions tasks/prettier_conformance/snapshots/prettier.ts.snap.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ts compatibility: 545/598 (91.14%)
ts compatibility: 547/598 (91.47%)

# Failed

Expand All @@ -22,7 +22,6 @@ ts compatibility: 545/598 (91.14%)
| typescript/class-comment/class-implements.ts | 💥 | 98.89% |
| typescript/class-comment/declare.ts | 💥 | 84.62% |
| typescript/class-comment/generic.ts | 💥 | 92.00% |
| typescript/comments/16121.ts | 💥 | 72.46% |
| typescript/comments/mapped_types.ts | 💥 | 96.77% |
| typescript/comments/method_types.ts | 💥 | 82.05% |
| typescript/conditional-types/comments.ts | 💥✨ | 31.51% |
Expand All @@ -40,7 +39,6 @@ ts compatibility: 545/598 (91.14%)
| typescript/interface2/break/break.ts | 💥💥💥 | 82.30% |
| typescript/intersection/intersection-parens.ts | 💥💥 | 86.17% |
| typescript/intersection/consistent-with-flow/intersection-parens.ts | 💥 | 69.77% |
| typescript/intersection/mutiple-comments/17192.ts | 💥 | 60.00% |
| typescript/last-argument-expansion/decorated-function.tsx | 💥 | 29.06% |
| typescript/mapped-type/issue-11098.ts | 💥 | 97.03% |
| typescript/mapped-type/break-mode/break-mode.ts | 💥 | 68.75% |
Expand Down
Loading