- Category:
Stylistic Issues
- Rule name:
@graphql-eslint/avoid-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/avoid-duplicate-fields: 'error'
query getUserDetails {
user {
name # first
email
name # second
}
}
# eslint @graphql-eslint/avoid-duplicate-fields: 'error'
query getUsers {
users(
first: 100
skip: 50
after: "cji629tngfgou0b73kt7vi5jo"
first: 100 # duplicate argument
) {
id
}
}
# eslint @graphql-eslint/avoid-duplicate-fields: 'error'
query getUsers($first: Int!, $first: Int!) {
# Duplicate variable
users(first: 100, skip: 50, after: "cji629tngfgou0b73kt7vi5jo") {
id
}
}