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

unique-fragment-name

  • Category: Operations
  • Rule name: @graphql-eslint/unique-fragment-name
  • Requires GraphQL Schema: false ℹī¸
  • Requires GraphQL Operations: true ℹī¸

Enforce unique fragment names across your project.

Usage Examples

Incorrect

# eslint @graphql-eslint/unique-fragment-name: 'error'
 
# user.fragment.graphql
fragment UserFields on User {
  id
  name
  fullName
}
 
# user-fields.graphql
fragment UserFields on User {
  id
}

Correct

# eslint @graphql-eslint/unique-fragment-name: 'error'
 
# user.fragment.graphql
fragment AllUserFields on User {
  id
  name
  fullName
}
 
# user-fields.graphql
fragment UserFields on User {
  id
}

Resources