logical-assignment-operators
eslint
Safe autofix
eslint.config.js
export default [
{
rules: {
"logical-assignment-operators": "error",
},
},
];Require or disallow logical assignment operator shorthand
a = a || b
a = a && b
a = a ?? b
a || (a = b)
a && (a = b)
a ?? (a = b)
a = a || b || c
a = a && b && c
a = a ?? b ?? ca ||= b
a &&= b
a ??= bif (a) a = b // <=> a &&= b
if (!a) a = b // <=> a ||= b
if (a == null) a = b // <=> a ??= b
if (a === null || a === undefined) a = b // <=> a ??= ba = b
a += b
a ||= b
a = b || c
a || (b = c)
if (a) a = b
a = (a || b) || ca = a || b
a = a && b
a = a ?? bif (a) b = c
if (a === 0) a = bExamples from the ESLint documentation.
logical-assignment-operators
eslint
export default [
{
rules: {
"logical-assignment-operators": "error",
},
},
];logical-assignment-operators
eslint plugin · style
{
"rules": {
"logical-assignment-operators": "error"
}
}Biome does not have this rule.
Require or disallow logical assignment operator shorthand
Enforce using named capture group in regular expression
Disallow async functions which have no await expression
Disallow specified warning terms in comments
Disallow specified modules when loaded by import