require-import-fragment
đĄ This rule provides suggestions (opens in a new tab)
- Category:
Operations
- Rule name:
@graphql-eslint/require-import-fragment
- Requires GraphQL Schema:
false
âšī¸ - Requires GraphQL Operations:
true
âšī¸
Require fragments to be imported via an import expression.
Usage Examples
Incorrect
# eslint @graphql-eslint/require-import-fragment: 'error'
query {
user {
...UserFields
}
}
Incorrect
# eslint @graphql-eslint/require-import-fragment: 'error'
# import 'post-fields.fragment.graphql'
query {
user {
...UserFields
}
}
Incorrect
# eslint @graphql-eslint/require-import-fragment: 'error'
# import UserFields from 'post-fields.fragment.graphql'
query {
user {
...UserFields
}
}
Correct
# eslint @graphql-eslint/require-import-fragment: 'error'
# import UserFields from 'user-fields.fragment.graphql'
query {
user {
...UserFields
}
}