6.0.0 β€’ Published 6 months ago

@putout/plugin-remove-useless-return v6.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@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