Skip to content

jsdoc/check-property-names Correctness ​

✅ This rule is turned on by default.

What it does ​

Ensures that property names in JSDoc are not duplicated on the same block and that nested properties have defined roots.

Why is this bad? ​

@property tags with the same name can be confusing and may indicate a mistake.

Examples ​

Examples of incorrect code for this rule:

javascript
/**
 * @typedef {object} state
 * @property {number} foo
 * @property {string} foo
 */

/**
 * @typedef {object} state
 * @property {number} foo.bar
 */

Examples of correct code for this rule:

javascript
/**
 * @typedef {object} state
 * @property {number} foo
 */

/**
 * @typedef {object} state
 * @property {object} foo
 * @property {number} foo.bar
 */

How to use ​

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

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

References ​

Released under the MIT License.