12.0.0 β’ Published 6 months ago
@putout/plugin-remove-useless-arguments v12.0.0
@putout/plugin-remove-useless-arguments 
πPutout plugin adds ability to find and remove useless arguments.
Install
npm i @putout/plugin-remove-useless-argumentsRules
- β arguments;
- β destructuring;
- β method;
- β unused;
- β json-parse;
Config
{
"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"
}
}arguments
β Example of incorrect code
const sum = (a, b) => {}; // destructuring
sum(a, b, c);β Example of correct code
const sum = (a, b) => {};
sum(a, b);destructuring
β Example of incorrect code
onIfStatement({
push,
generate,
abc,
helloworld,
});
function onIfStatement({push}) {}β Example of correct code
onIfStatement({
push,
});
function onIfStatement({push}) {}method
Check it out in πPutout Editor.
β Example of incorrect code
class Parser {
parseStatement(context, topLevel, exports) {
this.parseGuard(a, b);
}
parseGuard() {}
}β Example of correct code
class Parser {
parseStatement(context, topLevel, exports) {
this.parseGuard();
}
parseGuard() {}
}unused
Check it out in πPutout Editor.
β Example of incorrect code
member += compute(member, list[i]);
function compute(member, current) {
return String(current);
}β Example of correct code
member += compute(list[i]);
function compute(current) {
return String(current);
}json-parse
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
Check it out in πPutout Editor.
β Example of incorrect code
import {operator} from 'putout';
const {fromJS} = operator;
JSON.parse(fromJS(print(ast)), null, 4);β Example of correct code
import {operator} from 'putout';
const {fromJS} = operator;
JSON.parse(fromJS(print(ast)));License
MIT
10.0.0
10 months ago
10.1.0
10 months ago
12.0.0
6 months ago
11.0.0
9 months ago
9.0.0
1 year ago
8.0.0
2 years ago
7.0.0
2 years ago
6.3.0
3 years ago
6.2.0
3 years ago
6.1.0
3 years ago
6.0.0
4 years ago
5.2.0
4 years ago
5.1.0
5 years ago
5.0.1
5 years ago
5.0.0
5 years ago
4.2.1
5 years ago
4.2.0
5 years ago
4.1.0
5 years ago
4.0.2
5 years ago
4.0.1
5 years ago
4.0.0
6 years ago
3.0.1
6 years ago
3.0.0
6 years ago
2.0.0
6 years ago
1.1.0
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago