{"name":"@putout/plugin-remove-useless-variables","version":"13.0.1","keywords":["putout","putout-plugin","putout-plugin-remove","plugin","remove","useless","variables","for-of"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/plugin-remove-useless-variables@13.0.1","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-variables#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"tag":false,"dist":{"shasum":"8b266197ae0a00c2ea2d5b129c8699c33976fa0d","tarball":"http://registry-npm.ywwl.com/@putout/plugin-remove-useless-variables/download/@putout/plugin-remove-useless-variables-13.0.1.tgz","fileCount":10,"integrity":"sha512-+nmzS6qRzx5GRffmQ8qrIJuIDrijKaSs9kXUd9BOQsCYY2YipW2AmFLkJ6zJQGp3JvAuYIxM2F6RiQ+wddeIMw==","signatures":[{"sig":"MEQCID3ItJBAbMAPF5QyeHTbMp2SJz0A65qW2Tl+9otKrVCPAiAtCc3cD0A3Qb7ZvK3VfEH9jszrYTg757tww+JFq6FVKQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15679,"size":4513,"noattachment":false,"key":"/@putout/plugin-remove-useless-variables/-/@putout/plugin-remove-useless-variables-13.0.1.tgz"},"main":"lib/index.js","type":"commonjs","engines":{"node":">=18"},"gitHead":"f1559583668aead38aa096dcbc240a8041091608","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":"11.1.0","description":"🐊Putout plugin adds ability to find and remove useless","directories":{},"_nodeVersion":"22.14.0","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","eslint":"^9.0.0","madrun":"^10.0.0","nodemon":"^3.0.1","@putout/test":"^12.0.0","eslint-plugin-n":"^17.0.0","@putout/eslint-flat":"^2.0.0","eslint-plugin-putout":"^25.0.1","@putout/plugin-reuse-duplicate-init":"*","@putout/plugin-remove-useless-array-from":"*"},"peerDependencies":{"putout":">=38"},"_npmOperationalInternal":{"tmp":"tmp/plugin-remove-useless-variables_13.0.1_1742243197233_0.2671909294631183","host":"s3://npm-registry-packages-npm-production"},"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":1742243197390,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1742243197390,"dist-tags":{"latest":"14.2.1"}}