Repository navigation
fix: no-explicit-any en e2e/mobile-offline-comprehensive.spec.ts, decimosegundo batch (219 -> 201) - #99
Merged
Conversation
…imosegundo batch (219 -> 201)
Con este batch termina no-explicit-any en src/ (agotado desde el batch
11); las 154 ocurrencias restantes de la categoria estaban todas en e2e/.
Este es el primer batch de esa cola.
e2e/fixtures.ts: se extendio el "declare global { interface Window }" ya
existente (usado hoy solo para __PLAYWRIGHT_TEST__) con dos globals
nuevos que los specs offline vienen accediendo via "(window as any)":
- __bambu?: { fetchResilient, syncWithServer, getRequestQueue,
getSyncQueue, clearQueues } -- shape identico al que
connectivity-indicator.tsx expone realmente en window.__bambu (guardado
tras __PLAYWRIGHT_TEST__), tipado con "typeof fetchResilient"/"typeof
syncWithServer" importados como type-only del modulo real en vez de
duplicar la firma a mano.
- __TEST_BASE_URL?: string -- nunca se asigna en la app real; un spec lo
lee como fallback defensivo (`|| ''`) que hoy siempre resuelve a ''; se
tipa para permitir la lectura sin any, no para implicar que algo lo asigna.
Como esta declaracion ya vive en fixtures.ts (incluido en tsconfig.json,
por eso ya aplicaba a __PLAYWRIGHT_TEST__ en todo el proyecto sin
necesidad de importar el archivo), queda disponible automaticamente para
TODOS los specs de e2e/, no solo este archivo -- reduce trabajo repetido
en los batches siguientes de esta misma cola.
e2e/mobile-offline-comprehensive.spec.ts (18 ocurrencias):
- (window as any).__bambu.X(...) -> window.__bambu!.X(...) (el "!" es
legitimo: cada test llama primero a waitForBambu(), que hace
page.waitForFunction(() => window.__bambu !== undefined) antes de usarlo).
- (window as any).__TEST_BASE_URL -> window.__TEST_BASE_URL.
- Object.values(data).filter((v: any) => v?.id) -> filter((v) => (v as {
id?: string })?.id) -- data ya es `any` (viene de r.json()), el any
explicito en el callback era redundante ademas de estar mal tipado.
- (pedidos as any[]).find(...) -> (pedidos as Array<{ clienteId: string;
saldo: number }>).find(...), con el shape real que el resto del test
consume (clienteId + saldo); esto exigio agregar "!" en 3 usos
posteriores de pedidoBefore/pedidoAfter (ya validados con
expect(...).toBeTruthy() antes de leerse, mismo patron que TS exige
tras tipar el resultado de .find() como possibly-undefined).
- return data.pedido as any -> return data.pedido (cast redundante, el
valor ya es `any`).
Verificacion:
- npx eslint e2e/mobile-offline-comprehensive.spec.ts e2e/fixtures.ts --max-warnings 999 -> limpio
- npx tsc --noEmit (repo completo, sobre main actualizado con PR #98) -> 0 errores
(el primer intento con "(pedidos as Array<{ clienteId: string }>)" sin
saldo rompio 3 sitios via tsc -- corregido agregando saldo al tipo y los
"!" correspondientes antes de dar el batch por cerrado)
- npx eslint . --max-warnings 999 --format json -> total 219 -> 201 (-18,
no-explicit-any 154 -> 136, delta exacto = 18 ocurrencias corregidas)
- npx vitest run (repo completo) -> 233 archivos, 2461 tests, 0 fallos, 0 regresiones
(E2E no se ejecuta -- shard desactivado por instruccion del usuario
mientras dure esta limpieza; la verificacion de este archivo es tsc +
eslint, no una corrida real de Playwright)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
casasleonj
pushed a commit
that referenced
this pull request
Aug 21, 2026
…atch (201 -> 184)
e2e/fixtures.ts: getRequestQueue/getSyncQueue en el ambient __bambu (agregado
en el batch anterior) pasan de Promise<unknown[]> a Promise<OfflineRequest[]>/
Promise<SyncQueueItem[]>, importando los tipos reales ya definidos en
src/lib/db/offline.ts (mismas interfaces que usa offlineDb.requestQueue/
syncQueue). Esto no rompe la asignacion real en connectivity-indicator.tsx
(esa linea castea aparte via "as unknown as {...}" con su propio tipo
inline, independiente de esta declaracion global) y le da a todo spec de
e2e/ que llame __bambu.getRequestQueue() campos reales (offlineId, method,
url, localEndpoint, createdAt, attempts, etc.) en vez de unknown.
e2e/offline-full-flow.spec.ts (17 ocurrencias):
- (window as any).__bambu !== undefined -> window.__bambu !== undefined
- (window as any).__bambu.X(...) -> window.__bambu!.X(...) / const bambu =
window.__bambu! (mismo "!" legitimo del batch anterior: cada test hace
waitForFunction(() => window.__bambu !== undefined) antes de usarlo).
- queueFull.every((q: any) => q.offlineId === offlineId) -> anotacion
removida; q ya se infiere como OfflineRequest gracias al tipado de
getRequestQueue() en fixtures.ts.
Verificacion:
- npx eslint e2e/offline-full-flow.spec.ts e2e/fixtures.ts --max-warnings 999 -> limpio
- npx tsc --noEmit (repo completo, sobre main actualizado con PR #99) -> 0 errores
(el primer intento con getRequestQueue() sin tipar rompio 4 sitios via tsc
-- Object is of type unknown / no overload matches -- corregido tipando
OfflineRequest/SyncQueueItem en fixtures.ts antes de cerrar el batch)
- npx eslint . --max-warnings 999 --format json -> total 201 -> 184 (-17,
no-explicit-any 136 -> 119, delta exacto = 17 ocurrencias corregidas)
- npx vitest run (repo completo) -> 233 archivos, 2461 tests, 0 fallos, 0 regresiones
casasleonj
added a commit
that referenced
this pull request
Aug 21, 2026
…atch (201 -> 184)
e2e/fixtures.ts: getRequestQueue/getSyncQueue en el ambient __bambu (agregado
en el batch anterior) pasan de Promise<unknown[]> a Promise<OfflineRequest[]>/
Promise<SyncQueueItem[]>, importando los tipos reales ya definidos en
src/lib/db/offline.ts (mismas interfaces que usa offlineDb.requestQueue/
syncQueue). Esto no rompe la asignacion real en connectivity-indicator.tsx
(esa linea castea aparte via "as unknown as {...}" con su propio tipo
inline, independiente de esta declaracion global) y le da a todo spec de
e2e/ que llame __bambu.getRequestQueue() campos reales (offlineId, method,
url, localEndpoint, createdAt, attempts, etc.) en vez de unknown.
e2e/offline-full-flow.spec.ts (17 ocurrencias):
- (window as any).__bambu !== undefined -> window.__bambu !== undefined
- (window as any).__bambu.X(...) -> window.__bambu!.X(...) / const bambu =
window.__bambu! (mismo "!" legitimo del batch anterior: cada test hace
waitForFunction(() => window.__bambu !== undefined) antes de usarlo).
- queueFull.every((q: any) => q.offlineId === offlineId) -> anotacion
removida; q ya se infiere como OfflineRequest gracias al tipado de
getRequestQueue() en fixtures.ts.
Verificacion:
- npx eslint e2e/offline-full-flow.spec.ts e2e/fixtures.ts --max-warnings 999 -> limpio
- npx tsc --noEmit (repo completo, sobre main actualizado con PR #99) -> 0 errores
(el primer intento con getRequestQueue() sin tipar rompio 4 sitios via tsc
-- Object is of type unknown / no overload matches -- corregido tipando
OfflineRequest/SyncQueueItem en fixtures.ts antes de cerrar el batch)
- npx eslint . --max-warnings 999 --format json -> total 201 -> 184 (-17,
no-explicit-any 136 -> 119, delta exacto = 17 ocurrencias corregidas)
- npx vitest run (repo completo) -> 233 archivos, 2461 tests, 0 fallos, 0 regresiones
Co-authored-by: Claude <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumen
Decimosegundo batch de la limpieza de deuda de
@typescript-eslint/no-explicit-any. Con este batch terminano-explicit-anyensrc/(agotado desde el batch 11); las 154 ocurrencias restantes de la categoria estaban todas ene2e/. Este es el primer batch de esa cola. Reduce el total de issues de eslint del repo de 219 a 201 (-18).Cambios
e2e/fixtures.ts: se extendio eldeclare global { interface Window }ya existente (usado hoy solo para__PLAYWRIGHT_TEST__) con dos globals nuevos que los specs offline vienen accediendo via(window as any):__bambu?: { fetchResilient, syncWithServer, getRequestQueue, getSyncQueue, clearQueues }— shape identico al queconnectivity-indicator.tsxexpone realmente enwindow.__bambu(guardado tras__PLAYWRIGHT_TEST__), tipado contypeof fetchResilient/typeof syncWithServerimportados como type-only del modulo real en vez de duplicar la firma a mano.__TEST_BASE_URL?: string— nunca se asigna en la app real; un spec lo lee como fallback defensivo (|| '') que hoy siempre resuelve a''; se tipa para permitir la lectura sinany, no para implicar que algo lo asigna.Como esta declaracion ya vive en
fixtures.ts(incluido entsconfig.json, por eso ya aplicaba a__PLAYWRIGHT_TEST__en todo el proyecto sin necesidad de importar el archivo), queda disponible automaticamente para todos los specs dee2e/, no solo este archivo — reduce trabajo repetido en los batches siguientes de esta misma cola.e2e/mobile-offline-comprehensive.spec.ts(18 ocurrencias):(window as any).__bambu.X(...)->window.__bambu!.X(...)(el!es legitimo: cada test llama primero awaitForBambu(), que hacepage.waitForFunction(() => window.__bambu !== undefined)antes de usarlo).(window as any).__TEST_BASE_URL->window.__TEST_BASE_URL.Object.values(data).filter((v: any) => v?.id)->filter((v) => (v as { id?: string })?.id)—dataya esany(viene der.json()), elanyexplicito en el callback era redundante ademas de estar mal tipado.(pedidos as any[]).find(...)->(pedidos as Array<{ clienteId: string; saldo: number }>).find(...), con el shape real que el resto del test consume (clienteId + saldo); esto exigio agregar!en 3 usos posteriores depedidoBefore/pedidoAfter(ya validados conexpect(...).toBeTruthy()antes de leerse).return data.pedido as any->return data.pedido(cast redundante, el valor ya esany).Verificacion
npx eslint e2e/mobile-offline-comprehensive.spec.ts e2e/fixtures.ts --max-warnings 999-> limpionpx tsc --noEmit(repo completo, sobre main actualizado con PR fix: no-explicit-any en src/lib/__tests__/pricing.test.ts, decimoprimer batch de la categoria (262 -> 219) #98) -> 0 errores (el primer intento con el tipo sinsaldorompio 3 sitios via tsc — corregido antes de cerrar el batch)npx eslint . --max-warnings 999 --format json-> total 219 -> 201 (-18,no-explicit-any154 -> 136, delta exacto = 18 ocurrencias corregidas)npx vitest run(repo completo) -> 233 archivos, 2461 tests, 0 fallos, 0 regresiones (E2E no se ejecuta — shard desactivado por instruccion del usuario mientras dure esta limpieza; la verificacion de este archivo es tsc + eslint, no una corrida real de Playwright)Nota sobre CI
El job
e2eesta desactivado temporalmente (if: falseen.github/workflows/ci.yml) mientras dure esta limpieza de lint, por instruccion explicita del usuario — se revertira una vez resueltos todos los issues restantes.Type check + TestsyLint (non-blocking)corren normalmente.Generated by Claude Code