Skip to content

jsdoc/require-yields Correctness ​

✅ This rule is turned on by default.

What it does ​

Requires that yields are documented. Will also report if multiple @yields tags are present.

Why is this bad? ​

The rule is intended to prevent the omission of @yields tags when they are necessary.

Examples ​

Examples of incorrect code for this rule:

javascript
function* quux(foo) {
  yield foo;
}

/**
 * @yields {undefined}
 * @yields {void}
 */
function* quux(foo) {}

Examples of correct code for this rule:

javascript
/** * @yields Foo */
function* quux(foo) {
  yield foo;
}

How to use ​

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

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

References ​

Released under the MIT License.