eslint/no-useless-catch Correctness β
What it does β
Disallow unnecessary catch clauses
Why is this bad? β
A catch clause that only rethrows the original error is redundant, and has no effect on the runtime behavior of the program. These redundant clauses can be a source of confusion and code bloat, so itβs better to disallow these unnecessary catch clauses.
Example β
javascript
try {
doSomethingThatMightThrow();
} catch (e) {
throw e;
}
How to use β
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny no-useless-catch
json
{
"rules": {
"no-useless-catch": "error"
}
}