Skip to Content
🚧 This is WIP documentation for v4 of the plugin. For v3 click here.
ESLGraphQL-ESLint
Rulesunique-operation-name

unique-operation-name

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

  • Category: Operations
  • Rule name: @graphql-eslint/unique-operation-name
  • Requires GraphQL Schema: false ℹ️
  • Requires GraphQL Operations: true ℹ️
Enforce unique operation names across your project.

Usage Examples

Incorrect

# eslint @graphql-eslint/unique-operation-name: 'error'
 
# foo.query.graphql
query user {
  user {
    id
  }
}
 
# bar.query.graphql
query user {
  me {
    id
  }
}

Correct

# eslint @graphql-eslint/unique-operation-name: 'error'
 
# foo.query.graphql
query user {
  user {
    id
  }
}
 
# bar.query.graphql
query me {
  me {
    id
  }
}

Resources

Last updated on