@graphql-eslint/eslint-plugin
Version:
GraphQL plugin for ESLint
148 lines (98 loc) • 3.48 kB
Markdown
✅ 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` [ℹ️](../../README.md
- Requires GraphQL Operations: `false`
[ℹ️](../../README.md
Enforce descriptions in type definitions and operations.
```graphql
type someTypeName {
name: String
}
```
```graphql
"""
Some type description
"""
type someTypeName {
"""
Name description
"""
name: String
}
```
```graphql
mutation createUser {
}
```
```graphql
type Mutation {
"Create a new user"
createUser: User
}
type User {
name: String
}
```
The schema defines the following properties:
Includes:
- `ObjectTypeDefinition`
- `InterfaceTypeDefinition`
- `EnumTypeDefinition`
- `ScalarTypeDefinition`
- `InputObjectTypeDefinition`
- `UnionTypeDefinition`
Definitions within `Query`, `Mutation`, and `Subscription` root types.
Read more about this kind on
[](https://spec.graphql.org/October2021/#DirectiveDefinition).
Read more about this kind on
[](https://spec.graphql.org/October2021/#EnumTypeDefinition).
Read more about this kind on
[](https://spec.graphql.org/October2021/#EnumValueDefinition).
Read more about this kind on
[](https://spec.graphql.org/October2021/#FieldDefinition).
Read more about this kind on
[](https://spec.graphql.org/October2021/#InputObjectTypeDefinition).
Read more about this kind on
[](https://spec.graphql.org/October2021/#InputValueDefinition).
Read more about this kind on
[](https://spec.graphql.org/October2021/#InterfaceTypeDefinition).
Read more about this kind on
[](https://spec.graphql.org/October2021/#ObjectTypeDefinition).
Read more about this kind on
[](https://spec.graphql.org/October2021/#OperationDefinition).
> You must use only comment syntax `
Read more about this kind on
[](https://spec.graphql.org/October2021/#ScalarTypeDefinition).
Read more about this kind on
[](https://spec.graphql.org/October2021/#UnionTypeDefinition).
- [Rule source](../../packages/plugin/src/rules/require-description.ts)
- [Test source](../../packages/plugin/tests/require-description.spec.ts)