Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

feat(errors): replace silent-catch ratchet with a biome lint rule - #1487

Merged
BYK merged 2 commits into
mainfrom
issue-1472-silent-catch-biome-rule
Aug 26, 2026
Merged

BYK merged 2 commits into
mainfrom
issue-1472-silent-catch-biome-rule

Conversation

@jared-outpost

@jared-outpost jared-outpost Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Converts the hand-rolled silent-catch detector + ratchet baseline JSON into a Biome GritQL plugin (lint-rules/no-silent-catch.grit), grandfathering the 197 pre-existing sites with inline // biome-ignore lint/plugin comments instead of a baseline file. The ratchet is preserved: a new silent catch is a plugin error, and removing a grandfathered catch orphans its suppression (suppressions/unused) — pnpm run lint now runs --error-on-warnings so both fail CI, and the backlog can only shrink.

The old check-error-patterns.ts keeps its ContextError / CliError "Try:" checks; only the silent-catch machinery and silent-catch-baseline.json are removed.

Testing

  • pnpm run lint (with --error-on-warnings): clean
  • pnpm run check:errors: clean
  • vitest run test/script/check-error-patterns.test.ts test/script/no-silent-catch.test.ts: 12 passing
  • verified the ratchet-down path: fixing a grandfathered catch while keeping its comment fails lint via suppressions/unused

Closes #1472

@vercel

vercel Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cli Ready Ready Preview Aug 26, 2026 1:55pm

Request Review

@jared-outpost
jared-outpost Bot marked this pull request as ready for review August 26, 2026 12:32
@jared-outpost
jared-outpost Bot requested a review from BYK August 26, 2026 12:32
Comment thread packages/cli/biome.jsonc Resolved
@BYK

BYK commented Aug 26, 2026

Copy link
Copy Markdown
Member

The old check-error-patterns.ts keeps its ContextError / CliError "Try:" checks; only the silent-catch machinery and silent-catch-baseline.json are removed.

Is it not possible to completely replace check-error-patterns.ts script?

Per BYK review feedback on #1487, add the six
patterns (and the matching  variants) so a silent catch followed by a
 is still caught.

The current tree still has zero silent  sites, so the 197
grandfathered suppressions remain valid and lint stays clean.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d3fd85c. Configure here.

GritQL type-annotation metavariables don't bind, so the untyped
`catch ($e)` patterns missed `catch (e: unknown)` / `catch (e: any)`.
TypeScript only permits unknown or any as a catch binding type, so add
literal variants for both across the empty / return / return-value forms,
with and without finally. The error-forwarding guard is preserved.
@BYK
BYK merged commit 0a1ec87 into main Aug 26, 2026
31 checks passed
@BYK
BYK deleted the issue-1472-silent-catch-biome-rule branch August 26, 2026 15:10

This branch was successfully deployed

1 active deployment
Preview — 827c5da4 Deployed Aug 26, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(errors): convert silent-catch ratchet to biome lint rule

1 participant