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
.
npm i @putout/plugin-remove-useless-else
{
"rules": {
"remove-useless-else": "on"
}
}
if (x)
return;
else
console.log();
if (x)
return;
console.log();
MIT