@putout/plugin-remove-useless-arguments
Version:
πPutout plugin adds ability to find and remove useless arguments
158 lines (110 loc) β’ 3.17 kB
Markdown
//img.shields.io/npm/v/@putout/plugin-remove-useless-arguments.svg?style=flat&longCache=true
[ ]: https://npmjs.org/package/@putout/plugin-remove-useless-arguments"npm"
π[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove useless `arguments`.
```
npm i @putout/plugin-remove-useless-arguments
```
- β
[arguments](
- β
[destructuring](
- β
[method](
- β
[unused](
- β
[json-parse](
```json
{
"rules": {
"remove-useless-arguments/arguments": "on",
"remove-useless-arguments/destructuring": "on",
"remove-useless-arguments/method": "on",
"remove-useless-arguments/unused": "on",
"remove-useless-arguments/json-parse": "on"
}
}
```
```js
const sum = (a, b) => {}; // destructuring
sum(a, b, c);
```
```js
const sum = (a, b) => {};
sum(a, b);
```
```js
onIfStatement({
push,
generate,
abc,
helloworld,
});
function onIfStatement({push}) {}
```
```js
onIfStatement({
push,
});
function onIfStatement({push}) {}
```
Check it out in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/362c37e9f533299a7e721ac46f936801/0a47d094bd2a048eb6dcc224b808a63f2d076ccb).
```js
class Parser {
parseStatement(context, topLevel, exports) {
this.parseGuard(a, b);
}
parseGuard() {}
}
```
```js
class Parser {
parseStatement(context, topLevel, exports) {
this.parseGuard();
}
parseGuard() {}
}
```
Check it out in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/f6bf5e069cfb1328fe7418c501e265cc/388ab2266babe84f77c1f82687f5ed44873e8651).
```js
member += compute(member, list[i]);
function compute(member, current) {
return String(current);
}
```
```js
member += compute(list[i]);
function compute(current) {
return String(current);
}
```
> 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.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
Check it out in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/efdb0e3d0ab937f7901ce3047626b5fd/580aa27e4fb61fbfe3eead0cd21971a6ff084174).
```js
import {operator} from 'putout';
const {fromJS} = operator;
JSON.parse(fromJS(print(ast)), null, 4);
```
```js
import {operator} from 'putout';
const {fromJS} = operator;
JSON.parse(fromJS(print(ast)));
```
MIT
[ ]: https: