@putout/plugin-remove-useless-return

6.0.0 • Public • Published

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

The return statement ends function execution and specifies a value to be returned to the function caller.

(c) MDN

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

Install

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

Rule

{
    "rules": {
        "remove-useless-return": "on"
    }
}

❌ Example of incorrect code

const traverse = ({push}) => {
    return {
        ObjectExpression(path) {
            push(path);
        },
    };
};

✅ Example of correct code

const traverse = ({push}) => ({
    ObjectExpression(path) {
        push(path);
    },
});

License

MIT

/@putout/plugin-remove-useless-return/

    Package Sidebar

    Install

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

    Weekly Downloads

    4,880

    Version

    6.0.0

    License

    MIT

    Unpacked Size

    5.74 kB

    Total Files

    4

    Last publish

    Collaborators

    • coderaiser