Socket
Socket
Sign inDemoInstall

@putout/plugin-remove-useless-variables

Package Overview
Dependencies
1
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @putout/plugin-remove-useless-variables

🐊Putout plugin adds ability to find and remove useless


Version published
Weekly downloads
16K
decreased by-13.71%
Maintainers
1
Install size
11.3 kB
Created
Weekly downloads
 

Readme

Source

@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

Rule

{
    "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"
    }
}

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('child_process');

const {exec, spawn} = child_process;

✅ Example of correct code

const {exec, spawn} = require('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;
}

License

MIT

Keywords

FAQs

Last updated on 15 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc