Overview

Each rule has emojis denoting:

  • ๐Ÿ“„ if the rule applies to schema documents
  • ๐Ÿ“ฆ if the rule applies to operations
  • ๐Ÿš€ graphql-eslint rule
  • ๐Ÿ”ฎ graphql-js rule
  • ๐Ÿ”ง if some problems reported by the rule are automatically fixable by the --fix command line option
  • ๐Ÿ’ก if some problems reported by the rule are manually fixable by editor suggestions
Nameย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย Descriptionย ย ย ย Configย ย ย ย ๐Ÿ“„ย /ย ๐Ÿ“ฆ๐Ÿš€ย /ย ๐Ÿ”ฎ๐Ÿ”งย /ย ๐Ÿ’ก
alphabetizeEnforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.all๐Ÿ“„ ๐Ÿ“ฆ๐Ÿš€๐Ÿ”ง
description-styleRequire all comments to follow the same style (either block or inline).recommended๐Ÿ“„๐Ÿš€๐Ÿ’ก
executable-definitionsA GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.recommended๐Ÿ“ฆ๐Ÿ”ฎ
fields-on-correct-typeA GraphQL document is only valid if all fields selected are defined by the parent type, or are an allowed meta field such as __typename.recommended๐Ÿ“ฆ๐Ÿ”ฎ๐Ÿ’ก
fragments-on-composite-typeFragments use a type condition to determine if they apply, since fragments can only be spread into a composite type (object, interface, or union), the type condition must also be a composite type.recommended๐Ÿ“ฆ๐Ÿ”ฎ
input-nameRequire mutation argument to be always called โ€œinputโ€ and input type to be called Mutation name + โ€œInputโ€.all๐Ÿ“„๐Ÿš€๐Ÿ’ก
known-argument-namesA GraphQL field is only valid if all supplied arguments are defined by that field.recommended๐Ÿ“„ ๐Ÿ“ฆ๐Ÿ”ฎ๐Ÿ’ก
known-directivesA GraphQL document is only valid if all @directives are known by the schema and legally positioned.recommended๐Ÿ“„ ๐Ÿ“ฆ๐Ÿ”ฎ
known-fragment-namesA GraphQL document is only valid if all ...Fragment fragment spreads refer to fragments defined in the same document.recommended๐Ÿ“ฆ๐Ÿ”ฎ
known-type-namesA GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.recommended๐Ÿ“„ ๐Ÿ“ฆ๐Ÿ”ฎ๐Ÿ’ก
lone-anonymous-operationA GraphQL document that contains an anonymous operation (the query short-hand) is only valid if it contains only that one operation definition.recommended๐Ÿ“ฆ๐Ÿ”ฎ
lone-executable-definitionRequire queries, mutations, subscriptions or fragments to be located in separate files.all๐Ÿ“ฆ๐Ÿš€
lone-schema-definitionA GraphQL document is only valid if it contains only one schema definition.recommended๐Ÿ“„๐Ÿ”ฎ
match-document-filenameThis rule allows you to enforce that the file name should match the operation name.all๐Ÿ“ฆ๐Ÿš€
naming-conventionRequire names to follow specified conventions.recommended๐Ÿ“„ ๐Ÿ“ฆ๐Ÿš€๐Ÿ’ก
no-anonymous-operationsRequire name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes.recommended๐Ÿ“ฆ๐Ÿš€๐Ÿ’ก
no-deprecatedEnforce that deprecated fields or enum values are not in use by operations.recommended๐Ÿ“ฆ๐Ÿš€๐Ÿ’ก
no-duplicate-fieldsChecks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.recommended๐Ÿ“ฆ๐Ÿš€๐Ÿ’ก
no-fragment-cyclesA GraphQL fragment is only valid when it does not have cycles in fragments usage.recommended๐Ÿ“ฆ๐Ÿ”ฎ
no-hashtag-descriptionRequires to use """ or " for adding a GraphQL description instead of #.recommended๐Ÿ“„๐Ÿš€๐Ÿ’ก
no-one-place-fragmentsDisallow fragments that are used only in one place.all๐Ÿ“ฆ๐Ÿš€
no-root-typeDisallow using root types mutation and/or subscription.all๐Ÿ“„๐Ÿš€๐Ÿ’ก
no-scalar-result-type-on-mutationAvoid scalar result type on mutation type to make sure to return a valid state.all๐Ÿ“„๐Ÿš€๐Ÿ’ก
no-typename-prefixEnforces users to avoid using the type name in a field name while defining your schema.recommended๐Ÿ“„๐Ÿš€๐Ÿ’ก
no-undefined-variablesA GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.recommended๐Ÿ“ฆ๐Ÿ”ฎ
no-unreachable-typesRequires all types to be reachable at some level by root level fields.recommended๐Ÿ“„๐Ÿš€๐Ÿ’ก
no-unused-fieldsRequires all fields to be used at some level by siblings operations.๐Ÿ“„๐Ÿš€๐Ÿ’ก
no-unused-fragmentsA GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.recommended๐Ÿ“ฆ๐Ÿ”ฎ
no-unused-variablesA GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.recommended๐Ÿ“ฆ๐Ÿ”ฎ
one-field-subscriptionsA GraphQL subscription is valid only if it contains a single root field.recommended๐Ÿ“ฆ๐Ÿ”ฎ
overlapping-fields-can-be-mergedA selection set is only valid if all fields (including spreading any fragments) either correspond to distinct response names or can be merged without ambiguity.recommended๐Ÿ“ฆ๐Ÿ”ฎ
possible-fragment-spreadA fragment spread is only valid if the type condition could ever possibly be true: if there is a non-empty intersection of the possible parent types, and possible types which pass the type condition.recommended๐Ÿ“ฆ๐Ÿ”ฎ
possible-type-extensionA type extension is only valid if the type is defined and has the same kind.recommended๐Ÿ“„๐Ÿ”ฎ๐Ÿ’ก
provided-required-argumentsA field or directive is only valid if all required (non-null without a default value) field arguments have been provided.recommended๐Ÿ“„ ๐Ÿ“ฆ๐Ÿ”ฎ
relay-argumentsSet of rules to follow Relay specification for Arguments.relay๐Ÿ“„๐Ÿš€
relay-connection-typesSet of rules to follow Relay specification for Connection types.relay๐Ÿ“„๐Ÿš€
relay-edge-typesSet of rules to follow Relay specification for Edge types.relay๐Ÿ“„๐Ÿš€
relay-page-infoSet of rules to follow Relay specification for PageInfo object.relay๐Ÿ“„๐Ÿš€
require-deprecation-dateRequire deletion date on @deprecated directive. Suggest removing deprecated things after deprecated date.all๐Ÿ“„๐Ÿš€๐Ÿ’ก
require-deprecation-reasonRequire all deprecation directives to specify a reason.recommended๐Ÿ“„๐Ÿš€
require-descriptionEnforce descriptions in type definitions and operations.recommended๐Ÿ“„๐Ÿš€
require-field-of-type-query-in-mutation-resultAllow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application.all๐Ÿ“„๐Ÿš€
require-import-fragmentRequire fragments to be imported via an import expression.all๐Ÿ“ฆ๐Ÿš€๐Ÿ’ก
require-nullable-fields-with-oneofRequire input or type fields to be non-nullable with @oneOf directive.all๐Ÿ“„๐Ÿš€
require-nullable-result-in-rootRequire nullable fields in root types.all๐Ÿ“„๐Ÿš€๐Ÿ’ก
require-selectionsEnforce selecting specific fields when they are available on the GraphQL type.recommended๐Ÿ“ฆ๐Ÿš€๐Ÿ’ก
require-type-pattern-with-oneofEnforce types with @oneOf directive have error and ok fields.all๐Ÿ“„๐Ÿš€
scalar-leafsA GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.recommended๐Ÿ“ฆ๐Ÿ”ฎ๐Ÿ’ก
selection-set-depthLimit the complexity of the GraphQL operations solely by their depth. Based on graphql-depth-limit.recommended๐Ÿ“ฆ๐Ÿš€๐Ÿ’ก
strict-id-in-typesRequires output types to have one unique identifier unless they do not have a logical one. Exceptions can be used to ignore output types that do not have unique identifiers.recommended๐Ÿ“„๐Ÿš€
unique-argument-namesA GraphQL field or directive is only valid if all supplied arguments are uniquely named.recommended๐Ÿ“ฆ๐Ÿ”ฎ
unique-directive-namesA GraphQL document is only valid if all defined directives have unique names.recommended๐Ÿ“„๐Ÿ”ฎ
unique-directive-names-per-locationA GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.recommended๐Ÿ“„ ๐Ÿ“ฆ๐Ÿ”ฎ
unique-enum-value-namesA GraphQL enum type is only valid if all its values are uniquely named.recommended๐Ÿ“„๐Ÿš€๐Ÿ’ก
unique-field-definition-namesA GraphQL complex type is only valid if all its fields are uniquely named.recommended๐Ÿ“„๐Ÿ”ฎ
unique-fragment-nameEnforce unique fragment names across your project.recommended๐Ÿ“ฆ๐Ÿš€
unique-input-field-namesA GraphQL input object value is only valid if all supplied fields are uniquely named.recommended๐Ÿ“ฆ๐Ÿ”ฎ
unique-operation-nameEnforce unique operation names across your project.recommended๐Ÿ“ฆ๐Ÿš€
unique-operation-typesA GraphQL document is only valid if it has only one type per operation.recommended๐Ÿ“„๐Ÿ”ฎ
unique-type-namesA GraphQL document is only valid if all defined types have unique names.recommended๐Ÿ“„๐Ÿ”ฎ
unique-variable-namesA GraphQL operation is only valid if all its variables are uniquely named.recommended๐Ÿ“ฆ๐Ÿ”ฎ
value-literals-of-correct-typeA GraphQL document is only valid if all value literals are of the type expected at their position.recommended๐Ÿ“ฆ๐Ÿ”ฎ๐Ÿ’ก
variables-are-input-typesA GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).recommended๐Ÿ“ฆ๐Ÿ”ฎ
variables-in-allowed-positionVariables passed to field arguments conform to type.recommended๐Ÿ“ฆ๐Ÿ”ฎ