Skip to content

Commit

Permalink
馃悰 fix es/no-logical-assignment-operators autofix (fixes #57)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Dec 8, 2020
1 parent f48020f commit 00d7385
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rules/no-logical-assignment-operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
node: operatorToken,
messageId: "forbidden",
fix(fixer) {
if (utils.hasSideEffect(node.left, sourceCode)) {
if (node.left.type !== "Identifier") {
return null
}
const newOperator = node.operator.slice(-1)
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/no-logical-assignment-operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ new RuleTester().run("no-logical-assignment-operators", rule, {
},
{
code: "a.b ||= c",
output: "a.b = a.b || (c)",
output: null,
errors: ["ES2021 logical assignment operators are forbidden."],
},
{
Expand Down

0 comments on commit 00d7385

Please sign in to comment.