Skip to content

alphabetize

PropertyValue
Config namealphabetize
Default severity
ContextDocument + Schema
In recommendedNo

Enforce alphabetical ordering of selections, arguments, and variables.

# ❌ Bad — unsorted fields
query GetUser {
user {
name
id
email
}
}
# ✅ Good — alphabetized fields
query GetUser {
user {
email
id
name
}
}
OptionTypeDefaultDescription
selectionsbool | string[]trueEnforce alphabetical order in selection sets. Pass true or a list of owner kinds (OperationDefinition, FragmentDefinition).
argumentsbool | string[]falseEnforce alphabetical order on arguments. Pass true or a list of AST kinds (FieldDefinition, Field, …).
variablesboolfalseEnforce alphabetical order on variable definitions.
definitionsboolfalseEnforce alphabetical order on top-level type definitions across the document (schema-side).
fieldsbool | string[]falseEnforce alphabetical order on field declarations. true covers all type kinds; pass an array to scope to specific kinds (e.g. ObjectTypeDefinition).
valuesboolfalseEnforce alphabetical order on enum value declarations.
groupsstring[][]Explicit ordering groups (e.g. ["id", "*", "createdAt"]). Names in earlier groups sort first; "*" is the catch-all bucket.
extensions:
graphql-analyzer:
lint:
rules:
alphabetize: [warn, { selections: true, arguments: true, variables: true }]
# Schema-side example
alphabetize:
- warn
- definitions: true
fields: true
values: true
groups: ["id", "*", "createdAt", "updatedAt"]