Enforce that deprecated fields or enum values are not in use by operations.
Usage Examples
Incorrect (field)
# eslint @graphql-eslint/no-deprecated: 'error'# In your schematype User { id: ID! name: String! @deprecated(reason: "old field, please use fullName instead") fullName: String!}# Queryquery user { user { name # This is deprecated, so you'll get an error }}
Incorrect (enum value)
# eslint @graphql-eslint/no-deprecated: 'error'# In your schematype Mutation { changeSomething(type: SomeType): Boolean!}enum SomeType { NEW OLD @deprecated(reason: "old field, please use NEW instead")}# Mutationmutation { changeSomething( type: OLD # This is deprecated, so you'll get an error ) { ... }}
Correct
# eslint @graphql-eslint/no-deprecated: 'error'# In your schematype User { id: ID! name: String! @deprecated(reason: "old field, please use fullName instead") fullName: String!}# Queryquery user { user { id fullName }}