Skip to content

jsdoc/check-tag-names Correctness

This rule is turned on by default.

What it does

Reports invalid block tag names. Additionally checks for tag names that are redundant when using a type checker such as TypeScript.

Why is this bad?

Using invalid tags can lead to confusion and make the documentation harder to read.

Examples

Examples of incorrect code for this rule:

javascript
/** @Param */
/** @foo */

/**
 * This is redundant when typed.
 * @type {string}
 */

Examples of correct code for this rule:

javascript
/** @param */

Options

Configuration for allowed tags is done via settings.jsdoc.tagNamePreference. There is no CLI-only parameter for this rule.

You can add custom tags by adding a key-value pair where both match the name of the tag you want to add, like so:

json
{
  "plugins": ["jsdoc"],
  "rules": {
    "jsdoc/check-tag-names": "error"
  },
  "settings": { 
    "jsdoc": {
      "tagNamePreference": {
        "customTagName": "customTagName"
      }
    }
  }
}

Examples of correct code for this rule with the above configuration, adding the customTagName tag:

js
/**
 * @customTagName
 */

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny jsdoc/check-tag-names --jsdoc-plugin
json
{
  "plugins": ["jsdoc"],
  "rules": {
    "jsdoc/check-tag-names": "error"
  }
}

References

Released under the MIT License.