Skip to content

chore(eslint): regenera baseline + versiona divida tecnica em F5-3.3#95

Merged
adm01-debug merged 2 commits into
mainfrom
chore/eslint-baseline-update
May 8, 2026
Merged

chore(eslint): regenera baseline + versiona divida tecnica em F5-3.3#95
adm01-debug merged 2 commits into
mainfrom
chore/eslint-baseline-update

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

@adm01-debug adm01-debug commented May 8, 2026

Em portugues claro pro Joaquim

O que e o baseline ESLint: arquivo que serve como linha de partida. Tudo que esta nele e tolerado (legado). Erros NOVOS depois dele sao bloqueados em CI.

Por que precisa atualizar: baseline foi criado faz tempo com 1.433 erros legados. Hoje o repo tem 1.571 (drift do Lovable adicionou ~138 erros desde entao). Resultado: CI ficou vermelho mesmo quando ninguem mexeu em nada, e `--no-verify` virou habito (licao #2 do handoff).

O que esse PR faz:

  1. Regenera `.eslint-baseline.json` aceitando 1.571 como nova linha de partida
  2. Versiona o plano de limpeza dos 1.571 erros como F5-3.3 no doc de auditoria, escalonado em 8 sub-tarefas

O que NAO faz:

  • NAO conserta nenhum erro no codigo
  • NAO afeta producao
  • NAO mexe em hooks (separado em PR-3)

Validacao

```
$ npm run lint:baseline

node scripts/check-eslint-baseline.mjs
ESLint baseline gate - atual: 1571 erros baseline: 1571 erros
exit code: 0
```

Antes deste PR, o exit code era 1 (vermelho) por 138 erros novos.

Plano de limpeza versionado em F5-3.3

# Categoria Qtd Esforco
F5-3.3.1 React/NodeJS not defined ~90 Config TS (baixo)
F5-3.3.2 eqeqeq (== vs ===) ~250 Auto-fix
F5-3.3.3 consistent-type-imports ~50 Auto-fix
F5-3.3.4 no-duplicate-imports ~80 Auto-fix
F5-3.3.5 unused-vars ~400 Manual (baixo risco)
F5-3.3.6 no-explicit-any ~300 Manual (medio risco)
F5-3.3.7 forbidden-non-null-assertion ~150 Manual (medio risco)
F5-3.3.8 Outros ~250 Variavel

Justificativa pra esperar Fase 5: Fases 1-3 vao deletar arquivos com erros. Limpar antes = trabalho desperdicado (licao #4 do handoff).

Tamanho

Arquivo Linhas
`.eslint-baseline.json` +303 / -126
`docs/AUDITORIA_2026-05-07.md` +12 / -1
Total 2 arquivos, +316 / -129

Risco

  • Producao: zero (so .json e .md)
  • CI: passa a ficar verde (era vermelho antes)
  • Reversao: `git revert` em 1 clique

Refs

Summary by CodeRabbit

  • Chores

    • Regenerated and updated the ESLint baseline snapshot: refreshed timestamp and rebalanced per-file lint counts to reflect current source and test issues; CI now blocks any new lint errors beyond the frozen baseline.
  • Documentation

    • Updated audit/roadmap with a staged 8-PR remediation plan, targeted frozen baseline (1.571 ESLint errors), per-rule focus areas, and next steps.

CONTEXTO
========
O .eslint-baseline.json foi criado quando o repo tinha 1.433 erros ESLint
legados. Hoje tem 1.571 (drift do Lovable adicionou ~138 erros novos sem
serem absorvidos no baseline).

Resultado: o gate `scripts/check-eslint-baseline.mjs` ficou vermelho em
CI mesmo quando ningúem mexeu em nada, mascarando regressoes reais e
forcando uso de --no-verify (lição #2 do handoff).

O QUE MUDA
==========
1. .eslint-baseline.json regenerado via 'npm run lint:baseline:update'
   - Antes: 1433 erros congelados em ~580 arquivos
   - Depois: 1571 erros congelados em 625 arquivos
   - Os 138 a mais sao os erros que entraram desde a ultima atualizacao
     do baseline. Ainda existem no codigo - so foram aceitos como linha
     de partida.

2. docs/AUDITORIA_2026-05-07.md - F5-3.3 expandida em 8 sub-tarefas
   F5-3.3.1: 'React'/'NodeJS' is not defined (~90) - fix de config
   F5-3.3.2: eqeqeq (~250) - auto-fix
   F5-3.3.3: consistent-type-imports (~50) - auto-fix
   F5-3.3.4: no-duplicate-imports (~80) - auto-fix
   F5-3.3.5: unused-vars (~400) - manual
   F5-3.3.6: no-explicit-any (~300) - manual, alto risco
   F5-3.3.7: forbidden-non-null-assertion (~150) - manual
   F5-3.3.8: outros (~250)
   + Justificativa do escalonamento pra Fase 5 documentada no doc

VALIDACAO
=========
$ node scripts/check-eslint-baseline.mjs
exit code: 0  (gate volta a passar)
'ESLint baseline gate - atual: 1571 erros · baseline: 1571 erros'

EFEITOS COLATERAIS
==================
- CI baseline gate: antes vermelho, agora verde
- Hooks pre-commit/pre-push: ainda vermelho (rodam lint:check, nao
  baseline). Sera resolvido em PR separado (PR-3 do plano)
- Codigo em si: ZERO mudancas no comportamento - apenas .json e .md

REVERSAO
========
git revert do PR. Baseline volta ao estado antigo.

REFS
====
- Auditoria: F5-3.3 versionada com plano de 8 PRs
- Bloqueador F1: --no-verify obrigatorio em hooks (sera resolvido no PR-3)
- Licao #2 do handoff: drift do Lovable
Copilot AI review requested due to automatic review settings May 8, 2026 02:23
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

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

Project Deployment Actions Updated (UTC)
promo-gifts Ready Ready Preview, Comment May 8, 2026 10:34am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: String must contain at most 250 character(s) at "tone_instructions"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 83624f57-ef7d-4106-ba7d-444f0fbf84b0

📥 Commits

Reviewing files that changed from the base of the PR and between 27e72fa and 31f4938.

📒 Files selected for processing (1)
  • docs/AUDITORIA_2026-05-07.md

📝 Walkthrough

Walkthrough

Updates the ESLint baseline JSON with a new timestamp and rebalanced per-file lint counts (total errors → 1,571) and records an 8-PR hardening plan in the AUDITORIA document with a CI gate preventing new ESLint errors.

Changes

ESLint Baseline Snapshot & Hardening Plan

Layer / File(s) Summary
Baseline Metadata
.eslint-baseline.json
generatedAt timestamp and totalErrors updated in baseline root metadata.
Component & Page Lint Counts
.eslint-baseline.json
Rule counts adjusted/added across src/components/{access,admin,security,cart,common,dev,layout,mockup,navigation,notifications,products,quotes} and multiple page entries.
UI Helpers, Hooks & Library Lint Counts
.eslint-baseline.json
Baseline entries added/updated for UI helpers, contexts, many hooks (dev, auto-save, catalog, mockup, quote/search), src/lib/* modules, and src/main.tsx.
Service, Test & Miscellaneous Baseline Updates
.eslint-baseline.json
Added/updated baseline entries for auth-related services, branding tests, and expanded test suite baselines under src/tests/* with explicit-any, no-undef, and import-rule counts.
Audit & Hardening Plan
docs/AUDITORIA_2026-05-07.md
Replaced prior target with a documented 8-PR staged plan that freezes the baseline at 1,571 errors, enumerates rule groups and fix approach, records the generation script, and enforces a CI gate blocking new errors.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 A baseline hops through the code, counting lint with care,
Each rule and error tallied with precision fair,
With 1,571 lines of lint to tame,
A multi-PR strategy claims its rightful fame. 📋✨

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Atualiza o baseline do ESLint para refletir o estado atual do repositório (aceitando 1.571 erros legados) e registra no documento de auditoria o plano F5-3.3 para eliminar esses erros em etapas, para que o CI volte a bloquear apenas regressões novas.

Changes:

  • Regenera .eslint-baseline.json com totalErrors: 1571 como nova linha de partida do gate.
  • Detalha a iniciativa F5-3.3 em 8 sub-tarefas no docs/AUDITORIA_2026-05-07.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
docs/AUDITORIA_2026-05-07.md Expande F5-3.3 com o plano de limpeza do baseline e referência ao baseline regenerado.
.eslint-baseline.json Atualiza o baseline de erros do ESLint para o total atual (1571) usado pelo gate do CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/AUDITORIA_2026-05-07.md Outdated
- [ ] **F5-3.3.7** `forbidden-non-null-assertion` (~150 erros) — manual, requer null-checks adequados
- [ ] **F5-3.3.8** Outros erros residuais (~250) — categorizar e atacar
- **Justificativa do escalonamento:** Fases 1-3 vão deletar arquivos com erros. Limpar antes da F3 = trabalho desperdiçado (lição #4 do handoff). Cada PR é pequeno, auditável, reversível.
- **Baseline atual:** `.eslint-baseline.json` regenerado em 07/05/2026 (commit `<a definir>`) congelando 1571 erros como linha de partida. Qualquer NOVO erro a partir daqui é bloqueado pelo gate de CI.
Substitui estimativas (~80, ~250, ~400) pelos numeros precisos coletados
do .eslint-baseline.json regenerado no commit anterior.

MUDANCAS PRINCIPAIS:
- F5-3.3.1: ~80 -> 297 (foco em 'React' is not defined = 261 deles, fix de 1 linha)
- F5-3.3.2: ~400 -> 566 (no-unused-vars)
- F5-3.3.3: ~300 -> 312 (no-explicit-any)
- F5-3.3.4: ~250 -> 210 (eqeqeq)
- F5-3.3.5: ~80 -> 96 (no-duplicate-imports)
- F5-3.3.6: ~50 -> 31 (consistent-type-imports)
- F5-3.3.7: trio = 42 (no-empty + no-redeclare + no-unused-expressions)
- F5-3.3.8: cauda longa = 17 erros em 9 regras menores
- F5-3.3.7 ANTIGO 'forbidden-non-null-assertion' REMOVIDO - era warning, nao error, nao esta no baseline

ADICOES:
- Soma valida: 297+566+312+210+96+31+42+17 = 1571 (match exato com baseline)
- Avaliacao de risco por sub-tarefa
- Ordem sugerida de execucao (zero risco primeiro)

VERIFICACAO:
$ node scripts/eslint-baseline-generate.mjs && node -e '...'
total coberto: 1571 / total real: 1571 / diff: 0
Todas as 18 regras no baseline cobertas no doc.

REFS: F5-3.3
@adm01-debug adm01-debug merged commit dd33143 into main May 8, 2026
2 of 12 checks passed
@adm01-debug adm01-debug deleted the chore/eslint-baseline-update branch May 8, 2026 10:33
adm01-debug added a commit that referenced this pull request May 8, 2026
)

PROBLEMA
========
O hook .husky/pre-push rodava 3 comandos:
  npm run typecheck && npm run lint:check && npm run test -- --run --reporter=dot

Estado real desses comandos no repo hoje:
  1. typecheck: passa em 2s (saudavel)
  2. lint:check: FALHA (1567 errors + 561 warnings, --max-warnings=500)
  3. npm run test: FALHA (16 testes pre-existentes quebrados, F5-3.1)
     + tempo total 5+ min

Resultado: hook 100% vermelho desde drift do Lovable. --no-verify virou
politica de fato (licao #2 do handoff). Hook deixou de proteger qualquer
coisa.

SOLUCAO
=======
Trocar hook por:
  npm run typecheck && npm run lint:baseline

Justificativa:
- typecheck: gate barato (2s), sempre util, ja roda em CI
- lint:baseline: ESPELHO EXATO do gate de CI (apos PR #95 regenerar baseline)
- npm run test: REMOVIDO do hook ate F5-3.1 ser resolvido. Testes
  continuam rodando em CI normalmente. Quando os 16 testes forem
  consertados, devolver ao hook.

EFEITOS
=======
- Hook fica usavel: ~62s por push, exit 0 no estado limpo
- Detecta typescript errors NOVOS (gate primario)
- Detecta ESLint regressions NOVAS (gate baseline)
- CI continua mais rigoroso que hook (executa testes + 5 outros checks)
- --no-verify deixa de ser necessario em git push

PRE-COMMIT NAO RESOLVIDO
========================
O hook .husky/pre-commit (npx lint-staged com eslint --max-warnings=0)
continua quebrado para qualquer commit em arquivo com erro legado.
Versionado como F5-3.5 na auditoria pra ser resolvido junto com F5-3.3.

ARQUIVOS
========
1. .husky/pre-push - 1 linha alterada
2. docs/ONBOARDING.md - texto 'roda testes automaticamente' atualizado
3. docs/AUDITORIA_2026-05-07.md - F5-3.5 adicionado

VALIDACAO
=========
$ sh .husky/pre-push
exit: 0 em 62s

REVERSAO
========
git revert do PR. Hook volta ao formato antigo (com 3 comandos vermelhos).

REFS
====
- Licao #2 do handoff: drift do Lovable
- Bloqueador resolvido: --no-verify obrigatorio em git push
- Bloqueador NAO resolvido: --no-verify ainda obrigatorio em git commit (F5-3.5)
- F5-3.1: 16 testes pre-existentes falhando (pre-requisito pra devolver test ao hook)
adm01-debug added a commit that referenced this pull request May 8, 2026
CONTEUDO
========
1. docs/AUDITORIA_2026-05-07.md atualizado:
   - Status Fase 1: 12/15 (80%) -> 16/19 (84%)
   - Adicionada secao 1.7 Paginas orfas (F1-7.1 a F1-7.12)
   - Adicionada secao 1.8 Quick-wins infra (F1-8.1 a F1-8.5)
   - Changelog v1.3 com sumario dos 4 PRs

2. docs/HANDOFF-2026-05-07-SESSAO-NOITE.md NOVO:
   - Handoff suplementar pra proxima instancia
   - Resumo: o que foi feito, o que ficou versionado
   - Achados bonus pendentes (F1-7.11, F1-7.12)
   - Estado atual dos gates (validar no inicio da proxima sessao)
   - Checklist de primeira acao
   - Proximas opcoes estrategicas

CONTEXTO
========
Sessao de noite mergeou 4 PRs em sequencia consertando infra de CI
e fazendo a primeira faxina propriamente dita:
- PR #94 (5a3c7f5) fix smoke-tests
- PR #95 (dd33143) regenera baseline ESLint, versiona F5-3.3
- PR #96 (9402fda) alinha pre-push hook, versiona F5-3.5
- PR #97 (741af39) deleta 4 paginas orfas (-1139 linhas)

GOVERNANCA
==========
Mudanca Pequena (2 arquivos, ~200 linhas) -> merge direto na main.
Atende ao pedido do Joaquim: 'deixe bem documentado o que ja
fizemos, assim se eventualmente o chat chegar em seu limite, o
proximo agente Claude vai conseguir continuar a faxina'.

REFS
====
- F1-7, F1-8, F5-3.3, F5-3.5 versionadas
- Sessao da tarde: docs/HANDOFF-2026-05-07.md (intacto)
- Sessao de noite: docs/HANDOFF-2026-05-07-SESSAO-NOITE.md (NOVO)
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.

2 participants