Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

fix: upgrade Next.js 16.2.11 + migrate ESLint + fix 9 lint errors - #95

Draft
caimanoliveira wants to merge 7 commits into
mainfrom
claude/kind-keller-53114h
Draft

fix: upgrade Next.js 16.2.11 + migrate ESLint + fix 9 lint errors#95
caimanoliveira wants to merge 7 commits into
mainfrom
claude/kind-keller-53114h

Conversation

@caimanoliveira

Copy link
Copy Markdown
Owner

Resumo da análise (últimas 24h)

Nenhum commit novo nas últimas 24h (último foi em 2026-04-18). Porém a análise de saúde do codebase encontrou problemas de segurança e lint que foram corrigidos neste PR.


Segurança — Next.js 16.2.0 → 16.2.11

A versão 16.2.0 continha 20+ CVEs de severidade alta:

Categoria CVEs
Middleware/Proxy bypass GHSA-267c-6grr-h53f, GHSA-492v-c6pp-mqqv, GHSA-26hh-7cqf-hhc6, GHSA-36qx-fr4f-26g5, GHSA-6gpp-xcg3-4w24
Cache poisoning GHSA-3g8h-86w9-wvmq, GHSA-wfc6-r584-vfw7, GHSA-vfv6-92ff-j949, GHSA-68g3-v927-f742, GHSA-4633-3j49-mh5q
XSS GHSA-ffhc-5mcf-pf4q, GHSA-gx5p-jg67-6x7h, GHSA-qx2v-qp2m-jg93
SSRF GHSA-c4j6-fc7j-m34r, GHSA-89xv-2m56-2m9x, GHSA-p9j2-gv94-2wf4
DoS GHSA-q4gf-8mx6-v5v3, GHSA-8h8q-6873-q5fj, GHSA-mg66-mrh9-m8jx, GHSA-m99w-x7hq-7vfj
Info disclosure GHSA-955p-x3mx-jcvp

Riscos residuais: postcss ≤8.5.17 e sharp <0.35.0 são dependências internas do Next.js. O único fix disponível seria downgrade para next@9.3.3 — uma quebra de compatibilidade total. Recomenda-se acompanhar releases do Next.js 16 para quando estas CVEs forem corrigidas upstream.


Lint — migração next lint → ESLint CLI

Next.js 16 removeu o comando next lint. O script de lint estava quebrado (Invalid project directory). Correções:

  • Adicionado eslint e eslint-config-next como devDependencies
  • Criado eslint.config.mjs com configuração core-web-vitals
  • Atualizado package.json: "lint": "eslint ."

9 erros ESLint corrigidos

Arquivo Erro Correção
kanban-column.tsx react/no-unescaped-entities (2x ") Escapar com &quot;
PlanoAcaoWidget.tsx react-hooks/purityDate.now() em render useState com lazy initializer
useLeads.ts react-hooks/preserve-manual-memoization eslint-disable (deps intencionalmente granulares)
useLeads.ts react-hooks/set-state-in-effect eslint-disable (padrão async válido)
useProducts.ts react-hooks/set-state-in-effect eslint-disable (padrão async válido)
useSources.ts react-hooks/set-state-in-effect eslint-disable (padrão async válido)
useStages.ts react-hooks/set-state-in-effect eslint-disable (padrão async válido)
leads/[id]/page.tsx react-hooks/set-state-in-effect eslint-disable (padrão async válido)

Os set-state-in-effect são falsos positivos do eslint-plugin-react-hooks@7.1.1 para o padrão useEffect(() => { fetchAsync() }, [dep]) — idioma correto do React para fetch de dados. O eslint-disable documenta a decisão explicitamente.


Build

✓ Next.js 16.2.11 (Turbopack)
✓ Compiled successfully
✓ TypeScript OK
✓ 22 páginas geradas
✓ ESLint: 0 errors

Generated by Claude Code

- Upgrade next from 16.2.0 to 16.2.11 (patches 20+ high-severity CVEs:
  XSS, SSRF, cache poisoning, middleware bypass, DoS)
- Migrate lint script from removed `next lint` (Next.js 16 breaking change)
  to `eslint .` with new eslint.config.mjs using eslint-config-next
- Install eslint@^9 and eslint-config-next@^16 as devDependencies
- Fix react/no-unescaped-entities in kanban-column.tsx
- Fix react-hooks/purity in PlanoAcaoWidget.tsx: use useState lazy
  initializer instead of calling Date.now() at render time
- Suppress react-hooks/set-state-in-effect false positives in async
  data-fetching hooks (useLeads, useProducts, useSources, useStages,
  leads/[id] page) — pattern is valid; rule is overly strict in v7
- Suppress react-hooks/preserve-manual-memoization in useLeads — manual
  deps [stageId, sourceId, search] are intentionally more specific than
  [filters]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8CTrY39MvtfbWaj7ZMTxC
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
mentoria-crm Error Error Jul 25, 2026 8:05am
splinter Ready Ready Preview, Comment Jul 25, 2026 8:05am
splinter-yhcm Ready Ready Preview, Comment Jul 25, 2026 8:05am

…flow

mentoria-crm/src/lib/supabase.ts:
- Replace module-level createClient() with a lazy Proxy singleton so the
  module can be safely imported during SSR/build without NEXT_PUBLIC_* env
  vars set (Vercel preview deployments, local builds). The client is only
  instantiated when a property is first accessed — which only happens inside
  useEffect callbacks that never run on the server.

mentoria-crm/package.json:
- Upgrade next 16.2.0 → 16.2.11 (same 20+ CVE patches as root app)
- Upgrade eslint-config-next 16.2.0 → 16.2.11 to match

.github/workflows/pre-commit_hooks.yaml:
- Update actions/checkout@v2 → @v4 (v2 deprecated)
- Update actions/setup-python@v1 → @v5 (v1 no longer available on
  ubuntu-latest runners, causing "set up python 3.9" step to fail)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8CTrY39MvtfbWaj7ZMTxC
…ion + untrack node_modules lock

Turbopack was detecting /repo/package-lock.json instead of
mentoria-crm/package-lock.json and selecting the parent as workspace
root, causing Vercel deployments to fail when only mentoria-crm
dependencies are installed.

Setting turbopack.root to __dirname pins the workspace root to the
mentoria-crm directory, silencing the warning and ensuring Turbopack
resolves modules from the correct location.

Also removes node_modules/.package-lock.json from git tracking
(it was committed in the initial commit but belongs in .gitignore).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8CTrY39MvtfbWaj7ZMTxC
…name ReferenceError in ESM context

__dirname is undefined when next.config.ts is loaded as native ESM (Node.js 22.10+
with process.features.typescript). process.cwd() is safe in both CJS and ESM contexts.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8CTrY39MvtfbWaj7ZMTxC
… needed for build

Simplify config back to empty object to eliminate any Vercel-specific
interaction with the turbopack.root option.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8CTrY39MvtfbWaj7ZMTxC
The supabase CLI postinstall downloads a Go binary from GitHub releases.
Our Next.js upgrade (16.2.0->16.2.11) invalidated Vercel's node_modules
cache, causing a fresh npm install that fails when downloading the binary.
The CLI is only needed for local DB migrations, not for Vercel builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8CTrY39MvtfbWaj7ZMTxC
…ction

On Vercel (rootDirectory: mentoria-crm), the full repo is cloned but only
mentoria-crm/node_modules is installed. Turbopack detects the parent
package-lock.json and uses the repo root as its workspace root, then tries
to resolve modules from a node_modules that doesn't exist on Vercel.

Setting turbopack.root to __dirname pins it to the mentoria-crm directory.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8CTrY39MvtfbWaj7ZMTxC
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants