Skip to content

useDeprecatedReason

Require specifying the reason argument when using @deprecated directive

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.

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

The directive @deprecated should have a reason argument.

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

Add a reason argument to the directive.

query {
member @deprecated(reason: "Why?")
}
biome.json
{
"linter": {
"rules": {
"nursery": {
"useDeprecatedReason": "error"
}
}
}
}