Skip to content
← Back to rules

jsdoc/require-property-name Correctness

它的作用

要求所有 @property 标签都包含名称。

为什么这不好?

属性类型的名称应该被记录下来。

示例

此规则的错误代码示例:

javascript
/**
 * @typedef {SomeType} SomeTypedef
 * @property {number}
 */

此规则的正确代码示例:

javascript
/**
 * @typedef {SomeType} SomeTypedef
 * @property {number} foo
 */

如何使用

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

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

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

版本

此规则于 v0.2.18 中添加。

参考