Skip to Content
🚧 This is WIP documentation for v4 of the plugin. For v3 click here.
ESLGraphQL-ESLint
Rulesunique-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

  • 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

Last updated on