diff --git a/lib/printer.ts b/lib/printer.ts index 5b3f9618..088d1295 100644 --- a/lib/printer.ts +++ b/lib/printer.ts @@ -1315,6 +1315,8 @@ function genericPrintNoParens(path: any, options: any, print: any) { ) { if (/\S/.test(child.value)) { return child.value.replace(/^\s+|\s+$/g, ""); + } else if (/\n\n/.test(child.value)) { + return "\n\n"; } else if (/\n/.test(child.value)) { return "\n"; } diff --git a/test/printer.ts b/test/printer.ts index e25a961d..a913e62d 100644 --- a/test/printer.ts +++ b/test/printer.ts @@ -2600,4 +2600,33 @@ describe("printer", function () { ), ); }); + + it("can print JSXElement syntax with newlines", function () { + const code = ["