Skip to content

Commit 00d7385

Browse files
committed
🐛 fix es/no-logical-assignment-operators autofix (fixes #57)
1 parent f48020f commit 00d7385

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rules/no-logical-assignment-operators.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = {
3131
node: operatorToken,
3232
messageId: "forbidden",
3333
fix(fixer) {
34-
if (utils.hasSideEffect(node.left, sourceCode)) {
34+
if (node.left.type !== "Identifier") {
3535
return null
3636
}
3737
const newOperator = node.operator.slice(-1)

tests/lib/rules/no-logical-assignment-operators.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ new RuleTester().run("no-logical-assignment-operators", rule, {
4040
},
4141
{
4242
code: "a.b ||= c",
43-
output: "a.b = a.b || (c)",
43+
output: null,
4444
errors: ["ES2021 logical assignment operators are forbidden."],
4545
},
4646
{

0 commit comments

Comments
 (0)