Skip to content

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

Description

@kgryte

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:

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

and the following should be disallowed

/**
*
* @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: #13654

Metadata

Metadata

Assignees

No one assigned

    Labels

    AcceptedRFC feature request which has been accepted.Help WantedExtra attention is needed.RFCRequest for comments. Feature requests and proposed changes.ToolsIssue or pull request related to project tooling.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions