alphabetize
| Property | Value |
|---|---|
| Config name | alphabetize |
| Default severity | — |
| Context | Document + Schema |
| In recommended | No |
What it checks
Section titled “What it checks”Enforce alphabetical ordering of selections, arguments, and variables.
Examples
Section titled “Examples”# ❌ Bad — unsorted fieldsquery GetUser { user { name id email }}# ✅ Good — alphabetized fieldsquery GetUser { user { email id name }}Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
selections | bool | string[] | true | Enforce alphabetical order in selection sets. Pass true or a list of owner kinds (OperationDefinition, FragmentDefinition). |
arguments | bool | string[] | false | Enforce alphabetical order on arguments. Pass true or a list of AST kinds (FieldDefinition, Field, …). |
variables | bool | false | Enforce alphabetical order on variable definitions. |
definitions | bool | false | Enforce alphabetical order on top-level type definitions across the document (schema-side). |
fields | bool | string[] | false | Enforce alphabetical order on field declarations. true covers all type kinds; pass an array to scope to specific kinds (e.g. ObjectTypeDefinition). |
values | bool | false | Enforce alphabetical order on enum value declarations. |
groups | string[] | [] | Explicit ordering groups (e.g. ["id", "*", "createdAt"]). Names in earlier groups sort first; "*" is the catch-all bucket. |
Configuration
Section titled “Configuration”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"]