diff --git a/src/printer.js b/src/printer.js index bca622e8..188f30d2 100644 --- a/src/printer.js +++ b/src/printer.js @@ -2381,7 +2381,9 @@ function printJSXChildren(path, options, print, jsxWhitespace) { } }); - children.push(softline); + if (!isLineNext(util.getLast(children))) { + children.push(softline); + } } else if (/\n/.test(value)) { children.push(hardline); diff --git a/tests/jsx-newlines/__snapshots__/jsfmt.spec.js.snap b/tests/jsx-newlines/__snapshots__/jsfmt.spec.js.snap index e6550d32..f89e70fd 100644 --- a/tests/jsx-newlines/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx-newlines/__snapshots__/jsfmt.spec.js.snap @@ -81,6 +81,18 @@ regression_extra_newline = ( New Messages ); + + +regression_extra_newline_2 = ( +
@@ -160,5 +172,16 @@ regression_extra_newline = ( New Messages ); + +regression_extra_newline_2 = ( +