require-description
✅ The "extends": "plugin:@graphql-eslint/schema-recommended"
property in a configuration file
enables this rule.
- Category:
Schema
- Rule name:
@graphql-eslint/require-description
- Requires GraphQL Schema:
false
ℹ️ - Requires GraphQL Operations:
false
ℹ️
Enforce descriptions in type definitions and operations.
Usage Examples
Incorrect
# eslint @graphql-eslint/require-description: ['error', { types: true, FieldDefinition: true }]
type someTypeName {
name: String
}
Correct
# eslint @graphql-eslint/require-description: ['error', { types: true, FieldDefinition: true }]
"""
Some type description
"""
type someTypeName {
"""
Name description
"""
name: String
}
Correct
# eslint @graphql-eslint/require-description: ['error', { OperationDefinition: true }]
# Create a new user
mutation createUser {
# ...
}
Correct
# eslint @graphql-eslint/require-description: ['error', { rootField: true }]
type Mutation {
"Create a new user"
createUser: User
}
type User {
name: String
}
Config Schema
The schema defines the following properties:
types
(boolean)
Includes:
ObjectTypeDefinition
InterfaceTypeDefinition
EnumTypeDefinition
ScalarTypeDefinition
InputObjectTypeDefinition
UnionTypeDefinition
rootField
(boolean)
Definitions within Query
, Mutation
, and Subscription
root types.
DirectiveDefinition
(boolean)
Read more about this kind on spec.graphql.org.
EnumTypeDefinition
(boolean)
Read more about this kind on spec.graphql.org.
EnumValueDefinition
(boolean)
Read more about this kind on spec.graphql.org.
FieldDefinition
(boolean)
Read more about this kind on spec.graphql.org.
InputObjectTypeDefinition
(boolean)
Read more about this kind on spec.graphql.org.
InputValueDefinition
(boolean)
Read more about this kind on spec.graphql.org.
InterfaceTypeDefinition
(boolean)
Read more about this kind on spec.graphql.org.
ObjectTypeDefinition
(boolean)
Read more about this kind on spec.graphql.org.
OperationDefinition
(boolean)
Read more about this kind on spec.graphql.org.
You must use only comment syntax
#
and not description syntax"""
or"
.
ScalarTypeDefinition
(boolean)
Read more about this kind on spec.graphql.org.
UnionTypeDefinition
(boolean)
Read more about this kind on spec.graphql.org.