🐊Putout plugin adds ability to find and remove useless arguments
.
npm i @putout/plugin-remove-useless-arguments
- ✅ arguments;
- ✅ destructuring;
- ✅ method;
- ✅ unused;
- ✅ json-parse;
{
"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"
}
}
const sum = (a, b) => {}; // destructuring
sum(a, b, c);
const sum = (a, b) => {};
sum(a, b);
onIfStatement({
push,
generate,
abc,
helloworld,
});
function onIfStatement({push}) {}
onIfStatement({
push,
});
function onIfStatement({push}) {}
Check it out in 🐊Putout Editor.
class Parser {
parseStatement(context, topLevel, exports) {
this.parseGuard(a, b);
}
parseGuard() {}
}
class Parser {
parseStatement(context, topLevel, exports) {
this.parseGuard();
}
parseGuard() {}
}
Check it out in 🐊Putout Editor.
member += compute(member, list[i]);
function compute(member, current) {
return String(current);
}
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
Check it out in 🐊Putout Editor.
import {operator} from 'putout';
const {fromJS} = operator;
JSON.parse(fromJS(print(ast)), null, 4);
import {operator} from 'putout';
const {fromJS} = operator;
JSON.parse(fromJS(print(ast)));
MIT