{"_id":"@putout/plugin-arguments@2.1.1","tag":false,"bugs":{"url":"https://github.com/coderaiser/putout/issues"},"dist":{"shasum":"1b7e9eead6897bf18ea312c9ff534275cca23ba4","tarball":"http://registry-npm.ywwl.com/@putout/plugin-arguments/download/@putout/plugin-arguments-2.1.1.tgz","fileCount":12,"integrity":"sha512-uSY9DwekJNC4WyhZ90pT1sSK/Gqyl5nqYDriLN54eXrijKJ94S7AXjM7aF8aGkPu0jF0pTMrampAiigZ/Ga0Cg==","signatures":[{"sig":"MEUCIBAZdy9ayXOkWDZk+0DwV52UjlSKAFVfaed+OZUE3wDLAiEAwum1pNY3oZo3yzU3RQmKa7hbB3QsF85EJq6jhlY9PCQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHA7B5oSJF98PSH8f5vUFftNGsnuQFZGUZc242dOYUJtAiEAikbk/B1dHCvWsVFIHWTEM6BOnS6fNLojza25VOj0qr0="}],"unpackedSize":18321,"size":5625,"noattachment":false,"key":"/@putout/plugin-arguments/-/@putout/plugin-arguments-2.1.1.tgz"},"main":"lib/index.js","name":"@putout/plugin-arguments","type":"module","author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"engines":{"node":">=22"},"gitHead":"fbe3819d5811a449d159005a4bb625b3daf5e5ca","license":"MIT","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"},"version":"2.1.1","_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-arguments#readme","keywords":["putout","putout-plugin","plugin","remove","useless","arguments"],"changelog":false,"repository":{"url":"git+https://github.com/coderaiser/putout.git","type":"git"},"_npmVersion":"12.1.0","description":"🐊Putout plugin adds ability to find and remove useless arguments","directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_nodeVersion":"26.13.0","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.0.0","madrun":"^13.0.0","superc8":"^12.0.0","@putout/test":"^15.0.0","eslint-plugin-putout":"^31.0.0"},"peerDependencies":{"putout":">=42"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugin-arguments_2.1.1_1793917821275_0.6442869618529813"},"readme":"# @putout/plugin-arguments [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-arguments.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-arguments \"npm\"\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove useless `arguments`.\n\n## Install\n\n```\nnpm i @putout/plugin-arguments\n```\n\n## Rules\n\n- ✅ [apply-json-parse](#apply-json-parse);\n- ✅ [apply-rest](#apply-rest);\n- ✅ [convert-expressiont-to-arguments](#convert-expression-to-arguments);\n- ✅ [remove-duplicate](#remove-duplicate);\n- ✅ [remove-empty](#remove-empty);\n- ✅ [remove-unused](#remove-unused);\n- ✅ [remove-useless](#remove-useless);\n- ✅ [remove-useless-from-method](#remove-useless-from-method);\n\n## Config\n\n```json\n{\n    \"rules\": {\n        \"arguments/apply-json-parse\": \"on\",\n        \"arguments/apply-rest\": \"on\",\n        \"arguments/convert-expressiont-to-arguments\": \"on\",\n        \"arguments/remove-duplicate\": \"on\",\n        \n        \"arguments/remove-empty\": \"on\",\n        \"arguments/remove-unused\": \"on\",\n        \"arguments/remove-useless\": \"on\",\n        \"arguments/remove-useless-from-method\": \"on\"\n    }\n}\n```\n\n### apply-json-parse\n\n> The `JSON.parse()` static method parses a JSON string, constructing the JavaScript value or object described by the string. An optional reviver function can be provided to perform a transformation on the resulting object before it is returned.\n>\n> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)\n\nCheck it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/efdb0e3d0ab937f7901ce3047626b5fd/580aa27e4fb61fbfe3eead0cd21971a6ff084174).\n\n### ❌ Example of incorrect code\n\n```js\nimport {operator} from 'putout';\n\nconst {fromJS} = operator;\nJSON.parse(fromJS(print(ast)), null, 4);\n```\n\n### ✅ Example of correct code\n\n```js\nimport {operator} from 'putout';\n\nconst {fromJS} = operator;\nJSON.parse(fromJS(print(ast)));\n```\n\n## apply-rest\n\n> The rest parameter syntax allows a function to accept an indefinite number of arguments as an `array`, providing a way to represent variadic functions in JavaScript.\n>\n> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters)\n\n### ❌ Example of incorrect code\n\n```js\nfunction hello() {\n    console.log(arguments);\n}\n```\n\n### ✅ Example of correct code\n\n```js\nfunction hello(...args) {\n    console.log(args);\n}\n```\n\n## convert-expression-to-arguments\n\n> `Uncaught SyntaxError: Malformed arrow function parameter list` occurs when your function declaration is missing valid parameters.\n>\n> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Missing_formal_parameter)\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to fix `SyntaxError: missing formal parameter` .\nCheckout in 🐊[**Putout Editor**](https://putout.vercel.app/#/gist/e1818c2385974e136ae77eb28b3d2221/66dcb650e02aaafffa7fe00914f80366c4bfd7d3).\n\n## ❌ Example of incorrect code\n\n```\n(a(hello, world)) => (b + a);\n(a + b) => (b + a);\n(a || b) => (b + a);\n```\n\n## ✅ Example of correct code\n\n```js\n(a, hello, world) => a;\n(a, b) => b + a;\n(a, b) => b + a;\n```\n\n## remove-duplicate\n\n> The JavaScript exception `duplicate formal argument x` or `duplicate argument names not allowed in this context` occurs when a function creates two or more parameter bindings with the same name, and the function is not a non-strict function with only simple parameters.\n>\n> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Duplicate_parameter)\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/7f6d549de44d73601ad8cbffc09269fc/586dcb0463439365875098c04ac4e11553911478).\n\n```diff\n-const sum = (a, a) => {}\n+const sum = (a) => {}\n```\n\n## Comparison\n\n| Linter        | Rule | Fix |\n|---------------|------|-----|\n| 🐊 **Putout** | [`arguments/remove-duplicate`](https://github.com/coderaiser/putout/tree/master/packages/plugin-arguments#remove-duplicate) | ✅   |\n| ⏣ **ESLint**  | [`no-dupe-args`](https://eslint.org/docs/rules/no-dupe-args) | ❌   |\n| 🦕 **Deno**   | [`no-dupe-args`](https://docs.deno.com/lint/rules/no-dupe-args/) | ❌   |\n\n## remove-useless\n\n### ❌ Example of incorrect code\n\n```js\nconst sum = (a, b) => {};\nsum(a, b, c);\n```\n\n### ✅ Example of correct code\n\n```js\nconst sum = (a, b) => {};\nsum(a, b);\n```\n\n### remove-useless-from-method\n\nCheck it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/362c37e9f533299a7e721ac46f936801/0a47d094bd2a048eb6dcc224b808a63f2d076ccb).\n\n### ❌ Example of incorrect code\n\n```js\nclass Parser {\n    parseStatement(context, topLevel, exports) {\n        this.parseGuard(a, b);\n    }\n    \n    parseGuard() {}\n}\n```\n\n### ✅ Example of correct code\n\n```js\nclass Parser {\n    parseStatement(context, topLevel, exports) {\n        this.parseGuard();\n    }\n    \n    parseGuard() {}\n}\n```\n\n### remove-unused\n\nCheck it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/f6bf5e069cfb1328fe7418c501e265cc/388ab2266babe84f77c1f82687f5ed44873e8651).\n\n### ❌ Example of incorrect code\n\n```js\nmember += compute(member, list[i]);\n\nfunction compute(member, current) {\n    return String(current);\n}\n```\n\n### ✅ Example of correct code\n\n```js\nmember += compute(list[i]);\n\nfunction compute(current) {\n    return String(current);\n}\n```\n\n### remove-empty\n\n> `Uncaught SyntaxError: Unexpected token ','`\n>\n> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Unexpected_token)\n\nCheck it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/56f6e4cc87d0e4830ce570c1af8a7a4b/e85940bd6cbf4448e8a062543ce2e9fa67d0bb69).\n\n```diff\n-renameFileWithLog('hello', ,'world');\n+renameFileWithLog('hello', 'world');\n```\n\n## License\n\nMIT\n","publish_time":1793917821386,"_cnpm_publish_time":1793917821386,"dist-tags":{"latest":"2.1.1"}}