microsoft / microsoft/TypeScript

Ability to only check specific errors

Aperta
#33,052 1 commento 7 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia esaminando come vengono gestite le opzioni di tsconfig.json e confronta questa proposta con il comportamento inverso discusso nell’issue #29950. L’issue descrive una whitelist di codici diagnostici per il controllo di TypeScript; il lavoro sarebbe completato quando gli errori non presenti nella whitelist vengono ignorati senza modificare il JavaScript emesso e il comportamento è coperto dai test del compilatore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
32/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.