{"name":"@putout/plugin-remove-unused-variables","version":"12.1.0","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin adds ability to find and remove unused variables","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-unused-variables#readme","main":"lib/remove-unused-variables.js","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git+https://github.com/coderaiser/putout.git"},"scripts":{"test":"madrun test","watch:test":"madrun watch:test","lint":"madrun lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","fix:lint":"madrun fix:lint","coverage":"madrun coverage","report":"madrun report"},"dependencies":{},"keywords":["putout","putout-plugin","plugin","remove","unused","variables"],"devDependencies":{"@putout/eslint-flat":"^2.0.0","@putout/test":"^12.0.0","c8":"^10.0.0","eslint":"^9.0.0","eslint-plugin-n":"^17.0.0","eslint-plugin-putout":"^25.0.1","just-camel-case":"^6.2.0","madrun":"^10.0.0","nodemon":"^3.0.1","supertape":"^10.0.0","try-catch":"^3.0.0"},"peerDependencies":{"putout":">=38"},"license":"MIT","engines":{"node":">=18"},"publishConfig":{"access":"public"},"_id":"@putout/plugin-remove-unused-variables@12.1.0","gitHead":"5b665ccd4473e24505c6f1b2c2657e8ea188b374","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_nodeVersion":"22.14.0","_npmVersion":"11.1.0","dist":{"integrity":"sha512-GCIcCk+iR+yEdyOq5YcE47Gi528e8QIyQije/e39zoCbCYdVXC92ErWEdDm5aag0TuHPJ/Z/Rm5TQ224A9MZ5w==","shasum":"898d6952644b36a775649e97bb9008172af7f3a8","tarball":"http://registry-npm.ywwl.com/@putout/plugin-remove-unused-variables/download/@putout/plugin-remove-unused-variables-12.1.0.tgz","fileCount":13,"unpackedSize":41412,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBeiauKJBDXyqVRhYko3Ez4a1QNbE7rm+KAjAtnAlZFGAiAG5raWkhqeYgrIvMuE6QnPE/Gdd8jdUmjkSiPHu8ek5Q=="}],"size":8355,"noattachment":false,"key":"/@putout/plugin-remove-unused-variables/-/@putout/plugin-remove-unused-variables-12.1.0.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugin-remove-unused-variables_12.1.0_1741457280891_0.06736454064231823"},"_hasShrinkwrap":false,"readme":"# @putout/plugin-remove-unused-variables [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-unused-variables.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-unused-variables \"npm\"\n\n> A variable is a container for a value, like a `number` we might use in a sum, or a `string` that we might use as part of a sentence.\n>\n> (c) [MDN](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Variables)\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove the variables that are declared, but:\n\n- not passed as **argument** to a **function**;\n- not used as **operand** in **expression**;\n\nThat is **unused variables**. Most likely it is a leftovers due to incomplete transforming of the code. Such variables take up space and gives no value so they must be removed.\n\n☝️*Remember, when you [writing a transform](https://github.com/coderaiser/putout/tree/master/packages/engine-runner#readme) you can skip all parts related to **removing unused variables** and just reuse current **plugin** it will make your code simpler and less error prone.*\n\n☝️*No, you cannot just look at [`referenced` and `constant` fields](https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md#user-content-bindings) to determine if you can remove variable and [here is why](https://putout.cloudcmd.io/#/gist/4277392f74b56b74911b779c9624af8d/cfec476f857dfb4f4c7a6247bdcc6b521fed8e70) one of the biggest plugins exists*.\n\n## Install\n\n```\nnpm i @putout/plugin-remove-unused-variables -D\n```\n\n## Rule\n\nRule `remove-unused-variables` is enabled by default, to disable add to `.putout.json`:\n\n```json\n{\n    \"rules\": {\n        \"remove-unused-variables\": \"off\"\n    }\n}\n```\n\n## ❌ Example of incorrect code\n\n```js\nconst a = 'hello';\nconst b = 'world';\n\nconsole.log(a);\n```\n\n## ✅ Example of correct code\n\n```js\nconst a = 'hello';\nconsole.log(a);\n```\n\n## Comparison\n\nLinter | Rule | Fix\n--------|-------|------------|\n🐊 **Putout**| [`remove-unused-variables`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-unused-variables#readme)| ✅\n⏣ **ESLint** | [`no-unused-vars`](https://eslint.org/docs/rules/no-unused-vars) | ❌\n\n## License\n\nMIT\n","publish_time":1741457281088,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1741457281088,"dist-tags":{"latest":"14.1.1"}}