Skip to content
← Back to rules

jsdoc/require-param-description Pedantic

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

它的作用

要求每个 @param 标签都包含描述。

为什么这不好?

参数的描述应该被记录下来。

示例

此规则的错误代码示例:

javascript
/** @param foo */
function quux(foo) {}

此规则的正确代码示例:

javascript
/** @param foo Foo. */
function quux(foo) {}

配置

此规则接受一个配置对象,包含以下属性:

defaultDestructuredRootDescription

type: string

default: "根对象"

用于默认设置解构根的描述字符串。默认为“根对象”。

setDefaultDestructuredRootDescription

type: boolean

default: false

是否设置默认的解构根描述。 例如,您可能希望避免手动为与解构根对象对应的 @param 设置描述,因为它始终应是同一类型的对象。 使用 defaultDestructuredRootDescription 作为描述字符串。默认为 false

如何使用

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

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

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

版本

此规则于 v0.4.4 中添加。

参考