useSortedTypeFields
Summary
Section titled “Summary”- Diagnostic Category:
assist/source/useSortedTypeFields - Sources:
- Inspired from
@graphql-eslint/alphabetize
- Inspired from
How to enable in your editor
Section titled “How to enable in your editor”{ "editor.codeActionsOnSave": { "source.action.useSortedTypeFields.biome": "explicit", "source.fixAll.biome": "explicit" }}{ "code_actions_on_format": { "source.action.useSortedTypeFields.biome": true, "source.fixAll.biome": true }}
Use the source action code
source.action.useSortedTypeFields.biome How to configure
Section titled “How to configure”{ "assist": { "actions": { "source": { "useSortedTypeFields": "on" } } }}Description
Section titled “Description”Sort fields in GraphQL type definitions alphabetically.
This rule ensures that fields within type, interface, and input
definitions are sorted alphabetically. For GraphQL identifiers ([A-Za-z0-9_]),
the sort order matches JavaScript’s localeCompare(), including case handling.
Examples
Section titled “Examples”type User { name: String age: Int id: ID}code-block.graphql ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Source action diff:
1 1 │ type User {
2 │ - ··name:·String
3 │ - ··age:·Int
4 │ - ··id:·ID
2 │ + ··age:·Int
3 │ + ··id:·ID
4 │ + ··name:·String
5 5 │ }
6 6 │
interface Node { name: String id: ID}code-block.graphql ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Source action diff:
1 1 │ interface Node {
2 │ - ··name:·String
3 │ - ··id:·ID
2 │ + ··id:·ID
3 │ + ··name:·String
4 4 │ }
5 5 │
input CreateUserInput { name: String age: Int}code-block.graphql ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Source action diff:
1 1 │ input CreateUserInput {
2 │ - ··name:·String
3 │ - ··age:·Int
2 │ + ··age:·Int
3 │ + ··name:·String
4 4 │ }
5 5 │
Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.