zero-tolerance-doctrine: noImplicitAny reported missing when strict is true

Abierto Apto para principiantes
#506 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
devtools

Línea de trabajo

El hallazgo false proviene de las dos comprobaciones independientes sobre compilerOptions.strict y compilerOptions.noImplicitAny en src/checkers/sacred-laws/zero-tolerance.ts, así que empieza por ahí. Lee cómo se gestiona strict en la comprobación existente y luego razona sobre cuándo noImplicitAny no está definido frente a cuando está explícitamente en false. Está terminado cuando un fixture con strict: true y sin noImplicitAny no produce ningún hallazgo, mientras que uno con strict: true, noImplicitAny: false sigue produciéndolo.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

Version: develop, and #503 (bugfix/486-foreign-json-reader)
Law: Zero Tolerance Doctrine (SACRED LAW): src/checkers/sacred-laws/zero-tolerance.ts

What happens

The law reports TypeScript noImplicitAny not enabled for a tsconfig that sets "strict": true and does not repeat "noImplicitAny": true. strict turns noImplicitAny on, so the finding is false.

develop, zero-tolerance.ts:

if (!tsConfig || !compilerOptions.strict) {
  violations.push('TypeScript strict mode not enabled');
}
if (!tsConfig || !compilerOptions.noImplicitAny) {
  violations.push('TypeScript noImplicitAny not enabled');
}

#503 reads the extends chain, but it keeps the same two independent checks (for (const [flag, finding] of [['strict', …], ['noImplicitAny', …]])).

Reproduction

A project whose tsconfig.json is { "compilerOptions": { "strict": true } } gets TypeScript noImplicitAny not enabled.

What I ruled out

This repository's own self-audit is not affected, because its tsconfig sets both flags explicitly. I have only read the code path above and have not built a fixture yet.

Suggested direction

Treat noImplicitAny as enabled when it is true, or when it is unset and strict is true. Only an explicit "noImplicitAny": false should be reported. strictModeOf in #503's src/utils/tsconfig-chain.ts already models this "strict implies" rule the other way round. Red/green: a fixture with strict: true and no noImplicitAny produces no finding, and one with strict: true, noImplicitAny: false still produces it.

Lenguaje dominante
TypeScript
Estrellas
0
Forks
0
Merge medio
2 h 36 min
PR fusionados (30 d)
168

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Rule-Of-Code/RoC

Todos los issues de Rule-Of-Code/RoC

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.