Skip to content

Commit

Permalink
Wrap unary arrow function argument: support different parsers - logic…
Browse files Browse the repository at this point in the history
…al expression fix
  • Loading branch information
yuriyyakym committed Aug 5, 2018
1 parent f6b9395 commit 0619130
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,15 @@ function genericPrintNoParens(path, options, print) {
parts.push(path.call(print, "typeParameters"));
}

const unaryWrappedInParens = n.params.length === 1 &&
const unaryWrappedInParens = n.params.length === 1 && (
(n.start && n.start !== n.params[0].start) ||
(
n.loc &&
n.params[0].loc &&
n.loc.start.column !== n.params[0].loc.start.column
);
)
);

if (! unaryWrappedInParens &&
! options.arrowParensAlways &&
n.params.length === 1 &&
Expand Down

0 comments on commit 0619130

Please sign in to comment.