diff --git a/src/comments.js b/src/comments.js index a3da1b02..bd1cbf83 100644 --- a/src/comments.js +++ b/src/comments.js @@ -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) || diff --git a/tests/empty_paren_comment/__snapshots__/jsfmt.spec.js.snap b/tests/empty_paren_comment/__snapshots__/jsfmt.spec.js.snap index 9e81219d..f5ec778a 100644 --- a/tests/empty_paren_comment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/empty_paren_comment/__snapshots__/jsfmt.spec.js.snap @@ -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); + `; diff --git a/tests/empty_paren_comment/empty_paren_comment.js b/tests/empty_paren_comment/empty_paren_comment.js index 72859b21..71576218 100644 --- a/tests/empty_paren_comment/empty_paren_comment.js +++ b/tests/empty_paren_comment/empty_paren_comment.js @@ -23,3 +23,6 @@ f(/* ... */); f(a, /* ... */); f(a, /* ... */ b); f(/* ... */ a, b); + +let f = () => import(a /* ... */); +let f = () => doThing(a, /* ... */ b);