no-one-place-fragments
- Category:
Operations
- Rule name:
@graphql-eslint/no-one-place-fragments
- Requires GraphQL Schema:
false
âšī¸ - Requires GraphQL Operations:
true
âšī¸
Disallow fragments that are used only in one place.
Usage Examples
Incorrect
# eslint @graphql-eslint/no-one-place-fragments: 'error'
fragment UserFields on User {
id
}
{
user {
...UserFields
}
}
Correct
# eslint @graphql-eslint/no-one-place-fragments: 'error'
fragment UserFields on User {
id
}
{
user {
...UserFields
friends {
...UserFields
}
}
}