feat(deps): Next 15 → 16 (proxy.ts rename + native flat ESLint config)

Applied @next/codemod migrations:
- middleware-to-proxy: src/middleware.ts → src/proxy.ts + function rename
- remove-experimental-ppr: no hits
- remove-unstable-prefix: no hits

tsconfig.json picked up Next 16's autofixes:
- jsx: 'preserve' → 'react-jsx'
- include .next/dev/types/**/*.ts (dev-mode route types)
- next-env.d.ts: triple-slash reference → ES import (TS 6 / Next 16 style)

eslint-config-next@16 ships a native flat config, so dropped the
@eslint/eslintrc + FlatCompat shim. eslint.config.mjs now imports
eslint-config-next/core-web-vitals + eslint-config-prettier/flat
directly.

Note on ESLint 10: bumped + reverted. eslint-config-next@16 still
has a transitive eslint-plugin-react@7 that uses the eslint-9
context API (getFilename on context); breaks under eslint 10.
Audit anticipated lockstep — but the transitive isn't ready yet.
Holding at eslint 9.x until upstream lands. Tracked in BACKLOG.

React Compiler safety rules (react-hooks v7) shipped with config-
next 16 surfaced ~89 legitimate findings (set-state-in-effect,
ref-during-render, immutability). Demoted the new rules to `warn`
so the codebase isn't blocked; triage tracked in BACKLOG §G.

Verified: tsc 0 errors, eslint 0 errors / 105 warnings (89 new
Compiler-rule warns + 16 pre-existing), next build clean, custom
server build clean, vitest 1315/1315.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 22:24:51 +02:00
parent 0ab96d74a8
commit 4879b17cff
7 changed files with 383 additions and 166 deletions

View File

@@ -148,6 +148,22 @@ What's done (2026-05-12 session — all phases shipped):
-**Tier 2 polish** — surveyed each candidate. `fast-deep-equal` not needed (existing memo comparators work). `use-debounce` package adds no value over the in-tree 13-LOC hook. `@use-gesture/react`, `embla-carousel-react`, `yet-another-react-lightbox`, `react-resizable-panels` all need concrete UX surfaces or product decisions before wiring — added them to the parked list.
-**Pre-commit staged type-check**`scripts/tsc-staged.mjs` (30-LOC shim) replaces the broken `tsc-files` package (which silently no-ops under pnpm). Pre-commit now runs `tsc -p <temp-config>` against staged ts/tsx in ~3s vs ~22s full-project; type errors caught before they hit CI.
**React Compiler safety triage (post-Next-16 bump, ~89 new warnings):**
The Next 15 → 16 upgrade brought `react-hooks` v7 with React Compiler safety rules. They surfaced ~89 legitimate findings in the existing
codebase — categorised:
- `react-hooks/set-state-in-effect` (~49) — `setState` directly inside `useEffect`. Sometimes intentional (post-fetch hydration), sometimes a missed `useState` initialiser or derived-state opportunity.
- `react-hooks/incompatible-library` (~13) — React Compiler skipped a file because it imports a not-yet-Compiler-safe lib (commonly Zustand, dnd-kit, certain TanStack hooks). No action needed unless we want Compiler to run on that file.
- `react-hooks/refs` (~10) — `ref.current` read during render. Always a real bug if it influences the render output; fine if it's just for next-effect's stash.
- `react-hooks/immutability` (~7) — mutation of supposedly-immutable values (props, state).
- `react-hooks/set-state-in-render` (~5) — `setState` called during the render body, not from a handler/effect.
- `react-hooks/purity` (~2) — non-pure call during render.
All demoted to `warn` in `eslint.config.mjs` so the dep upgrade isn't gated on cleanup. **Triage as its own pass — ~3060 min per category. Promote back to `error` once the bucket reaches zero.** Don't blanket-ignore: each warning either points at a real Compiler-incompatibility or a latent re-render bug.
---
Remaining (opportunistic, no concrete trigger):
| Item | Estimate | Notes |