diff --git a/src/printer.js b/src/printer.js
index fbe87285f..80a769b41 100644
--- a/src/printer.js
+++ b/src/printer.js
@@ -3938,8 +3938,13 @@ function printJSXElement(path, options, print) {
// whitespace as `{" "}` when outputting this element over multiple lines.
if (child === jsxWhitespace) {
if (i === 1 && children[i - 1] === "") {
+ if (children.length === 2) {
+ // Solitary whitespace
+ multilineChildren.push(rawJsxWhitespace);
+ return;
+ }
// Leading whitespace
- multilineChildren.push(rawJsxWhitespace);
+ multilineChildren.push(concat([rawJsxWhitespace, hardline]));
return;
} else if (i === children.length - 1) {
// Trailing whitespace
diff --git a/tests/flow/more_react/__snapshots__/jsfmt.spec.js.snap b/tests/flow/more_react/__snapshots__/jsfmt.spec.js.snap
index cc7b54dae..326cd9089 100644
--- a/tests/flow/more_react/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/flow/more_react/__snapshots__/jsfmt.spec.js.snap
@@ -164,7 +164,8 @@ var App = require("App.react");
var app = (
- {" "}// error, y: number but foo expects string in App.react Some text.
+ {" "}
+ // error, y: number but foo expects string in App.react Some text.
);
diff --git a/tests/jsx-significant-space/__snapshots__/jsfmt.spec.js.snap b/tests/jsx-significant-space/__snapshots__/jsfmt.spec.js.snap
index c64cf789c..bd645504c 100644
--- a/tests/jsx-significant-space/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/jsx-significant-space/__snapshots__/jsfmt.spec.js.snap
@@ -171,7 +171,8 @@ nest_plz = (
regression_not_transformed_1 = (
- {" "}
+ {" "}
+
);
@@ -183,7 +184,8 @@ regression_not_transformed_2 = (
similar_1 = (
- {" "}
+ {" "}
+
);
diff --git a/tests/jsx-stateless-arrow-fn/__snapshots__/jsfmt.spec.js.snap b/tests/jsx-stateless-arrow-fn/__snapshots__/jsfmt.spec.js.snap
index 505ed7032..366fd653b 100644
--- a/tests/jsx-stateless-arrow-fn/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/jsx-stateless-arrow-fn/__snapshots__/jsfmt.spec.js.snap
@@ -150,7 +150,8 @@ const render7A = () =>
const render7B = () =>
- {" "} Dont break plz
+ {" "}
+ Dont break plz
Dont break plz
diff --git a/tests/jsx-text-wrap/__snapshots__/jsfmt.spec.js.snap b/tests/jsx-text-wrap/__snapshots__/jsfmt.spec.js.snap
index 1360e9d31..715f1524e 100644
--- a/tests/jsx-text-wrap/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/jsx-text-wrap/__snapshots__/jsfmt.spec.js.snap
@@ -432,8 +432,9 @@ x = (
leading_whitespace = (
- {" "}First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth
- Eleventh Twelfth Thirteenth Fourteenth
+ {" "}
+ First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh
+ Twelfth Thirteenth Fourteenth
);