@putout/plugin-remove-useless-push
🐊Putout plugin adds ability to remove useless 'push()'
Last updated 3 months ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-remove-useless-push 
SYNC missed versions from official npm registry.

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

The push() method of Array 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

Current Tags

  • 1.0.3                                ...           latest (3 months ago)

4 Versions

  • 1.0.3                                ...           3 months ago
  • 1.0.2                                ...           3 months ago
  • 1.0.1                                ...           3 months ago
  • 1.0.0                                ...           3 months ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE