Skip to content

Requesting new rule: no-hyphen-before-returns-description #628

@thernstig

Description

@thernstig

Motivation

A new rule called no-hyphen-before-returns-description

Current behavior

Doesn't exist currently.

Desired behavior

It would warn and hopefully auto-fix if there is a hyphen in the returns description.

Alternatives considered

#623 is requesting the opposite, that a hyphen should exist before the description in a returns statement. However, IntelliSense, in at least VS Code which is one of the mostly used editors, renders the dash which makes it look "wrong". The dash is there in e.g. @param as a delimiter for identifier names, but JSDoc does not show it as part of @returns, see https://jsdoc.app/tags-returns.html.

Example of VS Code IntelliSense (code completion) for the following function:

/**
 * Some test function.
 *
 * @param {boolean} cool - If this is cool or not
 *
 * @returns {string} Current coolness.
 */
function coolness(cool) {
  return cool ? 'Very cool' : 'Not cool at all';
}

With dash
with_dash

Without dash
without_dash

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions