Skip to content
← Back to rules

jsdoc/require-yields-type Pedantic

What it does

Requires a type on the @yields tag.

Why is this bad?

A @yields tag should document the type yielded by the generator.

Examples

Examples of incorrect code for this rule:

js
/** @yields */
function* quux() {}

Examples of correct code for this rule:

js
/** @yields {string} */
function* quux() {}

How to use

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

json
{
  "plugins": ["jsdoc"],
  "rules": {
    "jsdoc/require-yields-type": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["jsdoc"],
  rules: {
    "jsdoc/require-yields-type": "error",
  },
});
bash
oxlint --deny jsdoc/require-yields-type --jsdoc-plugin

Version

This rule was added in vnext.

References