@@ -5078,19 +5078,27 @@ function separatorNoWhitespace(
50785078 ( childNode . type === "JSXElement" && ! childNode . closingElement ) ||
50795079 ( nextNode && ( nextNode . type === "JSXElement" && ! nextNode . closingElement ) )
50805080 ) {
5081- return hardline ;
5081+ return child . length === 1 ? softline : hardline ;
50825082 }
50835083
50845084 return softline ;
50855085}
50865086
5087- function separatorWithWhitespace ( isFacebookTranslationTag , child ) {
5087+ function separatorWithWhitespace (
5088+ isFacebookTranslationTag ,
5089+ child ,
5090+ childNode ,
5091+ nextNode
5092+ ) {
50885093 if ( isFacebookTranslationTag ) {
50895094 return hardline ;
50905095 }
50915096
50925097 if ( child . length === 1 ) {
5093- return softline ;
5098+ return ( childNode . type === "JSXElement" && ! childNode . closingElement ) ||
5099+ ( nextNode && nextNode . type === "JSXElement" && ! nextNode . closingElement )
5100+ ? hardline
5101+ : softline ;
50945102 }
50955103
50965104 return hardline ;
@@ -5133,8 +5141,14 @@ function printJSXChildren(
51335141 children . push ( "" ) ;
51345142 words . shift ( ) ;
51355143 if ( / \n / . test ( words [ 0 ] ) ) {
5144+ const next = n . children [ i + 1 ] ;
51365145 children . push (
5137- separatorWithWhitespace ( isFacebookTranslationTag , words [ 1 ] )
5146+ separatorWithWhitespace (
5147+ isFacebookTranslationTag ,
5148+ words [ 1 ] ,
5149+ child ,
5150+ next
5151+ )
51385152 ) ;
51395153 } else {
51405154 children . push ( jsxWhitespace ) ;
@@ -5164,10 +5178,13 @@ function printJSXChildren(
51645178
51655179 if ( endWhitespace !== undefined ) {
51665180 if ( / \n / . test ( endWhitespace ) ) {
5181+ const next = n . children [ i + 1 ] ;
51675182 children . push (
51685183 separatorWithWhitespace (
51695184 isFacebookTranslationTag ,
5170- getLast ( children )
5185+ getLast ( children ) ,
5186+ child ,
5187+ next
51715188 )
51725189 ) ;
51735190 } else {
0 commit comments