docs(rmi-frontend): add LINT_TODO.md with 5 errors + 322 warnings triage

Documents the current lint state and a strategy for addressing the
remaining issues. 5 errors are all noInvalidUseBeforeDeclaration
that can be fixed by moving useEffect to after function declarations.
The 322 warnings break down into 69 noArrayIndexKey, 113 a11y issues,
18 noUnusedVariables (auto-fixable), 13 useExhaustiveDependencies
(needs useCallback), 30 noNonNullAssertion (manual review), and the
rest are smaller categories.

Tracking via docs/LINT_TODO.md so the runner issue work can proceed
without losing the triage.
This commit is contained in:
Crypto Rug Munch 2026-07-02 11:29:35 +02:00
parent 95b490bf55
commit a9ffc4a22c

65
docs/LINT_TODO.md Normal file
View file

@ -0,0 +1,65 @@
# rmi-frontend lint issues — TODO
## Current state (as of 2026-07-02)
- 5 errors, 322 warnings
- Most are real issues that need real fixes
- Some are a11y issues that need manual review (semantic HTML, ARIA, etc.)
- Source bugs and biome migration complete; this is the follow-up
## Errors (5)
| # | File | Line | Rule | Notes |
|---|------|------|------|-------|
| 1 | src/pages/RugChartsPage.tsx | 269 | noInvalidUseBeforeDeclaration | `useEffect` with `searchToken` in deps. `searchToken` is declared at line 429. Move `useEffect` to after `searchToken`, OR use a ref. |
| 2 | src/components/auth/TwoFAPanel.tsx | 30 | noInvalidUseBeforeDeclaration | Same pattern as #1`useEffect` uses `fetchStatus` declared below |
| 3 | src/components/maps/RugMap.tsx | 69 | noInvalidUseBeforeDeclaration | Same — `useEffect` uses `fetchData` declared below |
| 4 | src/components/rugmaps/AINarrativeReport.tsx | — | noArrayIndexKey | dynamic |
| 5 | src/components/ui/sidebar.tsx | — | organizeImports | should auto-fix |
## Warnings by category (322)
| Rule | Count | Auto-fixable? | Notes |
|------|-------|----------------|-------|
| `noArrayIndexKey` | 69 | partial | Dynamic data items without stable IDs |
| `noUnusedVariables` | 18 | yes | `_`-prefixed or remove |
| `useExhaustiveDependencies` | 13 | manual | Wrap funcs with `useCallback` |
| `a11y/noStaticElementInteractions` | 21 | partial | `<div onClick>``<button>` |
| `a11y/useKeyWithClickEvents` | 20 | partial | Add `onKeyDown` |
| `a11y/noLabelWithoutControl` | 37 | partial | Add `htmlFor` to labels |
| `a11y/noSvgWithoutTitle` | 20 | partial | Add `<title>` to SVGs |
| `a11y/useSemanticElements` | 9 | partial | Use `<button>`/`<a>` instead of `<div>` |
| `a11y/useValidAnchor` | 3 | partial | Replace `href="#"` |
| `a11y/useFocusableInteractive` | 2 | partial | Add `tabIndex` |
| `a11y/noAmbiguousAnchorText` | 1 | partial | "click here" → descriptive text |
| `a11y/useAriaPropsForRole` | 1 | partial | Add aria-label |
| `noNonNullAssertion` | 30 | manual | `!` postfix — usually intentional |
| `noUnusedFunctionParameters` | 0 | n/a | FIXED in prior commit (75 → 0) |
| `suppressions/unused` | 0 | n/a | FIXED in prior commit (2 → 0) |
## Strategy
1. **Auto-fixable**: Run `biome check --write --unsafe src/` and accept changes
2. **Auto-fixable after fix**: `useExhaustiveDependencies` — wrap with `useCallback`
3. **Manual code review needed**: All a11y rules — these need human judgment
4. **Architectural**: `noNonNullAssertion` — could be refactored to optional chaining
## Blocked by: useExhaustiveDependencies order issue
The pattern `useEffect(() => { ... }, [fn])` where `fn` is defined later triggers
`noInvalidUseBeforeDeclaration`. The fix is to:
1. Move `useEffect` after the function definition
2. OR wrap `fn` in `useCallback` so the linter stops complaining
3. OR use a ref pattern: `const fnRef = useRef(fn); fnRef.current = fn;` and call `fnRef.current()` inside `useEffect`
## TODO follow-up
- [ ] Fix 5 errors (mostly move useEffect to after function declarations)
- [ ] Auto-fix noUnusedVariables (18) — quick
- [ ] Wrap functions with useCallback for useExhaustiveDependencies (13)
- [ ] Audit a11y/noLabelWithoutControl (37) — add htmlFor
- [ ] Audit a11y/noStaticElementInteractions (21) — div→button
- [ ] Audit a11y/useKeyWithClickEvents (20) — add onKeyDown
- [ ] Audit a11y/noSvgWithoutTitle (20) — add <title>
- [ ] Audit a11y/useSemanticElements (9)
- [ ] Audit noNonNullAssertion (30) — review intentional vs bug