Skip to content

Latest commit

 

History

History
 
 

plugin-remove-useless-else

@putout/plugin-remove-useless-else NPM version

You can skip the else block if your if block always executes a return statement, it makes code a lot easier to read.

(c) no else return

🐊Putout plugin adds ability to remove useless else.

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