diff --git a/crates/oxc_formatter/src/utils/conditional.rs b/crates/oxc_formatter/src/utils/conditional.rs index df4458b7d4895..a4808f902fc55 100644 --- a/crates/oxc_formatter/src/utils/conditional.rs +++ b/crates/oxc_formatter/src/utils/conditional.rs @@ -647,7 +647,7 @@ impl<'a> Format<'a> for FormatJsxChainExpression<'a, '_> { } .fmt(f); } else { - FormatNodeWithoutTrailingComments(self.expression).fmt(f); + self.expression.fmt(f); } }); diff --git a/crates/oxc_formatter/tests/fixtures/js/jsx/ternary-with-comment.jsx b/crates/oxc_formatter/tests/fixtures/js/jsx/ternary-with-comment.jsx new file mode 100644 index 0000000000000..195cbed0f00af --- /dev/null +++ b/crates/oxc_formatter/tests/fixtures/js/jsx/ternary-with-comment.jsx @@ -0,0 +1,13 @@ +{isVideo ? ( +