microsoft / microsoft/TypeScript

Ability to only check specific errors

Offen
#33,052 1 Kommentar 7 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit der Überprüfung, wie Optionen in tsconfig.json behandelt werden, und vergleichen Sie diesen Vorschlag mit dem umgekehrten Verhalten, das in Issue #29950 diskutiert wird. Das Issue beschreibt eine Whitelist von Diagnosecodes für die TypeScript-Prüfung; als erledigt würde gelten, wenn Fehler, die nicht auf der Whitelist stehen, ignoriert werden, ohne das ausgegebene JavaScript zu ändern, und das Verhalten durch Compiler-Tests abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
32/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.