stdlib-js / stdlib-js/stdlib

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

Ouverte
#13,662 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Accepted Help Wanted RFC Tools
Langage dominant
JavaScript
Étoiles
6k
Forks
1.3k
Merge moyen
1 j 3 h
PR mergées (30 j)
611

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript
Domaine
tooling
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.