@putout/plugin-remove-useless-conditions
v3.0.1
Published
šPutout plugin adds ability to remove useless conditions
Maintainers
Readme
@putout/plugin-remove-useless-conditions 
The if statement executes a statement if a specified condition is truthy. If the condition is falsy, another statement can be executed.
(c) MDN
šPutout plugin adds ability to remove useless conditions. Merged to @putout/plugin-conditions.
Install
npm i @putout/plugin-remove-useless-conditionsRule
{
"rules": {
"remove-useless-conditions/evaluate": "on",
"remove-useless-conditions/simplify": "on"
}
}Evaluate
ā Example of incorrect code
const a = [];
const c = a;
if (a) {
console.log(a);
}ā Example of correct code
const a = [];
const c = a;
console.log(a);Simplify
ā Example of incorrect code
if (zone?.tooltipCallback) {
zone.tooltipCallback(e);
}
if (a)
alert('hello');
else
alert('hello');ā Example of correct code
zone?.tooltipCallback(e);
alert('hello');License
MIT
