{"name":"@putout/plugin-remove-useless-variables","version":"14.2.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 useless variables","homepage":"https://github.com/coderaiser/putout/tree/v40.15.1/packages/plugin-remove-useless-variables#readme","main":"lib/index.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","putout-plugin-remove","plugin","remove","useless","variables","for-of"],"devDependencies":{"@putout/eslint-flat":"^3.0.0","@putout/plugin-declare":"*","@putout/plugin-maybe":"*","@putout/plugin-remove-useless-array-from":"*","@putout/plugin-reuse-duplicate-init":"*","@putout/test":"^14.0.0","c8":"^10.0.0","eslint":"v10.0.0-alpha.0","eslint-plugin-n":"^17.0.0","eslint-plugin-putout":"^28.0.0","madrun":"^11.0.0","nodemon":"^3.0.1"},"peerDependencies":{"putout":">=40"},"license":"MIT","engines":{"node":">=20"},"publishConfig":{"access":"public"},"_id":"@putout/plugin-remove-useless-variables@14.2.1","gitHead":"2f6133764c3b7cb020b72a63166efece1f584727","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_nodeVersion":"25.2.1","_npmVersion":"11.4.2","dist":{"integrity":"sha512-e6VmtEvZZG1U+rqDgzA15DLHQLu8QGYRFCwTOoQqX+dnpPnJbKzalNNsrNphV6eYDukgNLXVqEaXugbpPyzm0Q==","shasum":"8189f70bca122f6aea2831b2b3b62f97fae913c0","tarball":"http://registry-npm.ywwl.com/@putout/plugin-remove-useless-variables/download/@putout/plugin-remove-useless-variables-14.2.1.tgz","fileCount":10,"unpackedSize":15941,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBsd+GC+rsWtNQbA3+AsUG8gRfEe/wkEAyidbqgLnkAbAiEAu2G3La3t7FEFUBfiLHdF6U/6z9xnH4hGX/MCBgSKOts="}],"size":4575,"noattachment":false,"key":"/@putout/plugin-remove-useless-variables/-/@putout/plugin-remove-useless-variables-14.2.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-useless-variables_14.2.1_1764602245389_0.24185053402790246"},"_hasShrinkwrap":false,"readme":"# @putout/plugin-remove-useless-variables [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-variables.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-variables \"npm\"\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove `useless variables`. Renamed to [`@putout/plugin-variables`](https://www.npmjs.com/package/@putout/plugin-variables).\n\n## Install\n\n```\nnpm i @putout/plugin-remove-useless-variables -D\n```\n\n## Rules\n\n- ✅ [assignment](#assignmentn);\n- ✅ [declaration](#declaration);\n- ✅ [destruct](#destruct);\n- ✅ [duplicate](#duplicate);\n- ✅ [remove](#remove);\n- ✅ [rename](#rename);\n\n## Config\n\n```json\n{\n    \"rules\": {\n        \"remove-useless-variables/assignment\": \"on\",\n        \"remove-useless-variables/rename\": \"on\",\n        \"remove-useless-variables/remove\": \"on\",\n        \"remove-useless-variables/destruct\": \"on\",\n        \"remove-useless-variables/declaration\": [\"on\", {\n            \"maxLength\": 20\n        }],\n        \"remove-useless-variables/duplicate\": \"on\"\n    }\n}\n```\n\n## assignment\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/a2f7fe5e2c294443576f95dce6fde67e/0699ccb4f7335e8e3f80de891913a8e3ad4f35e3).\n\n### ❌ Example of incorrect code\n\n```js\nwhile (!(files = readDirectory(parentDir)).length) {}\n```\n\n### ✅ Example of correct code\n\n```js\nwhile (!readDirectory(parentDir).length) {}\n```\n\n## rename\n\n### ❌ Example of incorrect code\n\n```js\nfunction hi(a) {\n    const b = a;\n}\n```\n\n### ✅ Example of correct code\n\n```js\nfunction hi(b) {}\n```\n\n## destruct\n\n### ❌ Example of incorrect code\n\n```js\nfunction hi(c) {\n    const {a, b} = c;\n}\n```\n\n### ✅ Example of correct code\n\n```js\nfunction hi({a, b}) {}\n```\n\n## remove\n\n### ❌ Example of incorrect code\n\n```js\nconst child_process = require('node:child_process');\n\nconst {exec, spawn} = child_process;\n```\n\n### ✅ Example of correct code\n\n```js\nconst {exec, spawn} = require('node:child_process');\n```\n\n### remove\n\nCheck it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/041767876a6d41c82260b293a06c2b6b/addf2b49cf9235d9b7a1017065cec5dece232660).\n\n### ❌ Example of incorrect code\n\n```js\nconst a = 5;\nconst b = a;\n\nconst c = 5;\n\nd = c;\n```\n\n### ✅ Example of correct code\n\n```js\nconst b = 5;\n\nd = 5;\n```\n\n### declaration\n\nCheck it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/32177535829956ef4c7b51587a8853c3/1fe071ff6542dc66ffad55f4776733903ab07241).\n\n### ❌ Example of incorrect code\n\n```js\nfunction x() {\n    const a = 5;\n    return a;\n}\n\nconst z = b.c.replace('x', 'y');\n\nb.c = z;\n```\n\n### ✅ Example of correct code\n\n```js\nfunction x() {\n    return 5;\n}\n\nb.c = b.c.replace('x', 'y');\n```\n\n### duplicate\n\nCheck it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/32177535829956ef4c7b51587a8853c3/52f19ab0e467ad7cc54fa8c554c3b0804de9d1ca).\n\n### ❌ Example of incorrect code\n\n```js\nconst DestructuringErrors = function DestructuringErrors(a, b) {\n    return [a, b];\n};\n```\n\n### ✅ Example of correct code\n\n```js\nfunction DestructuringErrors(a, b) {\n    return [a, b];\n}\n\nbc = b.c.replace('x', 'y');\n```\n\n## License\n\nMIT\n","publish_time":1764602245588,"_cnpm_publish_time":1764602245588,"dist-tags":{"latest":"14.2.1"}}