diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index 5e84516d7a07..fb7f10aa75af 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -1691,6 +1691,7 @@ function printPathNoParens(path, options, print, args) { n.expression.type === "JSXEmptyExpression" || n.expression.type === "TemplateLiteral" || n.expression.type === "TaggedTemplateExpression" || + n.expression.type === "DoExpression" || (isJSXNode(parent) && (n.expression.type === "ConditionalExpression" || isBinaryish(n.expression)))); diff --git a/tests/jsx-do/__snapshots__/jsfmt.spec.js.snap b/tests/jsx-do/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..64c58c916562 --- /dev/null +++ b/tests/jsx-do/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,16 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`do.js 1`] = ` +
+ {do { + 1 + }} +
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +
+ {do { + 1; + }} +
; + +`; diff --git a/tests/jsx-do/do.js b/tests/jsx-do/do.js new file mode 100644 index 000000000000..7890763ee5b6 --- /dev/null +++ b/tests/jsx-do/do.js @@ -0,0 +1,5 @@ +
+ {do { + 1 + }} +
diff --git a/tests/jsx-do/jsfmt.spec.js b/tests/jsx-do/jsfmt.spec.js new file mode 100644 index 000000000000..968651cdbc2c --- /dev/null +++ b/tests/jsx-do/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["babylon"]);