useSortedTypeFields (GraphQL)
Language GraphQL
Summary
Section titled “Summary”- Rule available since:
v2.5.0 - 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 by name.
The action sorts fields inside type, interface, and input definitions. Underscores
come first, followed by digits and then letters. Letter case is ignored first; when names
otherwise match, lowercase letters come before uppercase letters.
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.