Skip to content

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

crates/oxc_formatter/src/utils/conditional.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ impl<'a> Format<'a> for FormatJsxChainExpression<'a, '_> {
647647
}
648648
.fmt(f);
649649
} else {
650-
FormatNodeWithoutTrailingComments(self.expression).fmt(f);
650+
self.expression.fmt(f);
651651
}
652652
});
653653

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{isVideo ? (
2+
<Video {...props} />
3+
) : (
4+
<Image {...props} /> // eslint-disable-line
5+
)}
6+
7+
<>
8+
{isVideo ? (
9+
<Video {...props} />
10+
) : (
11+
<Image {...props} /> // eslint-disable-line
12+
)}
13+
</>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
source: crates/oxc_formatter/tests/fixtures/mod.rs
3+
---
4+
==================== Input ====================
5+
{isVideo ? (
6+
<Video {...props} />
7+
) : (
8+
<Image {...props} /> // eslint-disable-line
9+
)}
10+
11+
<>
12+
{isVideo ? (
13+
<Video {...props} />
14+
) : (
15+
<Image {...props} /> // eslint-disable-line
16+
)}
17+
</>
18+
19+
==================== Output ====================
20+
------------------
21+
{ printWidth: 80 }
22+
------------------
23+
{
24+
isVideo ? (
25+
<Video {...props} />
26+
) : (
27+
<Image {...props} /> // eslint-disable-line
28+
);
29+
}
30+
31+
<>
32+
{isVideo ? (
33+
<Video {...props} />
34+
) : (
35+
<Image {...props} /> // eslint-disable-line
36+
)}
37+
</>;
38+
39+
-------------------
40+
{ printWidth: 100 }
41+
-------------------
42+
{
43+
isVideo ? (
44+
<Video {...props} />
45+
) : (
46+
<Image {...props} /> // eslint-disable-line
47+
);
48+
}
49+
50+
<>
51+
{isVideo ? (
52+
<Video {...props} />
53+
) : (
54+
<Image {...props} /> // eslint-disable-line
55+
)}
56+
</>;
57+
58+
===================== End =====================

0 commit comments

Comments
 (0)