@@ -7941,11 +7941,18 @@ fn jsx_space_separator(previous_node: &Node, current_node: &Node, context: &Cont
7941
7941
}
7942
7942
}
7943
7943
7944
+ fn get_quote_char ( context : & Context ) -> String {
7945
+ return match context. config . quote_style {
7946
+ QuoteStyle :: PreferDouble | QuoteStyle :: AlwaysDouble => "\" " . to_string ( ) ,
7947
+ QuoteStyle :: PreferSingle | QuoteStyle :: AlwaysSingle => "'" . to_string ( )
7948
+ } ;
7949
+ }
7950
+
7944
7951
fn jsx_force_space_with_newline_if_either_node_multi_line ( previous_node : & Node , current_node : & Node , context : & Context ) -> PrintItems {
7945
7952
let previous_node_info_range = get_node_info_range ( previous_node, context) ;
7946
7953
let current_node_info_range = get_node_info_range ( current_node, context) ;
7947
7954
let spaces_between_count = node_helpers:: count_spaces_between_jsx_children ( previous_node, current_node, & context. module ) ;
7948
- let jsx_space_expr_text = format ! ( "{{\" {} \" }} " , " " . repeat( spaces_between_count) ) ;
7955
+ let jsx_space_expr_text = format ! ( "{{{}{}{}}} " , get_quote_char ( context ) , " " . repeat( spaces_between_count) , get_quote_char ( context ) ) ;
7949
7956
if_true_or (
7950
7957
"jsxIsLastChildMultiLine" ,
7951
7958
move |condition_context| {
@@ -7992,7 +7999,7 @@ fn jsx_space_separator(previous_node: &Node, current_node: &Node, context: &Cont
7992
7999
7993
8000
if spaces_between_count > 1 {
7994
8001
items. push_signal ( Signal :: PossibleNewLine ) ;
7995
- items. push_string ( format ! ( "{{\" {} \" }} " , " " . repeat( spaces_between_count) ) ) ;
8002
+ items. push_string ( format ! ( "{{{}{}{}}} " , get_quote_char ( context ) , " " . repeat( spaces_between_count) , get_quote_char ( context ) ) ) ;
7996
8003
items. push_signal ( Signal :: PossibleNewLine ) ;
7997
8004
return items;
7998
8005
}
@@ -8032,7 +8039,7 @@ fn jsx_space_separator(previous_node: &Node, current_node: &Node, context: &Cont
8032
8039
true_path : {
8033
8040
let mut items = PrintItems :: new ( ) ;
8034
8041
items. push_signal ( Signal :: PossibleNewLine ) ;
8035
- items. push_str ( "{ \" \" }" ) ;
8042
+ items. push_string ( format ! ( "{{{} {}}}" , get_quote_char ( context ) , get_quote_char ( context ) ) ) ;
8036
8043
items. push_signal ( Signal :: NewLine ) ;
8037
8044
Some ( items)
8038
8045
} ,
0 commit comments