Skip to content

Latest commit

 

History

History

plugin-convert-throw

@putout/plugin-convert-throw NPM version

This proposal defines new syntax to throw exceptions from within an expression context.

(c) tc39

🐊Putout plugin adds ability convert throw statement to expression.

Install

npm i @putout/plugin-convert-throw -D

Rule

{
    "rules": {
        "convert-throw": "on"
    },
    "plugins": [
        "convert-throw"
    ]
}

❌ Example of incorrect code

const fn = () => {
    throw Error('hello');
};

✅ Example of correct code

const fn = () => throwError('hello');

License

MIT