🎉 Welcome to the new GraphQL-ESLint website. Try new playground page →
Rules
Require Deprecation Reason

require-deprecation-reason

✅ The "extends": "plugin:@graphql-eslint/schema-recommended" property in a configuration file enables this rule.

  • Category: Schema
  • Rule name: @graphql-eslint/require-deprecation-reason
  • Requires GraphQL Schema: false ℹī¸
  • Requires GraphQL Operations: false ℹī¸

Require all deprecation directives to specify a reason.

Usage Examples

Incorrect

# eslint @graphql-eslint/require-deprecation-reason: 'error'
 
type MyType {
  name: String @deprecated
}

Incorrect

# eslint @graphql-eslint/require-deprecation-reason: 'error'
 
type MyType {
  name: String @deprecated(reason: "")
}

Correct

# eslint @graphql-eslint/require-deprecation-reason: 'error'
 
type MyType {
  name: String @deprecated(reason: "no longer relevant, please use fullName field")
}

Resources