2.0.2 β€’ Published 8 months ago

@putout/plugin-remove-useless-else v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@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. 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