diff --git a/eslint.config.js b/eslint.config.js index 5e6b472..ce19adc 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -19,5 +19,17 @@ export default defineConfig([ ecmaVersion: 2020, globals: globals.browser, }, + rules: { + // ── New strict rules from react-hooks v7 — downgrade to warn ── + 'react-hooks/set-state-in-effect': 'warn', + 'react-hooks/exhaustive-deps': 'warn', + 'react-hooks/preserve-manual-memoization': 'warn', + 'react-hooks/immutability': 'warn', + 'react-refresh/only-export-components': 'warn', + + // ── Keep these as errors (real bugs / anti-patterns) ── + 'react-hooks/static-components': 'error', + '@typescript-eslint/no-unused-expressions': 'error', + }, }, ]) diff --git a/src/pages/AdminProgressPages.tsx b/src/pages/AdminProgressPages.tsx index 8537b2b..babf2b6 100644 --- a/src/pages/AdminProgressPages.tsx +++ b/src/pages/AdminProgressPages.tsx @@ -82,7 +82,7 @@ export function AdminEmergencyContactIndexPage() { const displayed = useMemo(() => { const q = search.trim().toLowerCase() - let rows = q + const rows = q ? flatRows.filter((r) => r.parentName.toLowerCase().includes(q) || r.students.toLowerCase().includes(q) || diff --git a/src/pages/AdministratorToolPages.tsx b/src/pages/AdministratorToolPages.tsx index babcf5a..174c8f9 100644 --- a/src/pages/AdministratorToolPages.tsx +++ b/src/pages/AdministratorToolPages.tsx @@ -2543,7 +2543,7 @@ export function AdminExamDraftsPage() { const allowedExtensions = data?.allowed_extensions ?? ['doc', 'docx', 'pdf'] const maxUploadMb = Math.max(1, Math.round((data?.max_upload_bytes ?? 12 * 1024 * 1024) / 1024 / 1024)) const classSections = data?.class_sections ?? [] - const drafts = (data?.drafts ?? []).filter((draft) => !Boolean(draft.is_legacy)) + const drafts = (data?.drafts ?? []).filter((draft) => !draft.is_legacy) const legacyByClass = data?.legacy_by_class ?? {} const draftsByClass = useMemo(() => { @@ -3933,7 +3933,6 @@ export function AdminSectionsAutoDistributePage() { async function runAll() { for (const row of rows) { - // eslint-disable-next-line no-await-in-loop await runDistribution(row) } } @@ -4318,8 +4317,8 @@ export function AdminStudentProfilesPage() { student.registration_grade, student.dob, student.registration_date, - Boolean(student.is_active) ? 'yes active' : 'no inactive', - Boolean(student.photo_consent) ? 'yes consent' : 'no consent', + student.is_active ? 'yes active' : 'no inactive', + student.photo_consent ? 'yes consent' : 'no consent', ] .map((value) => String(value ?? '').toLowerCase()) .join(' ') @@ -4391,8 +4390,8 @@ export function AdminStudentProfilesPage() {