You should almost never have an
if...else
with an assignment likea = b
as a condition.(c) MDN
🐊Putout plugin adds ability to convert assignment to comparison.
npm i @putout/plugin-convert-assignment-to-comparison -D
{
"rules": {
"convert-assignment-to-comparison": "on"
}
}
if (a = b) {}
if (a === b) {}
MIT