Skip to content
← Back to rules

jsdoc/require-param-type Pedantic

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

作用

要求每个 @param 标签都有类型值(用花括号括起来)。

为什么这不好?

参数的类型应该被文档化。

示例

此规则的错误代码示例:

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

此规则的正确代码示例:

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

如何使用

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

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

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

版本

此规则于 v0.4.4 中添加。

参考