Skip to content

jsdoc/require-property Correctness

This rule is turned on by default.

What it does

Requires that all @typedef and @namespace tags have @property tags when their type is a plain object, Object, or PlainObject.

Why is this bad?

Object type should have properties defined.

Examples

Examples of incorrect code for this rule:

javascript
/**
 * @typedef {Object} SomeTypedef
 */

/**
 * @namespace {Object} SomeNamesoace
 */

Examples of correct code for this rule:

javascript
/**
 * @typedef {Object} SomeTypedef
 * @property {SomeType} propName Prop description
 */

/**
 * @typedef {object} Foo
 * @property someProp
 */

How to use

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

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

References

Released under the MIT License.