{"name":"@putout/plugin-remove-useless-variables","version":"13.0.2","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin adds ability to find and remove useless","homepage":"https://github.com/coderaiser/putout/tree/master/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":"^2.0.0","@putout/plugin-remove-useless-array-from":"*","@putout/plugin-reuse-duplicate-init":"*","@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","madrun":"^10.0.0","nodemon":"^3.0.1"},"peerDependencies":{"putout":">=38"},"license":"MIT","engines":{"node":">=18"},"publishConfig":{"access":"public"},"_id":"@putout/plugin-remove-useless-variables@13.0.2","gitHead":"c723a385a4c4cbb098a429b93afdcc26444c7c6f","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_nodeVersion":"22.14.0","_npmVersion":"11.1.0","dist":{"integrity":"sha512-Xd1NBXFGEuq04uhRpDRJl5t0ZfHraR8by+o8oArPJq3teoqIEW5KRbMQ7F9GCyrEMqlKGpODOZoZzFQ7+bwP/Q==","shasum":"75d0d26c844e40b58eaed16a155e866f2f618924","tarball":"http://registry-npm.ywwl.com/@putout/plugin-remove-useless-variables/download/@putout/plugin-remove-useless-variables-13.0.2.tgz","fileCount":10,"unpackedSize":15684,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDPiYGT+vn3qx+5/JPZcmYosxS1UpnUkWAjnw7StSI9UAiBrnZn0k7ZroVuhhcHqJ5PQYgIj0EbR/bFeFBhsjAGglw=="}],"size":4514,"noattachment":false,"key":"/@putout/plugin-remove-useless-variables/-/@putout/plugin-remove-useless-variables-13.0.2.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugin-remove-useless-variables_13.0.2_1742243721787_0.2901337903290313"},"_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`.\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":1742243721990,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1742243721990,"dist-tags":{"latest":"14.2.1"}}