diff --git a/crates/rome_js_formatter/src/jsx/attribute/spread_attribute.rs b/crates/rome_js_formatter/src/jsx/attribute/spread_attribute.rs index 2a71b32666f..888e3c02e3b 100644 --- a/crates/rome_js_formatter/src/jsx/attribute/spread_attribute.rs +++ b/crates/rome_js_formatter/src/jsx/attribute/spread_attribute.rs @@ -1,9 +1,22 @@ +use crate::formatter_traits::FormatTokenAndNode; use crate::{FormatElement, FormatResult, Formatter, ToFormatElement}; -use rome_js_syntax::JsxSpreadAttribute; -use rome_rowan::AstNode; +use rome_formatter::format_elements; +use rome_js_syntax::{JsxSpreadAttribute, JsxSpreadAttributeFields}; impl ToFormatElement for JsxSpreadAttribute { fn to_format_element(&self, formatter: &Formatter) -> FormatResult { - Ok(formatter.format_verbatim(self.syntax())) + let JsxSpreadAttributeFields { + l_curly_token, + dotdotdot_token, + argument, + r_curly_token, + } = self.as_fields(); + + Ok(format_elements![ + l_curly_token.format(formatter)?, + dotdotdot_token.format(formatter)?, + argument.format(formatter)?, + r_curly_token.format(formatter)?, + ]) } }