Inline template literals as arrow body (#1485)

Turns out I wrote the wrong one :(

Fixes #1465
master
Christopher Chedeau 2017-05-02 09:17:20 -07:00 committed by GitHub
parent f59aeef865
commit 078572631f
3 changed files with 27 additions and 1 deletions

View File

@ -375,7 +375,7 @@ function genericPrintNoParens(path, options, print, args) {
n.body.type === "JSXElement" ||
n.body.type === "BlockStatement" ||
n.body.type === "TaggedTemplateExpression" ||
n.body.type === "TemplateElement" ||
n.body.type === "TemplateLiteral" ||
n.body.type === "ArrowFunctionExpression"
) {
return group(collapsed);

View File

@ -1,5 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`arrow.js 1`] = `
() => a\`
a
\`;
() => \`
a
\`;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
() => a\`
a
\`;
() => \`
a
\`;
`;
exports[`call.js 1`] = `
insertRule(\`*, *:before, *:after {
box-sizing: inherit;

7
tests/template/arrow.js Normal file
View File

@ -0,0 +1,7 @@
() => a`
a
`;
() => `
a
`;