✅ The "extends": "plugin:@graphql-eslint/operations-recommended"
property in a configuration file enables this rule.
💡 This rule provides suggestions
- 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.
# eslint @graphql-eslint/no-duplicate-fields: 'error'
query {
user {
name
email
name # duplicate field
}
}
# eslint @graphql-eslint/no-duplicate-fields: 'error'
query {
users(
first: 100
skip: 50
after: "cji629tngfgou0b73kt7vi5jo"
first: 100 # duplicate argument
) {
id
}
}
# eslint @graphql-eslint/no-duplicate-fields: 'error'
query (
$first: Int!
$first: Int! # duplicate variable
) {
users(first: $first, skip: 50) {
id
}
}