noDuplicateFields
Ce contenu n’est pas encore disponible dans votre langue.
Summary
Section titled “Summary”- Rule available since:
v1.9.0 - Diagnostic Category:
lint/suspicious/noDuplicateFields - This rule is recommended, meaning it is enabled by default.
- This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
How to configure
Section titled “How to configure”{ "linter": { "rules": { "suspicious": { "noDuplicateFields": "error" } } }}Description
Section titled “Description”No duplicated fields in GraphQL operations.
Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”query { users { id name email name }}code-block.graphql:6:5 lint/suspicious/noDuplicateFields ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Field `name` defined multiple times.
4 │ name
5 │ email
> 6 │ name
│ ^^^^
7 │ }
8 │ }
ℹ Remove the duplicated field.
query { users( first: 100, after: 10, filter: "test", first: 50 ) { id }}code-block.graphql:6:5 lint/suspicious/noDuplicateFields ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Argument `first` defined multiple times.
4 │ after: 10,
5 │ filter: “test”,
> 6 │ first: 50
│ ^^^^^^^^^
7 │ ) {
8 │ id
ℹ Remove the duplicated argument.
query ($v: String, $t: String, $v: String) { id}code-block.graphql:1:32 lint/suspicious/noDuplicateFields ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Variable `v` defined multiple times.
> 1 │ query ($v: String, $t: String, $v: String) {
│ ^^^^^^^^^^
2 │ id
3 │ }
ℹ Remove the duplicated variable.
query { users { id name email }}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.