Skip to content

Commit

Permalink
Merge branch 'bugfix/unary-arrow-function-preserve-parentheses' into …
Browse files Browse the repository at this point in the history
…newest
  • Loading branch information
yuriyyakym committed Aug 5, 2018
2 parents 48abc16 + 0619130 commit a6a98d4
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 a6a98d4

Please sign in to comment.