microsoft / microsoft/TypeScript

Ability to only check specific errors

Abierto
#33,052 1 comentario 7 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Awaiting More Feedback Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.4k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

Search Terms

specific errors ignore whitelist enable only

Suggestion

Ability to specify what errors you would like to see caught in the tsconfig.json. Errors not in the whitelist would be ignored.

Use Cases

Migrating large projects to Typescript. If the migration is done in a by-error-type approach you can't turn type-checking on in CI until all problems are fixed, which can take a long time when there is other work to do.

Examples

{
  "whitelistErrors": [7017, 2322, 2344]
}

Errors other than TS7017, TS2322, TS2344 would be ignored.

This suggestion is the inverse of https://github.com/microsoft/TypeScript/issues/29950

You can see an example of the opposite (blacklist errors) here: https://github.com/evolution-gaming/tsc-silent

Pytype, google's type-checker for python, also has the ability to blacklist specific errors.

# Comma separated list of error names to ignore.
disable =
    attribute-error

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Note that this might lead to bad practice where developers lazily only check for certain errors rather than fixing their broken types. Using this feature should be discouraged unless used as a temporary measure for migrating from JS projects.

Guía de contribución

Abrir la guía de contribución

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.

Línea de trabajo

Empieza revisando cómo se gestionan las opciones de tsconfig.json y compara esta propuesta con el comportamiento inverso tratado en el issue #29950. El issue describe una lista blanca de códigos de diagnóstico para la comprobación de TypeScript; se consideraría terminado cuando los errores que no estén en la lista blanca se ignoren sin cambiar el JavaScript emitido, y el comportamiento esté cubierto por pruebas del compilador.

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

Evaluación

Stack tecnológico
typescript
Área
compilers
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
32/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.