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ย ย ย ย | ๐ย /ย ๐ฆ | ๐ย /ย ๐ฎ | ๐งย /ย ๐ก |
---|---|---|---|---|---|
alphabetize | Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more. | ๐ ๐ฆ | ๐ | ๐ง | |
description-style | Require all comments to follow the same style (either block or inline). | ๐ | ๐ | ๐ก | |
executable-definitions | A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions. | ๐ฆ | ๐ฎ | ||
fields-on-correct-type | A GraphQL document is only valid if all fields selected are defined by the parent type, or are an allowed meta field such as __typename . | ๐ฆ | ๐ฎ | ๐ก | |
fragments-on-composite-type | Fragments 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. | ๐ฆ | ๐ฎ | ||
input-name | Require mutation argument to be always called โinputโ and input type to be called Mutation name + โInputโ. | ๐ | ๐ | ๐ก | |
known-argument-names | A GraphQL field is only valid if all supplied arguments are defined by that field. | ๐ ๐ฆ | ๐ฎ | ๐ก | |
known-directives | A GraphQL document is only valid if all @directive s are known by the schema and legally positioned. | ๐ ๐ฆ | ๐ฎ | ||
known-fragment-names | A GraphQL document is only valid if all ...Fragment fragment spreads refer to fragments defined in the same document. | ๐ฆ | ๐ฎ | ||
known-type-names | A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema. | ๐ ๐ฆ | ๐ฎ | ๐ก | |
lone-anonymous-operation | A GraphQL document that contains an anonymous operation (the query short-hand) is only valid if it contains only that one operation definition. | ๐ฆ | ๐ฎ | ||
lone-executable-definition | Require queries, mutations, subscriptions or fragments to be located in separate files. | ๐ฆ | ๐ | ||
lone-schema-definition | A GraphQL document is only valid if it contains only one schema definition. | ๐ | ๐ฎ | ||
match-document-filename | This rule allows you to enforce that the file name should match the operation name. | ๐ฆ | ๐ | ||
naming-convention | Require names to follow specified conventions. | ๐ ๐ฆ | ๐ | ๐ก | |
no-anonymous-operations | Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes. | ๐ฆ | ๐ | ๐ก | |
no-deprecated | Enforce that deprecated fields or enum values are not in use by operations. | ๐ฆ | ๐ | ๐ก | |
no-duplicate-fields | Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field. | ๐ฆ | ๐ | ๐ก | |
no-fragment-cycles | A GraphQL fragment is only valid when it does not have cycles in fragments usage. | ๐ฆ | ๐ฎ | ||
no-hashtag-description | Requires to use """ or " for adding a GraphQL description instead of # . | ๐ | ๐ | ๐ก | |
no-one-place-fragments | Disallow fragments that are used only in one place. | ๐ฆ | ๐ | ||
no-root-type | Disallow using root types mutation and/or subscription . | ๐ | ๐ | ๐ก | |
no-scalar-result-type-on-mutation | Avoid scalar result type on mutation type to make sure to return a valid state. | ๐ | ๐ | ๐ก | |
no-typename-prefix | Enforces users to avoid using the type name in a field name while defining your schema. | ๐ | ๐ | ๐ก | |
no-undefined-variables | A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation. | ๐ฆ | ๐ฎ | ||
no-unreachable-types | Requires all types to be reachable at some level by root level fields. | ๐ | ๐ | ๐ก | |
no-unused-fields | Requires all fields to be used at some level by siblings operations. | ๐ | ๐ | ๐ก | |
no-unused-fragments | A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations. | ๐ฆ | ๐ฎ | ||
no-unused-variables | A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment. | ๐ฆ | ๐ฎ | ||
one-field-subscriptions | A GraphQL subscription is valid only if it contains a single root field. | ๐ฆ | ๐ฎ | ||
overlapping-fields-can-be-merged | A selection set is only valid if all fields (including spreading any fragments) either correspond to distinct response names or can be merged without ambiguity. | ๐ฆ | ๐ฎ | ||
possible-fragment-spread | A 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. | ๐ฆ | ๐ฎ | ||
possible-type-extension | A type extension is only valid if the type is defined and has the same kind. | ๐ | ๐ฎ | ๐ก | |
provided-required-arguments | A field or directive is only valid if all required (non-null without a default value) field arguments have been provided. | ๐ ๐ฆ | ๐ฎ | ||
relay-arguments | Set of rules to follow Relay specification for Arguments. | ๐ | ๐ | ||
relay-connection-types | Set of rules to follow Relay specification for Connection types. | ๐ | ๐ | ||
relay-edge-types | Set of rules to follow Relay specification for Edge types. | ๐ | ๐ | ||
relay-page-info | Set of rules to follow Relay specification for PageInfo object. | ๐ | ๐ | ||
require-deprecation-date | Require deletion date on @deprecated directive. Suggest removing deprecated things after deprecated date. | ๐ | ๐ | ๐ก | |
require-deprecation-reason | Require all deprecation directives to specify a reason. | ๐ | ๐ | ||
require-description | Enforce descriptions in type definitions and operations. | ๐ | ๐ | ||
require-field-of-type-query-in-mutation-result | Allow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application. | ๐ | ๐ | ||
require-import-fragment | Require fragments to be imported via an import expression. | ๐ฆ | ๐ | ๐ก | |
require-nullable-fields-with-oneof | Require input or type fields to be non-nullable with @oneOf directive. | ๐ | ๐ | ||
require-nullable-result-in-root | Require nullable fields in root types. | ๐ | ๐ | ๐ก | |
require-selections | Enforce selecting specific fields when they are available on the GraphQL type. | ๐ฆ | ๐ | ๐ก | |
require-type-pattern-with-oneof | Enforce types with @oneOf directive have error and ok fields. | ๐ | ๐ | ||
scalar-leafs | A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types. | ๐ฆ | ๐ฎ | ๐ก | |
selection-set-depth | Limit the complexity of the GraphQL operations solely by their depth. Based on graphql-depth-limitโ. | ๐ฆ | ๐ | ๐ก | |
strict-id-in-types | Requires 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. | ๐ | ๐ | ||
unique-argument-names | A GraphQL field or directive is only valid if all supplied arguments are uniquely named. | ๐ฆ | ๐ฎ | ||
unique-directive-names | A GraphQL document is only valid if all defined directives have unique names. | ๐ | ๐ฎ | ||
unique-directive-names-per-location | A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named. | ๐ ๐ฆ | ๐ฎ | ||
unique-enum-value-names | A GraphQL enum type is only valid if all its values are uniquely named. | ๐ | ๐ | ๐ก | |
unique-field-definition-names | A GraphQL complex type is only valid if all its fields are uniquely named. | ๐ | ๐ฎ | ||
unique-fragment-name | Enforce unique fragment names across your project. | ๐ฆ | ๐ | ||
unique-input-field-names | A GraphQL input object value is only valid if all supplied fields are uniquely named. | ๐ฆ | ๐ฎ | ||
unique-operation-name | Enforce unique operation names across your project. | ๐ฆ | ๐ | ||
unique-operation-types | A GraphQL document is only valid if it has only one type per operation. | ๐ | ๐ฎ | ||
unique-type-names | A GraphQL document is only valid if all defined types have unique names. | ๐ | ๐ฎ | ||
unique-variable-names | A GraphQL operation is only valid if all its variables are uniquely named. | ๐ฆ | ๐ฎ | ||
value-literals-of-correct-type | A GraphQL document is only valid if all value literals are of the type expected at their position. | ๐ฆ | ๐ฎ | ๐ก | |
variables-are-input-types | A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object). | ๐ฆ | ๐ฎ | ||
variables-in-allowed-position | Variables passed to field arguments conform to type. | ๐ฆ | ๐ฎ |
Last updated on