Aller au contenu

useGraphqlNamedOperations

Ce contenu n’est pas encore disponible dans votre langue.

Enforce specifying the name of GraphQL operations.

This is useful because most GraphQL client libraries use the operation name for caching purposes.

query {}
code-block.graphql:1:1 lint/correctness/useGraphqlNamedOperations  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━

Anonymous GraphQL operations are forbidden. Make sure to name your query.

> 1 │ query {}
^^^^^
2 │

Most GraphQL client libraries use the operation name for caching purposes.

Unsafe fix: Rename this query to Query.

1 │ query·Query{}
+++++
query Human {
name
}
biome.json
{
"linter": {
"rules": {
"correctness": {
"useGraphqlNamedOperations": "error"
}
}
}
}