Detalhes do pacote

@putout/plugin-merge-return-with-next-sibling

coderaiser2.1kMIT1.0.0

🐊Putout plugin adds ability to merge return with next sibling

readme (leia-me)

@putout/plugin-merge-return-with-next-sibling 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 merge return with next sibling. Checkout in 🐊Putout Editor.

Install

npm i @putout/plugin-merge-return-with-next-sibling

Rule

{
    "rules": {
        "merge-return-with-next-sibling": "on"
    }
}

❌ Example of incorrect code

function x() {
    return
    {
        hello: 'world';
    }

    return
    5;

    return
    a ? 2 : 3;
}

✅ Example of correct code

function x() {
    return {
        hello: 'world',
    };

    return 5;

    return a ? 2 : 3;
}

License

MIT