noDuplicateFieldDefinitionNames (GraphQL)
Language GraphQL
Summary
Section titled “Summary”- Rule available since:
v2.3.11 - Diagnostic Category:
lint/correctness/noDuplicateFieldDefinitionNames - This rule is recommended, meaning it is enabled by default.
- This rule doesn’t have a fix.
- The default severity of this rule is error.
- Sources:
How to configure
Section titled “How to configure”{ "linter": { "rules": { "correctness": { "noDuplicateFieldDefinitionNames": "error" } } }}Description
Section titled “Description”Require all fields of a type to be unique.
A GraphQL complex type is only valid if all its fields are uniquely named.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”type SomeObject { foo: String foo: String}code-block.graphql:2:3 lint/correctness/noDuplicateFieldDefinitionNames ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The field name "foo" is used more than once.
1 │ type SomeObject {
> 2 │ foo: String
│ ^^^
3 │ foo: String
4 │ }
ℹ The field "foo" is repeated here.
1 │ type SomeObject {
2 │ foo: String
> 3 │ foo: String
│ ^^^
4 │ }
5 │
ℹ A GraphQL complex type is only valid if all its fields are uniquely named. Make sure to name every field differently.
interface SomeObject { foo: String foo: String}code-block.graphql:2:3 lint/correctness/noDuplicateFieldDefinitionNames ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The field name "foo" is used more than once.
1 │ interface SomeObject {
> 2 │ foo: String
│ ^^^
3 │ foo: String
4 │ }
ℹ The field "foo" is repeated here.
1 │ interface SomeObject {
2 │ foo: String
> 3 │ foo: String
│ ^^^
4 │ }
5 │
ℹ A GraphQL complex type is only valid if all its fields are uniquely named. Make sure to name every field differently.
input SomeObject { foo: String foo: String}code-block.graphql:2:3 lint/correctness/noDuplicateFieldDefinitionNames ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The field name "foo" is used more than once.
1 │ input SomeObject {
> 2 │ foo: String
│ ^^^
3 │ foo: String
4 │ }
ℹ The field "foo" is repeated here.
1 │ input SomeObject {
2 │ foo: String
> 3 │ foo: String
│ ^^^
4 │ }
5 │
ℹ A GraphQL complex type is only valid if all its fields are uniquely named. Make sure to name every field differently.
type SomeObject { foo: String bar: String}interface SomeObject { foo: String bar: String}input SomeObject { foo: String bar: String}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.