Description
Raw lazyCaptureException from @/lib/capture bypasses error classification, causing transient Supabase errors to be reported at error level in Sentry. This has been the root cause of 13 bugs over the past 3 weeks. Issue #913 fixes the existing 21 call sites, but without a lint rule, new code will continue to use the raw function.
Adding a no-restricted-imports ESLint rule that blocks direct imports of lazyCaptureException from @/lib/capture (with an exception for src/lib/sentry.ts which re-exports it) will catch this at lint time.
Acceptance Criteria
Dependencies
Depends on #913 (replace existing raw calls first, then add the lint rule)
Technical Notes
- Use ESLint's built-in
no-restricted-imports rule with paths config:
{
files: ["src/**/*.ts", "src/**/*.tsx"],
ignorePatterns: ["src/lib/sentry.ts", "src/lib/capture.ts", "src/app/global-error.tsx", "src/components/route-error.tsx"],
rules: {
"no-restricted-imports": ["error", {
paths: [{
name: "@/lib/capture",
importNames: ["lazyCaptureException"],
message: "Use captureSupabaseError or captureApiError from @/lib/sentry instead. Raw lazyCaptureException bypasses error classification."
}]
}]
}
}
- The exact ESLint flat config syntax may differ — adapt to the project's
eslint.config.mjs format.
- Reference
.agents/conventions.md for error handling patterns.
Description
Raw
lazyCaptureExceptionfrom@/lib/capturebypasses error classification, causing transient Supabase errors to be reported aterrorlevel in Sentry. This has been the root cause of 13 bugs over the past 3 weeks. Issue #913 fixes the existing 21 call sites, but without a lint rule, new code will continue to use the raw function.Adding a
no-restricted-importsESLint rule that blocks direct imports oflazyCaptureExceptionfrom@/lib/capture(with an exception forsrc/lib/sentry.tswhich re-exports it) will catch this at lint time.Acceptance Criteria
eslint.config.mjsincludes ano-restricted-importsrule that flags imports oflazyCaptureExceptionfrom@/lib/capturewith a message directing developers to usecaptureSupabaseErrororcaptureApiErrorfrom@/lib/sentryinsteadsrc/lib/sentry.tsandsrc/lib/capture.tsto import/exportlazyCaptureException(these are the classification wrappers)src/app/global-error.tsxandsrc/components/route-error.tsxto use raw capture (React error boundaries)pnpm lintpasses after fix: replace raw lazyCaptureException with captureSupabaseError in 10 component files #913 is merged (no violations in production code)pnpm lint && pnpm typecheck && pnpm testpassDependencies
Depends on #913 (replace existing raw calls first, then add the lint rule)
Technical Notes
no-restricted-importsrule withpathsconfig:eslint.config.mjsformat..agents/conventions.mdfor error handling patterns.