microsoft / microsoft/TypeScript

Show error when JSDoc tags use unknown Symbols

Offen
#42,093 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

Suggestion

Raise error when JSDoc tags reference unknown types

🔍 Search Terms

List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.

is:issue is:open in:title jsdoc error
is:issue is:open in:title jsdoc validate

✅ Viability 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, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

Just like unknown symbols are compilation errors, raise also errors when using unknown symbols within JSDoc comments

📃 Motivating Example

      class TestWebsite {}

      /** @link {TestWebsite-Bogus} */
      /** @see {TestWebsite-Bogus} */
      /** @type {TestWebsite-Bous} */

There is no error on those references

💻 Use Cases

Typescript already takes type hints from JSDoc comments. Why not close the loop and also type-check JSDoc??

My most frequent code documentation case is referencing symbols and files within comments. However since these are never validated it is normal that with time and some refactorings those references become invalid.

It would be of a great help getting compilation errors on comment references. After all wrong/bad code documentation is worst than no documentation. JSDoc deserves static validation too!

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

Beginne damit, den Vorschlag und seine JSDoc-Beispiele zu überprüfen, und ermittle anschließend die vorhandenen Tests zur JSDoc-Typprüfung und zu Diagnosen; das Issue nennt keine Dateien oder Test-Einstiegspunkte. Als abgeschlossen gilt die Aufgabe, wenn unbekannte Symbole, auf die von JSDoc-Tags wie @link, @see und @type verwiesen wird, Kompilierungsfehler erzeugen, ohne das erzeugte JavaScript zu ändern.

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
35/100

Neue Issues direkt in Ihr Postfach

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