Skip to Content
🚧 This is WIP documentation for v4 of the plugin. For v3 click here.
ESLGraphQL-ESLint
Rulesno-anonymous-operations

no-anonymous-operations

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

💡 This rule provides suggestions

  • 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

Last updated on