oxc/missing-throw Correctness
What it does
Checks whether the throw
keyword is missing in front of a new
expression.
Why is this bad?
The throw
keyword is required in front of a new
expression to throw an error. Omitting it is usually a mistake.
Example
Examples of incorrect code for this rule:
javascript
function foo() {
throw Error();
}
const foo = () => {
new Error();
};
Examples of correct code for this rule:
javascript
function foo() {
throw new Error();
}
const foo = () => {
throw new Error();
};