🎉 Welcome to the new GraphQL-ESLint website. Try new playground page →
Rules
Unique Operation Name

unique-operation-name

  • 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