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

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 →

Back to all rules