Skip to content
← Back to rules

jsdoc/require-yields-description Style

它的作用

要求 @yields 标签提供描述。

为什么这很糟糕?

@yields 标签应该说明生成器会产出什么。

示例

以下是此规则的错误代码示例:

js
/**
 * @yields {string}
 */
function* quux() {
  yield "value";
}

以下是此规则的正确代码示例:

js
/**
 * @yields {string} 下一个值。
 */
function* quux() {
  yield "value";
}

如何使用

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

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

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

版本

此规则自 v1.68.0 起加入。

参考资料