Skip to content

Commit

Permalink
Fix hasMultipleHeritage logic (prettier#14289)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker authored and medikoo committed Feb 7, 2024
1 parent e01346b commit 259b22f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/language-js/print/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ function printHardlineAfterHeritage(node) {

function hasMultipleHeritage(node) {
return (
["superClass", "extends", "mixins", "implements"].filter((key) =>
Boolean(node[key])
).length > 1
["extends", "mixins", "implements"].reduce(
(count, key) => count + (Array.isArray(node[key]) ? node[key].length : 0),
node.superClass ? 1 : 0
) > 1
);
}

Expand Down

0 comments on commit 259b22f

Please sign in to comment.