Error handling anti-pattern detector for TypeScript projects. Finds silent failures, empty catches, and debugging nightmares before they cost you 10 hours.
| Pattern | Description |
|---|---|
EMPTY_CATCH |
Empty catch blocks that silently swallow errors |
NO_LOGGING_IN_CATCH |
Catch blocks with no logging, stderr, or rethrow |
LARGE_TRY_BLOCK |
Try blocks over 10 significant lines (too broad) |
GENERIC_CATCH |
Catch blocks with no error type discrimination |
PARTIAL_ERROR_LOGGING |
Logging error.message instead of the full error object |
ERROR_STRING_MATCHING |
Using .includes() on error messages to detect error types |
ERROR_MESSAGE_GUESSING |
Multiple string checks to guess what went wrong |
PROMISE_EMPTY_CATCH |
.catch(() => {}) - errors vanish into the void |
PROMISE_CATCH_NO_LOGGING |
Promise .catch() handlers that don't log |
CATCH_AND_CONTINUE_CRITICAL_PATH |
Critical path code that logs-and-continues after errors |
Requires Bun runtime.
bun add -d antipattern-czar# Scan src/ with default settings
bunx antipattern-czar
# Scan a different directory
bunx antipattern-czar --src lib
# Use a custom config file
bunx antipattern-czar --config my-config.jsonCreate .antipatternrc.json in your project root:
{
"srcDir": "src",
"criticalPaths": ["DatabaseService.ts", "AuthHandler.ts"],
"skipDirectories": ["node_modules", "dist", ".git"]
}| Field | Default | Description |
|---|---|---|
srcDir |
"src" |
Directory to scan |
criticalPaths |
[] |
Files where catch-and-continue is banned |
skipDirectories |
["node_modules", "dist", ".git"] |
Directories to skip |
Files in criticalPaths get stricter enforcement. Errors on critical paths must be visible (logged) or fatal (thrown). Catch-and-continue is banned.
Suppress a detection with a comment explaining why:
try {
checkIfProcessAlive(pid);
} catch (error) {
// [ANTI-PATTERN IGNORED]: Tight loop checking 100s of PIDs during cleanup
return false;
}Overrides show as APPROVED_OVERRIDE in the report instead of ISSUE.
This repo includes a Claude Code slash command at .claude/commands/anti-pattern-czar.md. Copy it to your project's .claude/commands/ to get an interactive /anti-pattern-czar skill that walks you through fixing each detection.
0- No issues found (overrides are fine)1- Issues found that need fixing
MIT