@putout/plugin-convert-assignment-to-comparison
v2.0.0
Published
šPutout plugin adds ability convert assignment to comparison
Downloads
58,176
Maintainers
Readme
@putout/plugin-convert-assignment-to-comparison
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.
Install
npm i @putout/plugin-convert-assignment-to-comparison -D
Rule
{
"rules": {
"convert-assignment-to-comparison": "on"
}
}
ā Example of incorrect code
if (a = b) {}
ā Example of correct code
if (a === b) {}
License
MIT