Fix format of comment in paren of call expression in arrow expression (#3334)

master
Jacky Ho 2017-11-28 02:58:39 -08:00 committed by Lucas Azzola
parent 172d34e43d
commit a02e3b3464
3 changed files with 12 additions and 1 deletions

View File

@ -683,7 +683,9 @@ function handleCommentInEmptyParens(text, enclosingNode, comment) {
enclosingNode &&
(((enclosingNode.type === "FunctionDeclaration" ||
enclosingNode.type === "FunctionExpression" ||
enclosingNode.type === "ArrowFunctionExpression" ||
(enclosingNode.type === "ArrowFunctionExpression" &&
(enclosingNode.body.type !== "CallExpression" ||
enclosingNode.body.arguments.length === 0)) ||
enclosingNode.type === "ClassMethod" ||
enclosingNode.type === "ObjectMethod") &&
enclosingNode.params.length === 0) ||

View File

@ -44,6 +44,9 @@ f(/* ... */);
f(a, /* ... */);
f(a, /* ... */ b);
f(/* ... */ a, b);
let f = () => import(a /* ... */);
let f = () => doThing(a, /* ... */ b);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
let f = (/* ... */) => {};
(function(/* ... */) {})(/* ... */);
@ -72,4 +75,7 @@ f(a /* ... */);
f(a, /* ... */ b);
f(/* ... */ a, b);
let f = () => import(a /* ... */);
let f = () => doThing(a, /* ... */ b);
`;

View File

@ -23,3 +23,6 @@ f(/* ... */);
f(a, /* ... */);
f(a, /* ... */ b);
f(/* ... */ a, b);
let f = () => import(a /* ... */);
let f = () => doThing(a, /* ... */ b);