{{ theme.skipToContentLabel || 'Skip to content' }}

Remove ESLint Disable Comments and as any Type Casts

Date: 2026-02-18 Command: pnpm lint / pnpm lint:fix

Summary

Removed widespread eslint-disable comments and (supabase as any) type casts across the codebase. After regenerating Supabase types (supabaseTypes.ts), the typed Supabase client now recognizes all tables, making as any workarounds unnecessary.

Issues Found

1. File-level eslint-disable blocks (removed)

Blanket disable comments suppressing multiple TypeScript rules:

typescript
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-argument */

Files affected:

  • src/features/assets/services/assetsService.ts
  • src/features/flow-meter/services/databaseService.ts
  • src/features/flow-meter/services/flowMeterExportService.ts
  • src/features/flow-meter/services/tankAlertService.ts
  • src/features/flow-meter/services/tankService.ts
  • src/features/tank-alerts/components/SendEmailModal.tsx
  • src/features/tank-alerts/services/tankAlertManagementService.ts
  • src/features/user-management/services/groupManagementService.ts
  • src/features/user-management/services/permissionService.ts
  • src/features/user-management/services/userManagementService.ts

2. Inline eslint-disable-next-line + (supabase as any) (removed)

Over 40 instances of:

typescript
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { data, error } = await (supabase as any).from("table_name")...

Replaced with direct typed calls:

typescript
const { data, error } = await supabase.from("table_name")...

Files affected: Same as above, plus:

  • src/features/flow-meter/services/databaseService.ts (calibration queries)

3. no-constant-binary-expression — dead code cleanup

File: src/app/(admin)/(pages)/flow-meter/index.tsx

Changed {false && (<JSX>)} pattern (which triggered eslint-disable-next-line no-constant-binary-expression) to a proper JSX comment block {/* ... */} for the hidden Overview Stats section.

4. Unnecessary async on non-awaiting functions

Removed async keyword from functions that return a Promise but don't use await:

Files affected:

  • src/features/dust-levels/services/compareExportService.tsloadImageAsBase64
  • src/features/dust-levels/services/exportService.tsexportReport
  • src/features/dust-ranger/services/dustRangerExportService.tsexportReport
  • src/features/email-schedules/services/variableTemplateService.tsgetAvailableVariables
  • src/features/exports/services/basePdfExportService.tsloadImageAsBase64
  • src/features/exports/services/chartCapture.tscaptureChartElement, waitForChartRender
  • src/features/flow-meter/services/flowMeterPdfExportService.tsexportReport
  • src/features/reports/hooks/useReportGenerator.tsxgeneratePDFFromTemplate
  • src/features/reports/services/pdfGenerationService.tsloadImageAsBase64
  • src/features/upload/services/csvParser.tsparseFile
  • src/features/upload/services/csvValidator.tsparseCSV
  • src/features/weekly-reports/hooks/useWeeklyReportAutoSave.tssaveNow
  • src/features/weekly-reports/services/weeklyReportService.tsmarkAsCompleted

5. Outdated comments removed

Removed stale comments referencing "tables that may not yet exist in generated types" since types have been regenerated:

  • src/features/user-management/services/groupManagementService.ts
  • src/features/user-management/services/permissionService.ts
  • src/features/user-management/services/userManagementService.ts

6. Component/import rename to avoid shadowing

  • src/components/layouts/SideNav/Sidebar.tsx — Renamed Map import to MapIcon to avoid shadowing the global Map constructor
  • src/app/(admin)/(dashboards)/index/components/CalibrationReminder.tsx — Renamed default export from CalibrationReminder to CalibrationReminderPanel (component name vs filename mismatch)

Root Cause

The Supabase TypeScript types (supabaseTypes.ts) were outdated and didn't include newer tables (user_groups, user_group_members, group_module_permissions, group_site_permissions, tank_level_alerts, ops_tank_corrections, cfg_tank_capacities, data_assets, etc.). Developers used (supabase as any) as a workaround, which required blanket ESLint disables. Regenerating types resolved the root issue.

Changes Made

  • Removed ~15 file-level eslint-disable blocks
  • Removed ~45 inline eslint-disable-next-line comments
  • Replaced ~45 (supabase as any) casts with direct supabase calls
  • Removed async from ~13 functions that don't await
  • Cleaned up dead code pattern in flow-meter page
  • Renamed shadowed imports/exports
  • Regenerated src/lib/supabaseTypes.ts (816 lines changed, net -468 lines)