🎉 Welcome to the new GraphQL-ESLint website. Try new playground page →
Rules
No Anonymous Operations

no-anonymous-operations

✅ The "extends": "plugin:@graphql-eslint/operations-recommended" property in a configuration file enables this rule.

💡 This rule provides suggestions (opens in a new tab)

  • Category: Operations
  • Rule name: @graphql-eslint/no-anonymous-operations
  • Requires GraphQL Schema: false ℹī¸
  • Requires GraphQL Operations: false ℹī¸

Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes.

Usage Examples

Incorrect

# eslint @graphql-eslint/no-anonymous-operations: 'error'
 
query {
  # ...
}

Correct

# eslint @graphql-eslint/no-anonymous-operations: 'error'
 
query user {
  # ...
}

Resources