{"name":"@putout/plugin-remove-unused-variables","version":"14.1.1","type":"module","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/v40.15.1/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":"^3.0.0","@putout/test":"^13.0.0","c8":"^10.0.0","eslint":"^9.0.0","eslint-plugin-n":"^17.0.0","eslint-plugin-putout":"^28.0.0","just-camel-case":"^6.2.0","madrun":"^11.0.0","nodemon":"^3.0.1","supertape":"^11.0.3","try-catch":"^3.0.0"},"peerDependencies":{"putout":">=40"},"license":"MIT","engines":{"node":">=20"},"publishConfig":{"access":"public"},"_id":"@putout/plugin-remove-unused-variables@14.1.1","gitHead":"2f6133764c3b7cb020b72a63166efece1f584727","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_nodeVersion":"25.2.1","_npmVersion":"11.4.2","dist":{"integrity":"sha512-1XBfM1aHYDUmcm4t4F3nrQ6N5OKd2wQU5vM3PxLmBlKmzIf7tnMD7MyRMnz3P5jqCq3iWtiPxvIx4HtjrvUdVg==","shasum":"ed9e8ec2bb730d73ae4dc41d04e70ff473ec0f92","tarball":"http://registry-npm.ywwl.com/@putout/plugin-remove-unused-variables/download/@putout/plugin-remove-unused-variables-14.1.1.tgz","fileCount":13,"unpackedSize":40976,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCMthT2e/A514FizBokPSDxwR4D/Cs3zDPcwRiEn4I6wQIhANT+hY0Z/3f0uLBTb3ooHbUeo2e+ZdbH+96XEFmRN7eT"}],"size":8354,"noattachment":false,"key":"/@putout/plugin-remove-unused-variables/-/@putout/plugin-remove-unused-variables-14.1.1.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugin-remove-unused-variables_14.1.1_1764782570100_0.9127806922385533"},"_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. Merged with [`@putout/plugin-variables`](https://www.npmjs.com/package/@putout/plugin-variables).\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":1764782570326,"_cnpm_publish_time":1764782570326,"dist-tags":{"latest":"14.1.1"}}