Skip to content

Commit

Permalink
Use a whitelist instead of blacklist for member breaking (#1261)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeux committed Apr 14, 2017
1 parent 2078225 commit 61183f8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/printer.js
Expand Up @@ -246,9 +246,9 @@ function genericPrintNoParens(path, options, print, args) {
const shouldInline =
firstNonMemberParent && (
(firstNonMemberParent.type === "VariableDeclarator" &&
firstNonMemberParent.id.type === "ObjectPattern") ||
firstNonMemberParent.id.type !== "Identifier") ||
(firstNonMemberParent.type === "AssignmentExpression" &&
firstNonMemberParent.left.type === "ObjectPattern")) ||
firstNonMemberParent.left.type !== "Identifier")) ||
n.computed ||
(n.object.type === "Identifier" &&
n.property.type === "Identifier" &&
Expand Down Expand Up @@ -3214,10 +3214,10 @@ function printAssignment(
printed = indent(concat([hardline, printedRight]));
} else if (
(isBinaryish(rightNode) && !shouldInlineLogicalExpression(rightNode)) ||
leftNode.type !== "ObjectPattern" && (
rightNode.type === "StringLiteral" ||
(rightNode.type === "Literal" && typeof rightNode.value === "string") ||
isMemberExpressionChain(rightNode))
(leftNode.type === "Identifier" || leftNode.type === "MemberExpression") &&
(rightNode.type === "StringLiteral" ||
(rightNode.type === "Literal" && typeof rightNode.value === "string") ||
isMemberExpressionChain(rightNode))
) {
printed = indent(concat([line, printedRight]));
} else {
Expand Down

0 comments on commit 61183f8

Please sign in to comment.