Skip to content
← Back to rules

jsdoc/check-property-names Correctness

🚧 An auto-fix is planned for this rule, but not implemented at this time.

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 using the config file or in the CLI, you can use:

json
{
  "plugins": ["jsdoc"],
  "rules": {
    "jsdoc/check-property-names": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["jsdoc"],
  rules: {
    "jsdoc/check-property-names": "error",
  },
});
bash
oxlint --deny jsdoc/check-property-names --jsdoc-plugin

Version ​

This rule was added in v0.2.18.

References ​