Skip to content

Duplicated jsdoc should error #24996

Open

Description

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 Brian Terlson (@bterlson) for this idea.

Activity

  1. added
    checkJs
    on Jun 19, 2018
  2. added
    Domain: JavaScript
    and removed on Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: JavaScriptIn DiscussionSuggestioncheckJs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions