@putout/plugin-remove-useless-arguments

8.0.0 • Public • Published

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

🐊Putout plugin adds ability to find and remove useless arguments.

Install

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

Rule

{
    "rules": {
        "remove-useless-arguments/arguments": "on",
        "remove-useless-arguments/destructuring": "on",
        "remove-useless-arguments/method": "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, c);

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() {}
}

License

MIT

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

    Package Sidebar

    Install

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

    Weekly Downloads

    14,835

    Version

    8.0.0

    License

    MIT

    Unpacked Size

    10.3 kB

    Total Files

    7

    Last publish

    Collaborators

    • coderaiser