Skip to content

useDeprecatedReason

¥Summary

¥How to configure

biome.json
{
"linter": {
"rules": {
"style": {
"useDeprecatedReason": "error"
}
}
}
}

¥Description

要求在使用 @deprecated 指令时指定 reason 参数。

¥Require specifying the reason argument when using @deprecated directive

此规则检查 @deprecated 指令的参数是否使用了 reason 参数,如果缺少该参数,则建议用户添加。

¥This rule checks the parameter of @deprecated directive for the use of reason argument, suggesting user to add it in case the argument is missing.

¥Examples

¥Invalid

query {
member @deprecated
}
code-block.graphql:2:10 lint/style/useDeprecatedReason ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The directive `@deprecated` should have a `reason` argument.

1 │ query {
> 2 │ member @deprecated
^^^^^^^^^^^
3 │ }
4 │

Add a `reason` argument to the directive.

¥Valid

query {
member @deprecated(reason: "Why?")
}

¥Related links