2.0.2 β’ Published 8 months ago
@putout/plugin-remove-useless-else v2.0.2
@putout/plugin-remove-useless-else
You can skip the
else
block if yourif
block always executes areturn
statement, it makes code a lot easier to read.(c) no else return
πPutout plugin adds ability to remove useless else
. Merged to @putout/plugin-conditions
.
Install
npm i @putout/plugin-remove-useless-else
Rule
{
"rules": {
"remove-useless-else": "on"
}
}
β Example of incorrect code
if (x)
return;
else
console.log();
β Example of correct code
if (x)
return;
console.log();
License
MIT