stdlib-js / stdlib-js/stdlib

[RFC]: add JSDoc lint rule to enforce whitespace before and after dash

Offen
#13,662 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Accepted Help Wanted RFC Tools
Vorherrschende Sprache
JavaScript
Sterne
6k
Forks
1.3k
Ø Merge
1 T. 3 Std.
Gemergte PRs (30 T.)
611

Beschreibung

Currently, we do not catch when the dash separating a parameter name from a parameter description is bordered by more than one whitespace character. We should enforce only one whitespace character on either side of the dash. So the following is good:

```js
/**
* ...
*
* @param {number} x - input value
* @returns {number} output value
*/
```

and the following should be disallowed

```js
/**
*
* @param {number} x - input value
* @returns {number} output value
*/
```

In principle, we could have up to three different lint rules:

1. enforce number of whitespace characters before dash
2. enforce number of whitespace characters after dash
3. enforce a specific character (e.g., `-`) to be used to separate a parameter name from a description

We could also have another lint rule for enforcing that a dash should not separate a `@returns` annotation from its description. This should likely be its own RFC.

## Notes

Ref: https://github.com/stdlib-js/stdlib/pull/13654

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by reviewing the existing JSDoc lint rules and the behavior discussed in stdlib-js/stdlib#13654. Clarify whether this RFC covers whitespace before and after the dash only or also the other proposed rules, then identify the corresponding rule tests and make them verify the accepted and rejected examples in the issue.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

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