From 3d3b51116d8ca10a7a9931f29213e3258ad9d4de Mon Sep 17 00:00:00 2001 From: mrfoxpro Date: Wed, 18 Sep 2024 12:54:04 +0500 Subject: [PATCH] fix: respect `prefer_newline_before_close_bracket` with `jsx_attributes_prefer_hanging` --- src/generation/generate.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/generation/generate.rs b/src/generation/generate.rs index 236c22e..dbd03bb 100644 --- a/src/generation/generate.rs +++ b/src/generation/generate.rs @@ -3908,6 +3908,9 @@ fn gen_jsx_opening_element<'a>(node: &JSXOpeningElement<'a>, context: &mut Conte items.push_force_current_line_indentation(); items.extend(space_if_not_start_line()); } + if context.config.jsx_attributes_prefer_hanging && prefer_newline_before_close_bracket { + items.push_condition(conditions::new_line_if_hanging(start_lsil, None)); + } items.push_sc(sc!("/")); } else if context.config.jsx_attributes_prefer_hanging && prefer_newline_before_close_bracket { items.push_condition(conditions::new_line_if_hanging(start_lsil, None));