alphabetize
Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.
🔧 The --fix option on the
command line can automatically
fix some of the problems reported by this rule.
- Category:
Schema & Operations - Rule name:
@graphql-eslint/alphabetize - Requires GraphQL Schema:
falseℹ️ - Requires GraphQL Operations:
falseℹ️
Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.
Usage Examples
Incorrect
Correct
Incorrect
Correct
Incorrect
Correct
Config Schema
The schema defines the following properties:
fields (array)
Fields of type, interface, and input.
The elements of the array can contain the following enum values:
ObjectTypeDefinitionInterfaceTypeDefinitionInputObjectTypeDefinition
Additional restrictions:
- Minimum items:
1 - Unique items:
true
values (boolean)
Values of enum.
selections (array)
Selections of fragment and operations query, mutation and subscription.
The elements of the array can contain the following enum values:
OperationDefinitionFragmentDefinition
Additional restrictions:
- Minimum items:
1 - Unique items:
true
variables (boolean)
Variables of operations query, mutation and subscription.
arguments (array)
Arguments of fields and directives.
The elements of the array can contain the following enum values:
FieldDefinitionFieldDirectiveDefinitionDirective
Additional restrictions:
- Minimum items:
1 - Unique items:
true
definitions (boolean)
Definitions – type, interface, enum, scalar, input, union and directive.
groups (array)
Order group. Example: ['...', 'id', '*', '{'] where:
...stands for fragment spreadsidstands for field with nameid*stands for everything else{stands for fieldsselection set
The object is an array with all elements of the type string.
Additional restrictions:
- Minimum items:
2 - Unique items:
true