Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 903 Bytes

README.md

File metadata and controls

47 lines (34 loc) · 903 Bytes

@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