microsoft / microsoft/TypeScript

Duplicated jsdoc should error

Offen
#24,996 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

checkJs Domain: JavaScript In Discussion Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

It's possible to document parameters and function expressions 2-3 different places in JSDoc. However, I can't think of a good reason to do so, and I suspect that it's (1) rare (2) by mistake. Here's an example:

/** @param a - the a */
function f(/* an a */ a) {
}

Today gives the jsdoc

 an a
 - the a

But should give an a and an error on @param a: "Duplicate jsdoc".

The problem is even worse in JS, where jsdoc provides types. Here, the innermost type annotation provides the type and the rest are ignored. This should definitely be an error:

/** @param {string} a */
function f(/* @type {number} */ a) {
}

This example should have an error on @param a: "Duplicate jsdoc"

Thanks to @bterlson for this idea.

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 nachzuverfolgen, wie TypeScript JSDoc für Parameter und Funktionsausdrücke analysiert und zusammenführt, und verwende die beiden Beispiele im Issue als Reproduktionsfälle. Als erledigt gilt, wenn doppelte Parameterdokumentation und widersprüchliche Inline-Typannotationen einen "Duplicate jsdoc"-Fehler erzeugen, während das angegebene Diagnoseverhalten erhalten bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
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.