# GraphQL linter rules

Source: https://apigenie.pl/docs/linter/graphql
See also: [Linter rules](https://apigenie.pl/docs/linter.md), [Recommended ruleset](https://apigenie.pl/docs/linter/graphql/rulesets/recommended.md), [Strict ruleset](https://apigenie.pl/docs/linter/graphql/rulesets/strict.md), [All ruleset](https://apigenie.pl/docs/linter/graphql/rulesets/all.md), [Relay ruleset](https://apigenie.pl/docs/linter/graphql/rulesets/relay.md).

The linter reads GraphQL schemas and operations.

## Rulesets

- [Recommended ruleset](/docs/linter/graphql/rulesets/recommended.md)
- [Strict ruleset](/docs/linter/graphql/rulesets/strict.md)
- [All ruleset](/docs/linter/graphql/rulesets/all.md)
- [Relay ruleset](/docs/linter/graphql/rulesets/relay.md)

## Rules

| Rule | What it checks | Since |
| --- | --- | --- |
| [`argument-description-defined`](/docs/linter/graphql/rules/argument-description-defined.md) | This rule checks that the arguments of fields and directives have a description. | 0.9.0 |
| [`argument-naming`](/docs/linter/graphql/rules/argument-naming.md) | This rule checks that the argument names follow a naming convention, camelCase by default. | 0.9.0 |
| [`arguments-sorted`](/docs/linter/graphql/rules/arguments-sorted.md) | This rule checks that the arguments of field and directive definitions are in alphabetical order. | 0.9.0 |
| [`custom-scalar-specified-by`](/docs/linter/graphql/rules/custom-scalar-specified-by.md) | This rule checks that custom scalars link their specification with `@specifiedBy`. | 0.9.0 |
| [`deprecation-date-defined`](/docs/linter/graphql/rules/deprecation-date-defined.md) | This rule checks that `@deprecated` directives have a deletion date that has not passed. | 0.9.0 |
| [`deprecation-reason-defined`](/docs/linter/graphql/rules/deprecation-reason-defined.md) | This rule checks that `@deprecated` directives have a reason. | 0.9.0 |
| [`description-capitalized`](/docs/linter/graphql/rules/description-capitalized.md) | This rule checks that descriptions start with a capital letter. | 0.9.0 |
| [`description-style`](/docs/linter/graphql/rules/description-style.md) | This rule checks that descriptions are written as block strings, or as single-line strings. | 0.9.0 |
| [`directive-description-defined`](/docs/linter/graphql/rules/directive-description-defined.md) | This rule checks that directive definitions have a description. | 0.9.0 |
| [`directive-naming`](/docs/linter/graphql/rules/directive-naming.md) | This rule checks that directive names follow a naming convention, camelCase by default. | 0.9.0 |
| [`enum-value-description-defined`](/docs/linter/graphql/rules/enum-value-description-defined.md) | This rule checks that enum values have a description. | 0.9.0 |
| [`enum-value-naming`](/docs/linter/graphql/rules/enum-value-naming.md) | This rule checks that enum value names follow a naming convention, CONST_CASE by default. | 0.9.0 |
| [`enum-values-sorted`](/docs/linter/graphql/rules/enum-values-sorted.md) | This rule checks that the values of each enum type definition and extension are in alphabetical order. | 0.9.0 |
| [`field-description-defined`](/docs/linter/graphql/rules/field-description-defined.md) | This rule checks that the fields of object and interface types have a description. | 0.9.0 |
| [`field-naming`](/docs/linter/graphql/rules/field-naming.md) | This rule checks that the field names follow a naming convention, camelCase by default. | 0.9.0 |
| [`fields-on-correct-type`](/docs/linter/graphql/rules/fields-on-correct-type.md) | This rule checks that the fields selected by operations are defined by their parent types. | 0.9.0 |
| [`fields-sorted`](/docs/linter/graphql/rules/fields-sorted.md) | This rule checks that the fields of each object and interface type definition and extension are in alphabetical order. | 0.9.0 |
| [`fragment-naming`](/docs/linter/graphql/rules/fragment-naming.md) | This rule checks that fragment names follow a naming convention, PascalCase by default. | 0.9.0 |
| [`input-field-description-defined`](/docs/linter/graphql/rules/input-field-description-defined.md) | This rule checks that the fields of input object types have a description. | 0.9.0 |
| [`input-field-naming`](/docs/linter/graphql/rules/input-field-naming.md) | This rule checks that the input field names follow a naming convention, camelCase by default. | 0.9.0 |
| [`input-fields-sorted`](/docs/linter/graphql/rules/input-fields-sorted.md) | This rule checks that the fields of each input object type definition and extension are in alphabetical order. | 0.9.0 |
| [`input-no-circular-non-null`](/docs/linter/graphql/rules/input-no-circular-non-null.md) | This rule checks that input object types don't reference themselves through non-null fields. | 0.9.0 |
| [`input-output-types`](/docs/linter/graphql/rules/input-output-types.md) | This rule checks that arguments and input fields have input types, and fields have output types, as the GraphQL specification requires. | 0.9.0 |
| [`input-type-suffix`](/docs/linter/graphql/rules/input-type-suffix.md) | This rule checks that input object type names end with a suffix, `Input` by default. | 0.9.0 |
| [`interface-implementation`](/docs/linter/graphql/rules/interface-implementation.md) | This rule checks that object and interface types implement their interfaces with all their fields, compatible field types and matching arguments, as the GraphQL specification requires. | 0.9.0 |
| [`known-argument-names`](/docs/linter/graphql/rules/known-argument-names.md) | This rule checks that the arguments given to fields and directives are defined by them. | 0.9.0 |
| [`known-directive-locations`](/docs/linter/graphql/rules/known-directive-locations.md) | This rule checks that directives are used at one of the locations of their definition, as the GraphQL specification requires. | 0.9.0 |
| [`known-fragment-names`](/docs/linter/graphql/rules/known-fragment-names.md) | This rule checks that fragment spreads name fragments of the document, as the GraphQL specification requires. | 0.9.0 |
| [`known-types`](/docs/linter/graphql/rules/known-types.md) | This rule checks that the types referenced by type system definitions are built-in scalars or defined in the document, as the GraphQL specification requires. | 0.9.0 |
| [`lone-anonymous-operation`](/docs/linter/graphql/rules/lone-anonymous-operation.md) | This rule checks that an anonymous operation is the only operation of the document, as the GraphQL specification requires. | 0.9.0 |
| [`lone-executable-definition`](/docs/linter/graphql/rules/lone-executable-definition.md) | This rule checks that a document holds a single operation or fragment. | 0.9.0 |
| [`lone-schema-definition`](/docs/linter/graphql/rules/lone-schema-definition.md) | This rule checks that a document has at most one schema definition, as the GraphQL specification requires. | 0.9.0 |
| [`match-document-filename`](/docs/linter/graphql/rules/match-document-filename.md) | This rule checks that the file name of a document with one operation or fragment is the name of the definition. | 0.9.0 |
| [`mutation-input-argument`](/docs/linter/graphql/rules/mutation-input-argument.md) | This rule checks that mutation fields take a single argument, `input`, of a non-null input object type. | 0.9.0 |
| [`mutation-payload-suffix`](/docs/linter/graphql/rules/mutation-payload-suffix.md) | This rule checks that the result types of mutation fields end with a suffix, `Payload` by default. | 0.9.0 |
| [`no-deprecated`](/docs/linter/graphql/rules/no-deprecated.md) | This rule checks that operations don't use deprecated fields, arguments and enum values. | 0.9.0 |
| [`no-deprecated-required-argument`](/docs/linter/graphql/rules/no-deprecated-required-argument.md) | This rule checks that required arguments and input fields are not deprecated. | 0.9.0 |
| [`no-fragment-cycles`](/docs/linter/graphql/rules/no-fragment-cycles.md) | This rule checks that fragments don't spread themselves, directly or indirectly, as the GraphQL specification requires. | 0.9.0 |
| [`no-get-prefix-on-query-fields`](/docs/linter/graphql/rules/no-get-prefix-on-query-fields.md) | This rule checks that the fields of the query root type are not named `getSomething`. | 0.9.0 |
| [`no-hashtag-description`](/docs/linter/graphql/rules/no-hashtag-description.md) | This rule checks that definitions are documented with descriptions rather than with `#` comments. | 0.9.0 |
| [`no-mixed-definitions`](/docs/linter/graphql/rules/no-mixed-definitions.md) | This rule checks that a document holds either a schema or operations, not both. | 0.9.0 |
| [`no-one-place-fragments`](/docs/linter/graphql/rules/no-one-place-fragments.md) | This rule checks that fragments are spread more than once in the document. | 0.9.0 |
| [`no-root-type`](/docs/linter/graphql/rules/no-root-type.md) | This rule checks that the schema doesn't have the root operation types the configuration disallows. | 0.9.0 |
| [`no-scalar-result-on-mutation`](/docs/linter/graphql/rules/no-scalar-result-on-mutation.md) | This rule checks that mutation fields return object types rather than scalars. | 0.9.0 |
| [`no-type-suffix`](/docs/linter/graphql/rules/no-type-suffix.md) | This rule checks that type names don't end with a redundant suffix such as `Type` or `Enum`. | 0.9.0 |
| [`no-typename-prefix`](/docs/linter/graphql/rules/no-typename-prefix.md) | This rule checks that field names don't start with the name of their type, as in `User.userId`. | 0.9.0 |
| [`no-undefined-variables`](/docs/linter/graphql/rules/no-undefined-variables.md) | This rule checks that the variables used by an operation, including in the fragments it spreads, are defined by the operation, as the GraphQL specification requires. | 0.9.0 |
| [`no-unused-fragments`](/docs/linter/graphql/rules/no-unused-fragments.md) | This rule checks that every fragment is spread by an operation, directly or through other fragments, as the GraphQL specification requires. | 0.9.0 |
| [`no-unused-variables`](/docs/linter/graphql/rules/no-unused-variables.md) | This rule checks that the variables defined by an operation are used, as the GraphQL specification requires. | 0.9.0 |
| [`one-field-subscriptions`](/docs/linter/graphql/rules/one-field-subscriptions.md) | This rule checks that subscriptions select a single root field, as the specification requires. | 0.9.0 |
| [`oneof-fields-nullable`](/docs/linter/graphql/rules/oneof-fields-nullable.md) | This rule checks that the fields of `@oneOf` input object types are nullable and have no default value. | 0.9.0 |
| [`operation-known-types`](/docs/linter/graphql/rules/operation-known-types.md) | This rule checks that the types of variables and the type conditions of fragments are types of the schema. | 0.9.0 |
| [`operation-name-defined`](/docs/linter/graphql/rules/operation-name-defined.md) | This rule checks that operations have names. | 0.9.0 |
| [`operation-name-suffix`](/docs/linter/graphql/rules/operation-name-suffix.md) | This rule checks that operation and fragment names don't end with a redundant suffix. | 0.9.0 |
| [`operation-naming`](/docs/linter/graphql/rules/operation-naming.md) | This rule checks that operation names follow a naming convention, PascalCase by default. | 0.9.0 |
| [`possible-type-extensions`](/docs/linter/graphql/rules/possible-type-extensions.md) | This rule checks that extended types have the same kind as their definition, as the GraphQL specification requires. | 0.9.0 |
| [`query-root-defined`](/docs/linter/graphql/rules/query-root-defined.md) | This rule checks that the schema has a query root operation type. | 0.9.0 |
| [`relay-arguments`](/docs/linter/graphql/rules/relay-arguments.md) | This rule checks that fields returning connections take the pagination arguments of the Relay Cursor Connections specification. | 0.9.0 |
| [`relay-connection-types`](/docs/linter/graphql/rules/relay-connection-types.md) | This rule checks that connection types follow the Relay Cursor Connections specification. | 0.9.0 |
| [`relay-edge-types`](/docs/linter/graphql/rules/relay-edge-types.md) | This rule checks that the edge types of connections follow the Relay Cursor Connections specification. | 0.9.0 |
| [`relay-page-info`](/docs/linter/graphql/rules/relay-page-info.md) | This rule checks that a schema with connections has a `PageInfo` type as the Relay Cursor Connections specification defines it. | 0.9.0 |
| [`require-selections`](/docs/linter/graphql/rules/require-selections.md) | This rule checks that selections of objects with an identifier select it. | 0.9.0 |
| [`required-arguments-provided`](/docs/linter/graphql/rules/required-arguments-provided.md) | This rule checks that the required arguments of fields and directives are given. | 0.9.0 |
| [`reserved-names`](/docs/linter/graphql/rules/reserved-names.md) | This rule checks that the names of types, fields, arguments, enum values and directives don't start with "__", as the GraphQL specification requires. | 0.9.0 |
| [`root-fields-nullable`](/docs/linter/graphql/rules/root-fields-nullable.md) | This rule checks that the fields of the query and mutation root types are nullable. | 0.9.0 |
| [`selection-set-depth`](/docs/linter/graphql/rules/selection-set-depth.md) | This rule checks that selection sets are nested at most 7 levels deep. | 0.9.0 |
| [`selections-sorted`](/docs/linter/graphql/rules/selections-sorted.md) | This rule checks that the fields of each selection set of operations and fragments are in alphabetical order. | 0.9.0 |
| [`spell-check`](/docs/linter/graphql/rules/spell-check.md) | This rule checks the spelling of descriptions and comments. | 0.9.0 |
| [`strict-id-in-types`](/docs/linter/graphql/rules/strict-id-in-types.md) | This rule checks that object types have exactly one non-null identifier field, `id: ID!` by default. | 0.9.0 |
| [`type-description-defined`](/docs/linter/graphql/rules/type-description-defined.md) | This rule checks that type definitions have a description. | 0.9.0 |
| [`type-naming`](/docs/linter/graphql/rules/type-naming.md) | This rule checks that type names follow a naming convention, PascalCase by default. | 0.9.0 |
| [`types-sorted`](/docs/linter/graphql/rules/types-sorted.md) | This rule checks that the type definitions of a document, and its directive definitions are in alphabetical order. | 0.9.0 |
| [`unique-argument-definition-names`](/docs/linter/graphql/rules/unique-argument-definition-names.md) | This rule checks that the argument names of a field or directive definition are unique, as the GraphQL specification requires. | 0.9.0 |
| [`unique-argument-names`](/docs/linter/graphql/rules/unique-argument-names.md) | This rule checks that the argument names of a field or directive are unique, as the GraphQL specification requires. | 0.9.0 |
| [`unique-directive-names`](/docs/linter/graphql/rules/unique-directive-names.md) | This rule checks that directive names are unique, as the GraphQL specification requires. | 0.9.0 |
| [`unique-directives-per-location`](/docs/linter/graphql/rules/unique-directives-per-location.md) | This rule checks that non-repeatable directives are used once per location, as the GraphQL specification requires. | 0.9.0 |
| [`unique-enum-value-names`](/docs/linter/graphql/rules/unique-enum-value-names.md) | This rule checks that the values of an enum are unique across the enum and its extensions, as the GraphQL specification requires. | 0.9.0 |
| [`unique-field-definition-names`](/docs/linter/graphql/rules/unique-field-definition-names.md) | This rule checks that the field names of a type are unique across the type and its extensions, as the GraphQL specification requires. | 0.9.0 |
| [`unique-fragment-names`](/docs/linter/graphql/rules/unique-fragment-names.md) | This rule checks that fragment names are unique, as the GraphQL specification requires. | 0.9.0 |
| [`unique-input-field-names`](/docs/linter/graphql/rules/unique-input-field-names.md) | This rule checks that the field names of an object value are unique, as the GraphQL specification requires. | 0.9.0 |
| [`unique-operation-names`](/docs/linter/graphql/rules/unique-operation-names.md) | This rule checks that operation names are unique, as the GraphQL specification requires. | 0.9.0 |
| [`unique-operation-types`](/docs/linter/graphql/rules/unique-operation-types.md) | This rule checks that each root operation type is defined once across the schema definition and its extensions, as the GraphQL specification requires. | 0.9.0 |
| [`unique-type-names`](/docs/linter/graphql/rules/unique-type-names.md) | This rule checks that type names are unique, as the GraphQL specification requires. | 0.9.0 |
| [`unique-variable-names`](/docs/linter/graphql/rules/unique-variable-names.md) | This rule checks that the variable names of an operation are unique, as the GraphQL specification requires. | 0.9.0 |
| [`unreachable-types`](/docs/linter/graphql/rules/unreachable-types.md) | This rule checks that every type is reachable from the root operation types. | 0.9.0 |
| [`unused-directive-definition`](/docs/linter/graphql/rules/unused-directive-definition.md) | This rule checks that the directives defined for schemas are applied in the document. | 0.9.0 |
| [`variables-sorted`](/docs/linter/graphql/rules/variables-sorted.md) | This rule checks that the variable definitions of each operation are in alphabetical order. | 0.9.0 |
