npm.io
3.0.0 • Published 1 year ago

@putout/plugin-remove-useless-operand

Licence
MIT
Version
3.0.0
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
795

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

The increment operator (++) adds one to its operand and returns a value.

The addition assignment operator (+=) adds the value of the right operand to a variable and assigns the result to the variable.

(c) MDN

Putout plugin adds ability to remove useless operand.

Install

npm i @putout/plugin-remove-useless-operand

Rule

{
    "rules": {
        "remove-useless-operand": "on"
    }
}

Example of incorrect code

a = a + b;
a = b + a;
b += 1;

Example of correct code

a += b;
++b;

License

MIT

Keywords