unicorn/operator-assignment
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/operator-assignment": "error",
},
},
];foo = foo + bar;foo = `${foo} bar`;foo += bar;foo += ` bar`;Examples from the ESLint documentation.
unicorn/operator-assignment
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/operator-assignment": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Require or disallow assignment operator shorthand where possible
Prefer AbortSignal.any() over manually forwarding abort events between signals.
Prefer AbortSignal.timeout() over manually aborting an AbortController with setTimeout().
Disallow known values that JSON serialization cannot represent faithfully.