noDuplicateGraphqlOperationName (GraphQL)
Language GraphQL
Summary
Section titled “Summary”- Rule available since:
v2.3.6 - Diagnostic Category:
lint/suspicious/noDuplicateGraphqlOperationName - This rule isn’t recommended, so you need to enable it.
- This rule doesn’t have a fix.
- The default severity of this rule is warning.
- Sources:
- Inspired from
@graphql-eslint/unique-operation-name
- Inspired from
How to configure
Section titled “How to configure”{ "linter": { "rules": { "suspicious": { "noDuplicateGraphqlOperationName": "error" } } }}Description
Section titled “Description”Require unique operation names within a GraphQL document.
Distinct names let clients, logs, and debugging tools identify each query, mutation, or subscription without ambiguity.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”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 }}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.