AI-coding hygiene
no-empty-catch
Forbid empty `catch` blocks (`catch {}`, `catch (e) {}`, `catch (e) { /* TODO */ }`).
AI coding tools use this shape to silence the type checker without addressing the underlying error — the runtime failure then ships invisibly. Distinguishes "truly empty" from "contains only comments" so the report points at the exact AI pattern.
Behavior
- Fixable: No.
- Suggestions: No.
Examples
Bad:
try { doThing(); } catch (e) { /* TODO */ }Good:
try { doThing(); } catch (e) { logger.error({ err: e }, 'doThing failed'); throw e; }Related rules
no-leaked-stack-traceForbid HTTP responses that include a stack trace or the raw caught-exception object.no-floating-promise-handlerRequire try/catch (or an async wrapper) on async Express/Fastify route handlers.no-prod-consoleForbid `console.log`/`debug`/`info`/`dir`/`trace`/`table`/`time*` in production source.
Use it
Enable no-empty-catch in your eslint.config.js:
import deslint from '@deslint/eslint-plugin';
export default [
{
plugins: { deslint },
rules: {
'deslint/no-empty-catch': 'error',
},
},
];Found a false positive? Report it on GitHub →