🎉 Welcome to the new GraphQL-ESLint website. Try new playground page →
Rules
Unique Enum Value Names

unique-enum-value-names

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

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

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

A GraphQL enum type is only valid if all its values are uniquely named.

This rule disallows case-insensitive enum values duplicates too.

Usage Examples

Incorrect

# eslint @graphql-eslint/unique-enum-value-names: 'error'
 
enum MyEnum {
  Value
  VALUE
  ValuE
}

Correct

# eslint @graphql-eslint/unique-enum-value-names: 'error'
 
enum MyEnum {
  Value1
  Value2
  Value3
}

Resources