# fields-sorted

Source: https://apigenie.pl/docs/linter/graphql/rules/fields-sorted

This rule checks that the fields of each object and interface type definition and extension are in alphabetical order.

## Rule Details

Sorted definitions are easier to find and produce smaller diffs. Names are compared ignoring case; the first name out of order of each list is reported.

## Configuration

This rule has no options.

```yaml
version: "1.0"
commands:
  lint:
    graphql:
      rules:
        fields-sorted: warning
```

The rule can be disabled for a node and everything nested in it with an `# apigenie-lint-disable fields-sorted` comment on the node, or for a whole file with the comment at the top of the file, separated from the first definition by a blank line. It applies to definitions.

## Examples

**Good**.

```graphql
type User { email: String, id: ID!, name: String }
```

**Bad**. The linter reports `Field 'email' should come before 'id'`.

```graphql
type User { id: ID!, email: String }
```

## When Not to Use It

Disable this rule when the order of definitions is meaningful, e.g. the most important fields first.
