Always retain lines for async arrow (#11836)

This commit is contained in:
Joshua Ohlman 2020-07-15 16:48:08 -04:00 committed by GitHub
parent 7eaf37ea3e
commit e12caf4f69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 1 deletions

View File

@ -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

View File

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

View File

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