Skip to content

noDuplicateGraphqlOperationName (GraphQL)

Language GraphQL
biome.json
{
"linter": {
"rules": {
"suspicious": {
"noDuplicateGraphqlOperationName": "error"
}
}
}
}

Require unique operation names within a GraphQL document.

Distinct names let clients, logs, and debugging tools identify each query, mutation, or subscription without ambiguity.

query user {
user {
id
}
}
query user {
me {
id
}
}
code-block.graphql:7:1 lint/suspicious/noDuplicateGraphqlOperationName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

⚠ Operation named "user" is already defined.

5 │ }
6 │
> 7 │ query user {
│ ^^^^^^^^^^^^
> 8 │ me {
> 9 │ id
> 10 │ }
> 11 │ }
│ ^
12 │

ℹ GraphQL operation names must be unique to ensure proper identification.

ℹ Rename the operation to have a unique name.

query user {
user {
id
}
}
query me {
me {
id
}
}