@putout/plugin-remove-useless-push
v1.0.3
Published
šPutout plugin adds ability to remove useless 'push()'
Downloads
12,679
Maintainers
Readme
@putout/plugin-remove-useless-push
The
push()
method ofArray
instances adds the specified elements to the end of an array and returns the new length of the array.(c) MDN
šPutout plugin adds ability to remove useless push()
. The rule fits good with putout/remove-unused-variables
.
Checkout in šPutout Editor.
Install
npm i @putout/plugin-remove-useless-push
Rule
{
"rules": {
"remove-useless-push": "on"
}
}
ā Example of incorrect code
function get() {
const a = [];
const b = [];
a.push(1);
b.push(2);
return b;
}
ā Example of correct code
function get() {
const a = [];
const b = [];
b.push(2);
return b;
}
License
MIT