no-duplicate-fields
â
The "extends": "plugin:@graphql-eslint/operations-recommended"
property in a configuration file
enables this rule.
đĄ This rule provides suggestions (opens in a new tab)
- Category:
Operations
- Rule name:
@graphql-eslint/no-duplicate-fields
- Requires GraphQL Schema:
false
âšī¸ - Requires GraphQL Operations:
false
âšī¸
Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.
Usage Examples
Incorrect
# eslint @graphql-eslint/no-duplicate-fields: 'error'
query {
user {
name
email
name # duplicate field
}
}
Incorrect
# eslint @graphql-eslint/no-duplicate-fields: 'error'
query {
users(
first: 100
skip: 50
after: "cji629tngfgou0b73kt7vi5jo"
first: 100 # duplicate argument
) {
id
}
}
Incorrect
# eslint @graphql-eslint/no-duplicate-fields: 'error'
query (
$first: Int!
$first: Int! # duplicate variable
) {
users(first: $first, skip: 50) {
id
}
}