Skip to content

Upgrade eslint-plugin-react-hooks to v7 — 30 lint errors to fix #26

@EVWorth

Description

@EVWorth

$## Context\n\nPR #23 (dependabot) attempted to upgrade eslint-plugin-react-hooks from 4.6.2 to 7.1.1, but the new version introduces strict set-state-in-effect and purity rules that flag 30 occurrences across the codebase.\n\nThese are valid improvements from the React team.\n\n## Required Fixes\n\n### 1. set-state-in-effect (28 errors)\n\nMove setLoading(true) calls from inside useEffect into the async functions themselves.\n\nAffected files:\n\n- AdminPanel.tsx — Lines 94, 291, 583\n- UserManagement.tsx — Lines 102, 423, 647\n- TableStructure.tsx — Line 29\n\nFix pattern:\n\ntsx\n// BEFORE\nuseEffect(() => {\n setLoading(true);\n fetchData();\n}, []);\n\n// AFTER\nuseEffect(() => {\n fetchData();\n}, []);\n\n// And inside async function:\nconst fetchData = async () => {\n setLoading(true);\n try { ... } finally { setLoading(false); }\n};\n\n\n### 2. purity (1 error)\n\n- RoutineViewer.tsx — Line 108: performance.now() inside component body\n\n## Acceptance Criteria\n\n- [ ] All 30 set-state-in-effect fixed\n- [ ] purity error in RoutineViewer.tsx fixed\n- [ ] npm run lint passes with zero errors\n- [ ] All tests still pass\n- [ ] eslint-plugin-react-hooks updated to v7.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions