{"name":"@putout/plugin-remove-unused-variables","version":"11.0.0","keywords":["putout","putout-plugin","plugin","remove","unused","variables"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/plugin-remove-unused-variables@11.0.0","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-unused-variables#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"tag":false,"dist":{"shasum":"c0bb30b5b714eb7448f6ae210d89906dcf9deac5","tarball":"http://registry-npm.ywwl.com/@putout/plugin-remove-unused-variables/download/@putout/plugin-remove-unused-variables-11.0.0.tgz","fileCount":13,"integrity":"sha512-qaVxEzt5XDYM4WHCsk2rtTbKbtJKQQFZcSuNvGhqiKaeBjrCRIpQ87Iij9ozWBUU0gxs+hUwkfeHmYvXsLrdsg==","signatures":[{"sig":"MEUCIQDAhhNRrwPJONodDrJrYvhooNsq2iEt2QFPnceEj5oaqQIgc+eylHIjxhJ/V+9ryxgAT49lnZuHsPSw4qkr0bZHxH8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41804,"size":8331,"noattachment":false,"key":"/@putout/plugin-remove-unused-variables/-/@putout/plugin-remove-unused-variables-11.0.0.tgz"},"main":"lib/remove-unused-variables.js","type":"commonjs","engines":{"node":">=18"},"gitHead":"336d44acce10aae96deb30d205bc32592fe2edd1","release":false,"scripts":{"lint":"madrun lint","test":"madrun test","report":"madrun report","coverage":"madrun coverage","fix:lint":"madrun fix:lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","watch:test":"madrun watch:test"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"changelog":false,"repository":{"url":"git+https://github.com/coderaiser/putout.git","type":"git"},"_npmVersion":"10.9.0","description":"🐊Putout plugin adds ability to find and remove unused variables","directories":{},"_nodeVersion":"22.13.0","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","eslint":"^9.0.0","madrun":"^10.0.0","nodemon":"^3.0.1","supertape":"^10.0.0","try-catch":"^3.0.0","@putout/test":"^11.0.0","eslint-plugin-n":"^17.0.0","just-camel-case":"^6.2.0","eslint-plugin-putout":"^23.0.0"},"peerDependencies":{"putout":">=37"},"_npmOperationalInternal":{"tmp":"tmp/plugin-remove-unused-variables_11.0.0_1737582699822_0.606081604399735","host":"s3://npm-registry-packages-npm-production"},"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":1737582700014,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1737582700014,"dist-tags":{"latest":"14.1.1"}}