useUniqueGraphqlOperationName
Summary
Section titled “Summary”- Rule available since:
v2.3.6 - Diagnostic Category:
lint/nursery/useUniqueGraphqlOperationName - This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
- Inspired from
@graphql-eslint/unique-operation-name
- Inspired from
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useUniqueGraphqlOperationName": "error" } } }}Description
Section titled “Description”Enforce unique operation names across a GraphQL document.
This rule ensures that all GraphQL operations (queries, mutations, subscriptions) have unique names. Using unique operation names is essential for proper identification and reducing confusion.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”query user { user { id }}
query user { me { id }}code-block.graphql:7:1 lint/nursery/useUniqueGraphqlOperationName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ 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.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
query user { user { id }}
query me { me { id }}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.