sonarjs/no-useless-catch
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-useless-catch": "error",
},
},
];try {
doSomething();
} catch (ex) { // Noncompliant
throw ex;
}try {
doSomething();
} catch (ex) {
console.err(ex);
throw ex;
}doSomething();Examples from the ESLint documentation.
sonarjs/no-useless-catch
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-useless-catch": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow unnecessary catch clauses
The return value of void functions should not be used
Unused local variables and functions should be removed
Type intersections should use meaningful types