Skip to content

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

feat(errors): replace silent-catch ratchet with a biome lint rule#1487
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
@github-actions github-actions Bot added the risk: high PR risk score: high label Aug 26, 2026
Comment thread packages/cli/biome.jsonc Outdated
Comment thread packages/cli/lint-rules/no-silent-catch.grit
@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.
@jared-outpost
jared-outpost Bot force-pushed the issue-1472-silent-catch-biome-rule branch from 88d1186 to d3fd85c Compare August 26, 2026 12:51
@github-actions github-actions Bot added risk: low PR risk score: low and removed risk: high PR risk score: high labels Aug 26, 2026
Comment thread packages/cli/lint-rules/no-silent-catch.grit

@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.

Comment thread packages/cli/lint-rules/no-silent-catch.grit
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.
Comment thread packages/cli/lint-rules/no-silent-catch.grit
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

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