Skip to content

useLoneAnonymousOperation

biome.json
{
"linter": {
"rules": {
"correctness": {
"useLoneAnonymousOperation": "error"
}
}
}
}

Disallow anonymous operations when more than one operation specified in document.

A GraphQL document that contains an anonymous operation (the query short-hand) is only valid if it contains only that one operation definition.

query {
fieldA
}
query B {
fieldB
}
code-block.graphql:1:1 lint/correctness/useLoneAnonymousOperation ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Document contains an anonymous operation while defining more than one operation. This anonymous operation must be the only defined operation in this document or turned into a named operation.

> 1 │ query {
^^^^^^^
> 2 │ fieldA
> 3 │ }
^
4 │
5 │ query B {

A GraphQL document that contains an anonymous operation (the query short-hand) is only valid if it contains only that one operation definition.

query A {
fieldA
}
query B {
fieldB
}