no-duplicate-fields
✅ 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
ℹ️
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
}
}
Resources
Last updated on