Skip to content

Commit

Permalink
Always retain lines for async arrow (#11836)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwohlman committed Jul 15, 2020
1 parent 7eaf37e commit e12caf4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/babel-generator/src/generators/methods.js
Expand Up @@ -112,7 +112,7 @@ export function ArrowFunctionExpression(node: Object) {
!hasTypes(node, firstParam)
) {
if (
this.format.retainLines &&
(this.format.retainLines || node.async) &&
node.loc &&
node.body.loc &&
node.loc.start.line < node.body.loc.start.line
Expand Down
@@ -0,0 +1,10 @@
const x = async (
// some comment
a
) => {
return foo(await a);
};

function foo(a) {
return a;
}
@@ -0,0 +1 @@
{}
@@ -0,0 +1,8 @@
const x = async ( // some comment
a) => {
return foo(await a);
};

function foo(a) {
return a;
}

0 comments on commit e12caf4

Please sign in to comment.