useDeprecatedReason
Summary
Section titled “Summary”- Rule available since:
v1.9.0
- Diagnostic Category:
lint/style/useDeprecatedReason
- This rule is recommended, which means is enabled by default.
- This rule doesn’t have a fix.
- The default severity of this rule is warning.
- Sources:
Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “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.
query { member @deprecated(reason: "Why?")}
How to configure
Section titled “How to configure”{ "linter": { "rules": { "style": { "useDeprecatedReason": "error" } } }}