@putout/plugin-remove-useless-variables
putout plugin adds ability to find and remove useless
Last updated 5 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-remove-useless-variables 
SYNC missed versions from official npm registry.

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

🐊Putout plugin adds ability to find and remove useless variables.

Install

npm i @putout/plugin-remove-useless-variables -D

Rules

  • ✅ [declaration][#declaration];
  • ✅ [destruct][#destruct];
  • ✅ [duplicate][#duplicate];
  • ✅ [remove][#remove];
  • ✅ [rename][#rename];

Config

{
    "rules": {
        "remove-useless-variables/rename": "on",
        "remove-useless-variables/remove": "on",
        "remove-useless-variables/destruct": "on",
        "remove-useless-variables/await": "on",
        "remove-useless-variables/declaration": "on",
        "remove-useless-variables/duplicate": "on"
    }
}

rename

❌ Example of incorrect code

function hi(a) {
    const b = a;
}

✅ Example of correct code

function hi(b) {}

destruct

❌ Example of incorrect code

function hi(c) {
    const {a, b} = c;
}

✅ Example of correct code

function hi({a, b}) {}

remove

❌ Example of incorrect code

const child_process = require('node:child_process');

const {exec, spawn} = child_process;

✅ Example of correct code

const {exec, spawn} = require('node:child_process');

remove

Check it out in 🐊Putout Editor.

❌ Example of incorrect code

const a = 5;
const b = a;

const c = 5;

d = c;

✅ Example of correct code

const b = 5;

d = 5;

declaration

Check it out in 🐊Putout Editor.

❌ Example of incorrect code

function x() {
    const a = 5;
    return a;
}

✅ Example of correct code

function x() {
    return 5;
}

duplicate

Check it out in 🐊Putout Editor.

❌ Example of incorrect code

const DestructuringErrors = function DestructuringErrors(a, b) {
    return [a, b];
};

✅ Example of correct code

function DestructuringErrors(a, b) {
    return [a, b];
}

License

MIT

Current Tags

  • 11.1.1                                ...           latest (6 months ago)

45 Versions

  • 11.1.1                                ...           6 months ago
  • 11.1.0                                ...           6 months ago
  • 11.0.0                                ...           6 months ago
  • 10.0.0                                ...           a year ago
  • 9.1.0                                ...           a year ago
  • 9.0.0                                ...           a year ago
  • 8.0.0                                ...           2 years ago
  • 7.3.0                                ...           3 years ago
  • 7.2.0                                ...           3 years ago
  • 7.1.0                                ...           3 years ago
  • 7.0.0                                ...           3 years ago
  • 6.3.0                                ...           3 years ago
  • 6.2.0                                ...           3 years ago
  • 6.1.0                                ...           3 years ago
  • 6.0.0                                ...           3 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 4.7.0                                ...           4 years ago
  • 4.6.0                                ...           4 years ago
  • 4.5.1                                ...           4 years ago
  • 4.5.0                                ...           4 years ago
  • 4.4.1                                ...           4 years ago
  • 4.4.0                                ...           4 years ago
  • 4.3.0                                ...           4 years ago
  • 4.2.1                                ...           4 years ago
  • 4.2.0                                ...           4 years ago
  • 4.1.0                                ...           4 years ago
  • 4.0.0                                ...           5 years ago
  • 3.0.0                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.10.0                                ...           5 years ago
  • 1.9.0                                ...           5 years ago
  • 1.8.1                                ...           5 years ago
  • 1.8.0                                ...           5 years ago
  • 1.7.0                                ...           5 years ago
  • 1.6.0                                ...           5 years ago
  • 1.5.0                                ...           5 years ago
  • 1.4.1                                ...           5 years ago
  • 1.4.0                                ...           5 years ago
  • 1.3.0                                ...           6 years ago
  • 1.2.0                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years 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 (11)
Dependents (1)

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