@putout/plugin-remove-useless-arguments
putout plugin adds ability to find and remove useless arguments
Last updated 5 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @putout/plugin-remove-useless-arguments 
SYNC missed versions from official npm registry.

@putout/plugin-remove-useless-arguments NPM version

????Putout plugin adds ability to find and remove useless arguments. Renamed to:

Install

npm i @putout/plugin-remove-useless-arguments

Rules

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

Current Tags

  • 12.1.2                                ...           latest (4 months ago)

31 Versions

  • 12.1.2                                ...           4 months ago
  • 12.1.1                                ...           5 months ago
  • 12.1.0                                ...           5 months ago
  • 12.0.0                                ...           a year ago
  • 11.0.0                                ...           a year ago
  • 10.1.0                                ...           a year ago
  • 10.0.0                                ...           a year ago
  • 9.0.0                                ...           2 years ago
  • 8.0.0                                ...           3 years ago
  • 7.0.0                                ...           3 years ago
  • 6.3.0                                ...           4 years ago
  • 6.2.0                                ...           4 years ago
  • 6.1.0                                ...           4 years ago
  • 6.0.0                                ...           4 years ago
  • 5.2.0                                ...           5 years ago
  • 5.1.0                                ...           5 years ago
  • 5.0.1                                ...           5 years ago
  • 5.0.0                                ...           5 years ago
  • 4.2.1                                ...           6 years ago
  • 4.2.0                                ...           6 years ago
  • 4.1.0                                ...           6 years ago
  • 4.0.2                                ...           6 years ago
  • 4.0.1                                ...           6 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                                ...           7 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 7
Dependencies (0)
None
Dev Dependencies (6)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |