Skip to content

Commit

Permalink
[Refactor] remove unnecessary condition
Browse files Browse the repository at this point in the history
`canHaveTrailingComma` is defined as `I(lastElem && ...)`, which will always be true when `lastElem === null`.
  • Loading branch information
j-f1 committed Dec 8, 2018
1 parent 5269980 commit 91906ba
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/language-js/printer-estree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1518,8 +1518,7 @@ function printPathNoParens(path, options, print, args) {
//
// Note that getLast returns null if the array is empty, but
// we already check for an empty array just above so we are safe
const needsForcedTrailingComma =
canHaveTrailingComma && lastElem === null;
const needsForcedTrailingComma = lastElem === null;

parts.push(
group(
Expand Down

0 comments on commit 91906ba

Please sign in to comment.