diff --git a/crates/oxc_formatter/src/utils/jsx.rs b/crates/oxc_formatter/src/utils/jsx.rs index 5d3358fd72bc3..c6dd15bac715c 100644 --- a/crates/oxc_formatter/src/utils/jsx.rs +++ b/crates/oxc_formatter/src/utils/jsx.rs @@ -186,12 +186,6 @@ impl PartialEq for JsxChild<'_, '_> { impl Eq for JsxChild<'_, '_> {} -impl JsxChild<'_, '_> { - pub const fn is_any_line(&self) -> bool { - matches!(self, Self::EmptyLine | Self::Newline) - } -} - /// A word in a Jsx Text. A word is string sequence that isn't separated by any JSX whitespace. #[derive(Debug, Clone, Eq, PartialEq)] pub struct JsxWord<'a> { diff --git a/crates/oxc_formatter/src/write/jsx/child_list.rs b/crates/oxc_formatter/src/write/jsx/child_list.rs index 3a480c6c13755..07f4a65c4f9d5 100644 --- a/crates/oxc_formatter/src/write/jsx/child_list.rs +++ b/crates/oxc_formatter/src/write/jsx/child_list.rs @@ -112,16 +112,10 @@ impl FormatJsxChildList { JsxChild::Whitespace => { flat.write(&JsxSpace, f); - // ```javascript - //
a - // {' '}
- // ``` - let is_after_line_break = last.as_ref().is_some_and(|last| last.is_any_line()); - // `
aaa
` or `
` let is_trailing_or_only_whitespace = children_iter.peek().is_none(); - if is_trailing_or_only_whitespace || is_after_line_break { + if is_trailing_or_only_whitespace { multiline.write_separator_in_last_entry(&JsxRawSpace, f); } // Leading whitespace. Only possible if used together with a expression child @@ -587,12 +581,7 @@ impl<'a> MultilineBuilder<'a> { } } MultilineLayout::NoFill => { - // TODO: separator write!(buffer, [content, separator]); - - if let Some(separator) = separator { - write!(buffer, [separator]); - } } } buffer.into_vec()