Skip to content

Resolve high npm audit advisories: next 14→16 + eslint 8→9 (flat config) - #10

Merged
Seby2005 merged 3 commits into
devfrom
claude/elastic-haslett-35bab2
Aug 7, 2026
Merged

Resolve high npm audit advisories: next 14→16 + eslint 8→9 (flat config)#10
Seby2005 merged 3 commits into
devfrom
claude/elastic-haslett-35bab2

Conversation

@Seby2005

@Seby2005 Seby2005 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Descriere

Rezolvă definitiv toate avertismentele high din npm audit --audit-level=high, care erau marcate ca „informational, non-blocking" în .github/workflows/ci.yml. Cele high veneau exclusiv din dependențe tranzitive ale next 14 și eslint 8, remediabile doar printr-un upgrade major (amânat deliberat până acum). npm audit raportează acum 0 vulnerabilități, iar gate-ul de audit high din CI blochează din nou (s-a scos continue-on-error).

React rămâne pe 18.3.1 (Next 16 încă îl suportă), deci nu a fost nevoie de migrare la React 19; nicio altă dependență nu s-a mișcat (@sentry/nextjs 10.69 declară deja suport pentru Next 16).

Tip modificare

  • feat — Funcționalitate nouă
  • fix — Corectare bug
  • docs — Documentație
  • test — Adăugare/modificare teste
  • refactor — Refactorizare cod (fără schimbare funcționalitate)
  • chore — Actualizare dependențe, configurări

Task asociat

N/A

Modificări făcute

  • Dependențe: next 14.2.29 → 16.3.0, eslint 8 → 9, eslint-config-next16.
  • Migrare API async (Next 15/16): createClient() (supabase/server) devine async — await cookies(); toate call-site-urile server actualizate cu await. params tipat ca Promise și await-uit în cele 5 rute dinamice + pagina de raport [id].
  • api/ocr: req.ip (eliminat în Next 15) → x-forwarded-for / x-real-ip.
  • next.config.mjs: eliminat experimental.instrumentationHook (stabil din Next 15).
  • ESLint flat config: next lint a fost eliminat în Next 16 → șters .eslintrc.json, adăugat eslint.config.mjs, lint = eslint .. Rezolvat și avertismentul tranzitiv glob (command injection) prin bump-ul eslint-config-next.
  • middleware.tsproxy.ts: Next 16 a redenumit convenția (middleware()proxy()); avertismentul de deprecare a dispărut.
  • layout.tsx: suppressHydrationWarning pe <html> pentru scriptul de temă care setează data-theme înainte de hidratare.
  • CI: gate-ul de audit high blochează din nou (scos continue-on-error; pasul critical separat, acum redundant, a fost consolidat).

Screenshot-uri

N/A — fără schimbări UI.

Checklist

  • Funcționalitatea descrisă este complet implementată
  • Niciun TODO, FIXME, console.log sau placeholder rămas
  • Tipuri TypeScript corecte (fără any) — npm run type-check trece
  • Teste unitare scrise și trec (npm test) — 340/340, prag de acoperire respectat
  • npm run build trece fără erori
  • npm run lint trece fără erori — 0 erori / 0 warnings
  • Stilurile sunt responsive (mobile + tablet + desktop) — N/A, fără schimbări de stil
  • Error states implementate — N/A, fără UI nou
  • Loading states implementate — N/A, fără UI nou
  • Accesibilitate: labels, alt text, focus states — N/A, fără UI nou

⚠️ Deschiderea acestui PR declanșează preview deploy-ul pe Vercel — testează fluxul de auth Supabase (login / OAuth callback / paginile de raport) acolo, cu env real, înainte de merge în dev.

ℹ️ Rămâne un singur avertisment (non-blocking) la build: deprecarea disableLogger din @sentry/nextjs (preexistentă, independentă de acest upgrade; înlocuitorul nu e suportat cu Turbopack). Nu blochează build-ul sau deploy-ul.

🤖 Generated with Claude Code

Seby2005 and others added 2 commits August 7, 2026 15:39
…upgrade

Bumps next 14.2.29→16.3.0 and eslint 8→9 with eslint-config-next 16,
clearing every high-severity advisory (next, transitive postcss, and the
transitive glob command-injection via @next/eslint-plugin-next). `npm audit`
now reports 0 vulnerabilities. React stays on 18.3.1 — Next 16 still supports
it — and no other deps moved (Sentry 10.69 already declares Next 16 support).

Next 15/16 async migration:
- createClient() (supabase/server) is now async (await cookies()); all
  server call sites updated to await it
- params typed as Promise and awaited in the 5 dynamic routes + [id] report page
- api/ocr: req.ip (removed in Next 15) -> x-forwarded-for/x-real-ip pattern
- drop obsolete experimental.instrumentationHook from next.config.mjs

ESLint flat config (next lint was removed in Next 16):
- delete .eslintrc.json, add eslint.config.mjs, lint script -> `eslint .`
- new eslint-plugin-react-hooks@7 rules (set-state-in-effect, refs) kept as
  warnings rather than refactoring working components in a security patch
- lint scope matched to the old `next lint` (excludes tests/scripts/scratch,
  which run in their own runtimes)

CI: restore the high audit gate as blocking (remove continue-on-error),
subsuming the now-redundant separate critical step.

tsconfig.json (jsx: react-jsx) and next-env.d.ts changes are Next 16
auto-reconfiguration.

Verified locally: type-check, lint (0 errors), test:coverage (340 tests),
and next build all pass; dev smoke test confirms pages render and the async
dynamic route resolves correctly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eme hydration

Follow-up to the next 14->16 / eslint 8->9 upgrade so the tree is deploy-clean
(npm run lint is now 0 errors / 0 warnings).

- react-hooks/set-state-in-effect (new in eslint-plugin-react-hooks@7): disabled
  in eslint.config.mjs with rationale. Every flagged site is the app's
  intentional SSR-safe pattern — render a server-safe default, then sync a
  client-only value (matchMedia / cookie / data-theme / session) after mount to
  avoid a hydration mismatch — so the components are left untouched.
- react-hooks/refs (useTypedPlaceholder): move the ref write out of render into
  an effect; behavior preserved (content-keyed effect still reads the latest
  examples without restarting the animation).
- no-location-assign-relative-destination (auth-utils signOut, AuthPanel account
  deletion): scoped eslint-disable — the full-page reload is deliberate, to tear
  down all client + Supabase state, not a missed router navigation.
- layout: suppressHydrationWarning on <html> — the head THEME_SCRIPT sets
  data-theme before hydration by design, so that attribute legitimately differs
  between server and client. Clears the dev hydration-mismatch console error.
- middleware.ts -> proxy.ts: Next 16 renamed the file convention and the export
  (middleware() -> proxy()); the deprecation warning is gone from dev/build.

Verified: type-check, lint (0/0), test:coverage (340 tests), next build, and a
dev smoke test (pages render, dynamic route resolves, hydration error gone).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
verifact Ready Ready Preview Aug 7, 2026 1:16pm

@Seby2005 Seby2005 changed the title Claude/elastic haslett 35bab2 Resolve high npm audit advisories: next 14→16 + eslint 8→9 (flat config) Aug 7, 2026
CI injects the external-provider API keys (GOOGLE_*, GEMINI, TAVILY, NEWS) as
"placeholder" at the job level for the build step. Three provider tests —
layer2-news, layer3-official, vision — assert the "not configured" behavior and
so relied on those keys being ABSENT, as they are locally. That made them fail
only in CI; test-and-lint was already red on dev before this branch for the same
reason.

Add a jest setupFiles script (jest.setup.env.cjs) that clears those provider
keys before each test file, giving a deterministic "not configured" baseline
that matches local runs. Tests that need a key set it explicitly. Runs the jest
process only — the build step keeps the workflow env.

Verified with the full CI env applied: 340/340 tests pass, coverage gate met;
type-check and lint remain clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Seby2005
Seby2005 merged commit d7897f1 into dev Aug 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant