|
1 | 1 | ## Available Rules
|
2 | 2 |
|
3 | 3 |
|
4 |
| -- [`avoid-typename-prefix`](./rules/avoid-typename-prefix.md) |
5 |
| -- [`no-unreachable-types`](./rules/no-unreachable-types.md) |
6 |
| -- [`no-unused-fields`](./rules/no-unused-fields.md) |
7 |
| -- [`no-deprecated`](./rules/no-deprecated.md) |
8 |
| -- [`unique-fragment-name`](./rules/unique-fragment-name.md) |
9 |
| -- [`unique-operation-name`](./rules/unique-operation-name.md) |
10 |
| -- [`no-hashtag-description`](./rules/no-hashtag-description.md) |
11 |
| -- [`no-anonymous-operations`](./rules/no-anonymous-operations.md) |
12 |
| -- [`no-operation-name-suffix`](./rules/no-operation-name-suffix.md) |
13 |
| -- [`require-deprecation-reason`](./rules/require-deprecation-reason.md) |
14 |
| -- [`avoid-operation-name-prefix`](./rules/avoid-operation-name-prefix.md) |
15 |
| -- [`selection-set-depth`](./rules/selection-set-depth.md) |
16 |
| -- [`no-case-insensitive-enum-values-duplicates`](./rules/no-case-insensitive-enum-values-duplicates.md) |
17 |
| -- [`require-description`](./rules/require-description.md) |
18 |
| -- [`require-id-when-available`](./rules/require-id-when-available.md) |
19 |
| -- [`description-style`](./rules/description-style.md) |
20 |
| -- [`avoid-duplicate-fields`](./rules/avoid-duplicate-fields.md) |
21 |
| -- [`naming-convention`](./rules/naming-convention.md) |
22 |
| -- [`input-name`](./rules/input-name.md) |
23 |
| -- [`strict-id-in-types`](./rules/strict-id-in-types.md) |
24 |
| -- [`executable-definitions`](./rules/executable-definitions.md) |
25 |
| -- [`fields-on-correct-type`](./rules/fields-on-correct-type.md) |
26 |
| -- [`fragments-on-composite-type`](./rules/fragments-on-composite-type.md) |
27 |
| -- [`known-argument-names`](./rules/known-argument-names.md) |
28 |
| -- [`known-directives`](./rules/known-directives.md) |
29 |
| -- [`known-fragment-names`](./rules/known-fragment-names.md) |
30 |
| -- [`known-type-names`](./rules/known-type-names.md) |
31 |
| -- [`lone-anonymous-operation`](./rules/lone-anonymous-operation.md) |
32 |
| -- [`lone-schema-definition`](./rules/lone-schema-definition.md) |
33 |
| -- [`no-fragment-cycles`](./rules/no-fragment-cycles.md) |
34 |
| -- [`no-undefined-variables`](./rules/no-undefined-variables.md) |
35 |
| -- [`no-unused-fragments`](./rules/no-unused-fragments.md) |
36 |
| -- [`no-unused-variables`](./rules/no-unused-variables.md) |
37 |
| -- [`overlapping-fields-can-be-merged`](./rules/overlapping-fields-can-be-merged.md) |
38 |
| -- [`possible-fragment-spread`](./rules/possible-fragment-spread.md) |
39 |
| -- [`possible-type-extension`](./rules/possible-type-extension.md) |
40 |
| -- [`provided-required-arguments`](./rules/provided-required-arguments.md) |
41 |
| -- [`scalar-leafs`](./rules/scalar-leafs.md) |
42 |
| -- [`one-field-subscriptions`](./rules/one-field-subscriptions.md) |
43 |
| -- [`unique-argument-names`](./rules/unique-argument-names.md) |
44 |
| -- [`unique-directive-names`](./rules/unique-directive-names.md) |
45 |
| -- [`unique-directive-names-per-location`](./rules/unique-directive-names-per-location.md) |
46 |
| -- [`unique-enum-value-names`](./rules/unique-enum-value-names.md) |
47 |
| -- [`unique-field-definition-names`](./rules/unique-field-definition-names.md) |
48 |
| -- [`unique-input-field-names`](./rules/unique-input-field-names.md) |
49 |
| -- [`unique-operation-types`](./rules/unique-operation-types.md) |
50 |
| -- [`unique-type-names`](./rules/unique-type-names.md) |
51 |
| -- [`unique-variable-names`](./rules/unique-variable-names.md) |
52 |
| -- [`value-literals-of-correct-type`](./rules/value-literals-of-correct-type.md) |
53 |
| -- [`variables-are-input-types`](./rules/variables-are-input-types.md) |
54 |
| -- [`variables-in-allowed-position`](./rules/variables-in-allowed-position.md) |
| 4 | +Each rule has emojis denoting: |
| 5 | + |
| 6 | +* 🚀 `@graphql-eslint` rule |
| 7 | +* 🔮 `graphql-js` rule |
| 8 | +* 🔧 if some problems reported by the rule are automatically fixable by the `--fix` [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option |
| 9 | + |
| 10 | +<!-- Do not manually modify this table. Run: `yarn generate:docs` --> |
| 11 | +<!-- RULES_TABLE_START --> |
| 12 | +| Name | Description | 🚀 / 🔮 | 🔧 | |
| 13 | +| :-- | :-- | :-- | :-- | |
| 14 | +| [avoid-duplicate-fields](rules/avoid-duplicate-fields.md) | Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field. | 🚀 | | |
| 15 | +| [avoid-operation-name-prefix](rules/avoid-operation-name-prefix.md) | Enforce/avoid operation name prefix, useful if you wish to avoid prefix in your root fields, or avoid using REST terminology in your schema. | 🚀 | | |
| 16 | +| [avoid-typename-prefix](rules/avoid-typename-prefix.md) | Enforces users to avoid using the type name in a field name while defining your schema. | 🚀 | | |
| 17 | +| [description-style](rules/description-style.md) | Require all comments to follow the same style (either block or inline). | 🚀 | | |
| 18 | +| [executable-definitions](rules/executable-definitions.md) | A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions. | 🔮 | | |
| 19 | +| [fields-on-correct-type](rules/fields-on-correct-type.md) | 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`. | 🔮 | | |
| 20 | +| [fragments-on-composite-type](rules/fragments-on-composite-type.md) | 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. | 🔮 | | |
| 21 | +| [input-name](rules/input-name.md) | Require mutation argument to be always called "input" and input type to be called Mutation name + "Input". | 🚀 | | |
| 22 | +| [known-argument-names](rules/known-argument-names.md) | A GraphQL field is only valid if all supplied arguments are defined by that field. | 🔮 | | |
| 23 | +| [known-directives](rules/known-directives.md) | A GraphQL document is only valid if all `@directives` are known by the schema and legally positioned. | 🔮 | | |
| 24 | +| [known-fragment-names](rules/known-fragment-names.md) | A GraphQL document is only valid if all `...Fragment` fragment spreads refer to fragments defined in the same document. | 🔮 | | |
| 25 | +| [known-type-names](rules/known-type-names.md) | A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema. | 🔮 | | |
| 26 | +| [lone-anonymous-operation](rules/lone-anonymous-operation.md) | A GraphQL document is only valid if when it contains an anonymous operation (the query short-hand) that it contains only that one operation definition. | 🔮 | | |
| 27 | +| [lone-schema-definition](rules/lone-schema-definition.md) | A GraphQL document is only valid if it contains only one schema definition. | 🔮 | | |
| 28 | +| [naming-convention](rules/naming-convention.md) | Require names to follow specified conventions. | 🚀 | | |
| 29 | +| [no-anonymous-operations](rules/no-anonymous-operations.md) | Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes. | 🚀 | | |
| 30 | +| [no-case-insensitive-enum-values-duplicates](rules/no-case-insensitive-enum-values-duplicates.md) | | 🚀 | 🔧 | |
| 31 | +| [no-deprecated](rules/no-deprecated.md) | This rule allow you to enforce that deprecated fields or enum values are not in use by operations. | 🚀 | | |
| 32 | +| [no-fragment-cycles](rules/no-fragment-cycles.md) | A GraphQL fragment is only valid when it does not have cycles in fragments usage. | 🔮 | | |
| 33 | +| [no-hashtag-description](rules/no-hashtag-description.md) | Requires to use `"""` or `"` for adding a GraphQL description instead of `#`. | 🚀 | | |
| 34 | +| [no-operation-name-suffix](rules/no-operation-name-suffix.md) | Makes sure you are not adding the operation type to the name of the operation. | 🚀 | 🔧 | |
| 35 | +| [no-undefined-variables](rules/no-undefined-variables.md) | A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation. | 🔮 | | |
| 36 | +| [no-unreachable-types](rules/no-unreachable-types.md) | Requires all types to be reachable at some level by root level fields. | 🚀 | 🔧 | |
| 37 | +| [no-unused-fields](rules/no-unused-fields.md) | Requires all fields to be used at some level by siblings operations. | 🚀 | 🔧 | |
| 38 | +| [no-unused-fragments](rules/no-unused-fragments.md) | A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations. | 🔮 | | |
| 39 | +| [no-unused-variables](rules/no-unused-variables.md) | A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment. | 🔮 | | |
| 40 | +| [one-field-subscriptions](rules/one-field-subscriptions.md) | A GraphQL subscription is valid only if it contains a single root field. | 🔮 | | |
| 41 | +| [overlapping-fields-can-be-merged](rules/overlapping-fields-can-be-merged.md) | 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. | 🔮 | | |
| 42 | +| [possible-fragment-spread](rules/possible-fragment-spread.md) | 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. | 🔮 | | |
| 43 | +| [possible-type-extension](rules/possible-type-extension.md) | A type extension is only valid if the type is defined and has the same kind. | 🔮 | | |
| 44 | +| [provided-required-arguments](rules/provided-required-arguments.md) | A field or directive is only valid if all required (non-null without a default value) field arguments have been provided. | 🔮 | | |
| 45 | +| [require-deprecation-reason](rules/require-deprecation-reason.md) | Require all deprecation directives to specify a reason. | 🚀 | | |
| 46 | +| [require-description](rules/require-description.md) | Enforce descriptions in your type definitions. | 🚀 | | |
| 47 | +| [require-id-when-available](rules/require-id-when-available.md) | This rule allow you to enforce selecting specific fields when they are available on the GraphQL type. | 🚀 | | |
| 48 | +| [scalar-leafs](rules/scalar-leafs.md) | A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types. | 🔮 | | |
| 49 | +| [selection-set-depth](rules/selection-set-depth.md) | Limit the complexity of the GraphQL operations solely by their depth. Based on [graphql-depth-limit](https://github.com/stems/graphql-depth-limit). | 🚀 | | |
| 50 | +| [strict-id-in-types](rules/strict-id-in-types.md) | 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. | 🚀 | | |
| 51 | +| [unique-argument-names](rules/unique-argument-names.md) | A GraphQL field or directive is only valid if all supplied arguments are uniquely named. | 🔮 | | |
| 52 | +| [unique-directive-names](rules/unique-directive-names.md) | A GraphQL document is only valid if all defined directives have unique names. | 🔮 | | |
| 53 | +| [unique-directive-names-per-location](rules/unique-directive-names-per-location.md) | A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named. | 🔮 | | |
| 54 | +| [unique-enum-value-names](rules/unique-enum-value-names.md) | A GraphQL enum type is only valid if all its values are uniquely named. | 🔮 | | |
| 55 | +| [unique-field-definition-names](rules/unique-field-definition-names.md) | A GraphQL complex type is only valid if all its fields are uniquely named. | 🔮 | | |
| 56 | +| [unique-fragment-name](rules/unique-fragment-name.md) | This rule allow you to enforce unique fragment name across your application. | 🚀 | | |
| 57 | +| [unique-input-field-names](rules/unique-input-field-names.md) | A GraphQL input object value is only valid if all supplied fields are uniquely named. | 🔮 | | |
| 58 | +| [unique-operation-name](rules/unique-operation-name.md) | This rule allow you to enforce unique operation names across your project. | 🚀 | | |
| 59 | +| [unique-operation-types](rules/unique-operation-types.md) | A GraphQL document is only valid if it has only one type per operation. | 🔮 | | |
| 60 | +| [unique-type-names](rules/unique-type-names.md) | A GraphQL document is only valid if all defined types have unique names. | 🔮 | | |
| 61 | +| [unique-variable-names](rules/unique-variable-names.md) | A GraphQL operation is only valid if all its variables are uniquely named. | 🔮 | | |
| 62 | +| [value-literals-of-correct-type](rules/value-literals-of-correct-type.md) | A GraphQL document is only valid if all value literals are of the type expected at their position. | 🔮 | | |
| 63 | +| [variables-are-input-types](rules/variables-are-input-types.md) | A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object). | 🔮 | | |
| 64 | +| [variables-in-allowed-position](rules/variables-in-allowed-position.md) | Variables passed to field arguments conform to type. | 🔮 | | |
| 65 | +<!-- RULES_TABLE_END --> |
55 | 66 |
|
56 | 67 | ## Further Reading
|
57 | 68 |
|
58 |
| -- [Writing Custom Rules](./custom-rules.md) |
59 |
| -- [How the parser works?](./parser.md) |
60 |
| -- [`parserOptions`](./parser-options.md) |
| 69 | +- [Writing Custom Rules](custom-rules.md) |
| 70 | +- [How the parser works?](parser.md) |
| 71 | +- [`parserOptions`](parser-options.md) |
0 commit comments