# types-sorted

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

This rule checks that the type definitions of a document, and its directive definitions 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:
        types-sorted: warning
```

The rule can be disabled for a node and everything nested in it with an `# apigenie-lint-disable types-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 Query { me: User }
type User { id: ID! }
```

**Bad**. The linter reports `Type 'Query' should come before 'User'`.

```graphql
type User { id: ID! }
type Query { me: User }
```

## When Not to Use It

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