Skip to content

chore: add ESLint no-restricted-imports rule for lazyCaptureException (#914)#922

Merged
sw-factory-automations merged 1 commit into
mainfrom
feat/914-eslint-no-restricted-imports-lazycapture
May 7, 2026
Merged

chore: add ESLint no-restricted-imports rule for lazyCaptureException (#914)#922
sw-factory-automations merged 1 commit into
mainfrom
feat/914-eslint-no-restricted-imports-lazycapture

Conversation

@sw-factory-automations
Copy link
Copy Markdown
Collaborator

Closes #914

What

Adds an ESLint no-restricted-imports rule that prevents direct imports of lazyCaptureException from @/lib/capture. This forces developers to use the classified wrappers (captureSupabaseError, captureApiError) from @/lib/sentry, preventing transient Supabase errors from being reported at error level in Sentry.

How

  • Added a no-restricted-imports rule in eslint.config.mjs scoped to src/**/*.ts and src/**/*.tsx
  • Exempted the 4 files that legitimately need direct access: src/lib/sentry.ts, src/lib/capture.ts, src/app/global-error.tsx, src/components/route-error.tsx
  • Migrated 5 production files that still imported lazyCaptureException from @/lib/capture to import from @/lib/sentry instead (these were missed by fix: replace raw lazyCaptureException with captureSupabaseError in 10 component files #913)
  • Updated 3 test files to mock @/lib/sentry instead of @/lib/capture for lazyCaptureException

Testing

  • pnpm lint — 0 errors (rule active, no violations)
  • pnpm typecheck — passes
  • pnpm test — 130 files, 1766 tests passed

…#914)

- Add no-restricted-imports rule to eslint.config.mjs blocking direct
  imports of lazyCaptureException from @/lib/capture
- Exempt src/lib/sentry.ts, src/lib/capture.ts, src/app/global-error.tsx,
  and src/components/route-error.tsx (classification wrappers and error
  boundaries)
- Migrate 5 remaining production files to import lazyCaptureException
  from @/lib/sentry instead of @/lib/capture
- Update 3 test mocks to match new import paths

Co-authored-by: Ona <no-reply@ona.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

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

Project Deployment Actions Updated (UTC)
memo Ready Ready Preview, Comment May 7, 2026 6:09am

Request Review

@sw-factory-automations sw-factory-automations merged commit a73b37e into main May 7, 2026
6 checks passed
@sw-factory-automations sw-factory-automations deleted the feat/914-eslint-no-restricted-imports-lazycapture branch May 7, 2026 06:16
@sw-factory-automations
Copy link
Copy Markdown
Collaborator Author

✅ Post-merge verification skipped — chore: PR does not affect the live app.

@sw-factory-automations
Copy link
Copy Markdown
Collaborator Author

✅ UI verification passed — no visual changes detected.

All src/components/* file changes are import-path-only (moving lazyCaptureException from @/lib/capture to @/lib/sentry). No rendering logic, styles, class names, or component structure was modified. Visual verification skipped as there is no UI impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: add ESLint no-restricted-imports rule to prevent raw lazyCaptureException usage

1 participant