jsdoc/require-throws-description 样式
它的作用
要求 @throws 标签提供描述。
为什么这不好?
@throws 标签应说明可能抛出错误的条件或原因。
示例
此规则的错误代码示例:
js
/**
* @throws {Error}
*/
function quux() {
throw new Error("error");
}此规则的正确代码示例:
js
/**
* @throws {Error} 有描述
*/
function quux() {
throw new Error("error");
}如何使用
To enable this rule using the config file or in the CLI, you can use:
json
{
"plugins": ["jsdoc"],
"rules": {
"jsdoc/require-throws-description": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["jsdoc"],
rules: {
"jsdoc/require-throws-description": "error",
},
});bash
oxlint --deny jsdoc/require-throws-description --jsdoc-plugin版本
此规则在 v1.65.0 中加入。
