@graphql-eslint/eslint-plugin 2.1.0-alpha-b4cd82d.0 → 2.3.0-alpha-6ba4002.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +38 -18
  2. package/configs/all.d.ts +61 -0
  3. package/configs/index.d.ts +107 -0
  4. package/configs/recommended.d.ts +44 -0
  5. package/docs/README.md +64 -60
  6. package/docs/rules/avoid-scalar-result-type-on-mutation.md +30 -0
  7. package/docs/rules/avoid-typename-prefix.md +2 -0
  8. package/docs/rules/executable-definitions.md +3 -1
  9. package/docs/rules/fields-on-correct-type.md +3 -1
  10. package/docs/rules/fragments-on-composite-type.md +3 -1
  11. package/docs/rules/known-argument-names.md +3 -1
  12. package/docs/rules/known-directives.md +3 -1
  13. package/docs/rules/known-fragment-names.md +3 -1
  14. package/docs/rules/known-type-names.md +3 -1
  15. package/docs/rules/lone-anonymous-operation.md +3 -1
  16. package/docs/rules/lone-schema-definition.md +3 -1
  17. package/docs/rules/match-document-filename.md +1 -1
  18. package/docs/rules/naming-convention.md +2 -0
  19. package/docs/rules/no-anonymous-operations.md +2 -0
  20. package/docs/rules/no-case-insensitive-enum-values-duplicates.md +5 -1
  21. package/docs/rules/no-fragment-cycles.md +3 -1
  22. package/docs/rules/no-operation-name-suffix.md +4 -0
  23. package/docs/rules/no-undefined-variables.md +3 -1
  24. package/docs/rules/no-unreachable-types.md +2 -0
  25. package/docs/rules/no-unused-fields.md +2 -0
  26. package/docs/rules/no-unused-fragments.md +3 -1
  27. package/docs/rules/no-unused-variables.md +3 -1
  28. package/docs/rules/one-field-subscriptions.md +3 -1
  29. package/docs/rules/overlapping-fields-can-be-merged.md +3 -1
  30. package/docs/rules/possible-fragment-spread.md +3 -1
  31. package/docs/rules/possible-type-extension.md +3 -1
  32. package/docs/rules/provided-required-arguments.md +3 -1
  33. package/docs/rules/require-deprecation-date.md +53 -0
  34. package/docs/rules/require-deprecation-reason.md +2 -0
  35. package/docs/rules/require-field-of-type-query-in-mutation-result.md +42 -0
  36. package/docs/rules/scalar-leafs.md +3 -1
  37. package/docs/rules/strict-id-in-types.md +2 -0
  38. package/docs/rules/unique-argument-names.md +3 -1
  39. package/docs/rules/unique-directive-names-per-location.md +3 -1
  40. package/docs/rules/unique-directive-names.md +3 -1
  41. package/docs/rules/unique-enum-value-names.md +3 -1
  42. package/docs/rules/unique-field-definition-names.md +3 -1
  43. package/docs/rules/unique-input-field-names.md +3 -1
  44. package/docs/rules/unique-operation-types.md +3 -1
  45. package/docs/rules/unique-type-names.md +3 -1
  46. package/docs/rules/unique-variable-names.md +3 -1
  47. package/docs/rules/value-literals-of-correct-type.md +3 -1
  48. package/docs/rules/variables-are-input-types.md +3 -1
  49. package/docs/rules/variables-in-allowed-position.md +3 -1
  50. package/index.d.ts +1 -0
  51. package/index.js +389 -74
  52. package/index.mjs +390 -76
  53. package/package.json +1 -1
  54. package/rules/avoid-scalar-result-type-on-mutation.d.ts +3 -0
  55. package/rules/index.d.ts +5 -0
  56. package/rules/require-deprecation-date.d.ts +5 -0
  57. package/rules/require-field-of-type-query-in-mutation-result.d.ts +3 -0
  58. package/utils.d.ts +9 -4
@@ -1,5 +1,7 @@
1
1
  # `known-directives`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/known-directives`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL document is only valid if all `@directives` are known by the schema and legally positioned.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownDirectivesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownDirectivesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `known-fragment-names`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/known-fragment-names`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,7 +9,7 @@
7
9
 
8
10
  A GraphQL document is only valid if all `...Fragment` fragment spreads refer to fragments defined in the same document.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownFragmentNamesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownFragmentNamesRule.ts).
11
13
 
12
14
  ## Usage Examples
13
15
 
@@ -1,5 +1,7 @@
1
1
  # `known-type-names`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/known-type-names`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownTypeNamesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownTypeNamesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `lone-anonymous-operation`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/lone-anonymous-operation`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  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.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneAnonymousOperationRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneAnonymousOperationRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `lone-schema-definition`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/lone-schema-definition`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL document is only valid if it contains only one schema definition.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneSchemaDefinitionRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneSchemaDefinitionRule.ts).
@@ -5,7 +5,7 @@
5
5
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
6
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7
7
 
8
- This rule allows you to enforce that the file name should match the operation name
8
+ This rule allows you to enforce that the file name should match the operation name.
9
9
 
10
10
  ## Usage Examples
11
11
 
@@ -1,5 +1,7 @@
1
1
  # `naming-convention`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Best Practices`
4
6
  - Rule name: `@graphql-eslint/naming-convention`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -1,5 +1,7 @@
1
1
  # `no-anonymous-operations`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Best Practices`
4
6
  - Rule name: `@graphql-eslint/no-anonymous-operations`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -1,11 +1,15 @@
1
1
  # `no-case-insensitive-enum-values-duplicates`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
5
+ 🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
6
+
3
7
  - Category: `Best Practices`
4
8
  - Rule name: `@graphql-eslint/no-case-insensitive-enum-values-duplicates`
5
9
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
10
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7
11
 
8
-
12
+ Disallow case-insensitive enum values duplicates.
9
13
 
10
14
  ## Usage Examples
11
15
 
@@ -1,5 +1,7 @@
1
1
  # `no-fragment-cycles`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/no-fragment-cycles`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL fragment is only valid when it does not have cycles in fragments usage.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoFragmentCyclesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoFragmentCyclesRule.ts).
@@ -1,5 +1,9 @@
1
1
  # `no-operation-name-suffix`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
5
+ 🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
6
+
3
7
  - Category: `Stylistic Issues`
4
8
  - Rule name: `@graphql-eslint/no-operation-name-suffix`
5
9
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -1,5 +1,7 @@
1
1
  # `no-undefined-variables`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/no-undefined-variables`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUndefinedVariablesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUndefinedVariablesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `no-unreachable-types`
2
2
 
3
+ 🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
4
+
3
5
  - Category: `Best Practices`
4
6
  - Rule name: `@graphql-eslint/no-unreachable-types`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -1,5 +1,7 @@
1
1
  # `no-unused-fields`
2
2
 
3
+ 🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
4
+
3
5
  - Category: `Best Practices`
4
6
  - Rule name: `@graphql-eslint/no-unused-fields`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -1,5 +1,7 @@
1
1
  # `no-unused-fragments`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/no-unused-fragments`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedFragmentsRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedFragmentsRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `no-unused-variables`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/no-unused-variables`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedVariablesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedVariablesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `one-field-subscriptions`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/one-field-subscriptions`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL subscription is valid only if it contains a single root field.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/SingleFieldSubscriptionsRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/SingleFieldSubscriptionsRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `overlapping-fields-can-be-merged`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/overlapping-fields-can-be-merged`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  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.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `possible-fragment-spread`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/possible-fragment-spread`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  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.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleFragmentSpreadsRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleFragmentSpreadsRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `possible-type-extension`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/possible-type-extension`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A type extension is only valid if the type is defined and has the same kind.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleTypeExtensionsRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleTypeExtensionsRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `provided-required-arguments`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/provided-required-arguments`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ProvidedRequiredArgumentsRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ProvidedRequiredArgumentsRule.ts).
@@ -0,0 +1,53 @@
1
+ # `require-deprecation-date`
2
+
3
+ - Category: `Best Practices`
4
+ - Rule name: `@graphql-eslint/require-deprecation-date`
5
+ - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
+ - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7
+
8
+ Require deletion date on `@deprecated` directive. Suggest removing deprecated things after deprecated date.
9
+
10
+ ## Usage Examples
11
+
12
+ ### Incorrect
13
+
14
+ ```graphql
15
+ # eslint @graphql-eslint/require-deprecation-date: 'error'
16
+
17
+ type User {
18
+ firstname: String @deprecated
19
+ firstName: String
20
+ }
21
+ ```
22
+
23
+ ### Incorrect
24
+
25
+ ```graphql
26
+ # eslint @graphql-eslint/require-deprecation-date: 'error'
27
+
28
+ type User {
29
+ firstname: String @deprecated(reason: "Use 'firstName' instead")
30
+ firstName: String
31
+ }
32
+ ```
33
+
34
+ ### Correct
35
+
36
+ ```graphql
37
+ # eslint @graphql-eslint/require-deprecation-date: 'error'
38
+
39
+ type User {
40
+ firstname: String @deprecated(reason: "Use 'firstName' instead", deletionDate: "25/12/2022")
41
+ firstName: String
42
+ }
43
+ ```
44
+
45
+ ## Config Schema
46
+
47
+ ### (array)
48
+
49
+ The schema defines an array with all elements of the type `object`.
50
+
51
+ The array object has the following properties:
52
+
53
+ #### `argumentName` (string)
@@ -1,5 +1,7 @@
1
1
  # `require-deprecation-reason`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Best Practices`
4
6
  - Rule name: `@graphql-eslint/require-deprecation-reason`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -0,0 +1,42 @@
1
+ # `require-field-of-type-query-in-mutation-result`
2
+
3
+ - Category: `Best Practices`
4
+ - Rule name: `@graphql-eslint/require-field-of-type-query-in-mutation-result`
5
+ - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
+ - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7
+
8
+ Allow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application.
9
+ > Currently, no errors are reported for result type `union`, `interface` and `scalar`.
10
+
11
+ ## Usage Examples
12
+
13
+ ### Incorrect
14
+
15
+ ```graphql
16
+ # eslint @graphql-eslint/require-field-of-type-query-in-mutation-result: 'error'
17
+
18
+ type User { ... }
19
+
20
+ type Mutation {
21
+ createUser: User!
22
+ }
23
+ ```
24
+
25
+ ### Correct
26
+
27
+ ```graphql
28
+ # eslint @graphql-eslint/require-field-of-type-query-in-mutation-result: 'error'
29
+
30
+ type User { ... }
31
+
32
+ type Query { ... }
33
+
34
+ type CreateUserPayload {
35
+ user: User!
36
+ query: Query!
37
+ }
38
+
39
+ type Mutation {
40
+ createUser: CreateUserPayload!
41
+ }
42
+ ```
@@ -1,5 +1,7 @@
1
1
  # `scalar-leafs`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/scalar-leafs`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ScalarLeafsRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ScalarLeafsRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `strict-id-in-types`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Best Practices`
4
6
  - Rule name: `@graphql-eslint/strict-id-in-types`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -1,5 +1,7 @@
1
1
  # `unique-argument-names`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/unique-argument-names`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL field or directive is only valid if all supplied arguments are uniquely named.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueArgumentNamesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueArgumentNamesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `unique-directive-names-per-location`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/unique-directive-names-per-location`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectivesPerLocationRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectivesPerLocationRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `unique-directive-names`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/unique-directive-names`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL document is only valid if all defined directives have unique names.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectiveNamesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectiveNamesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `unique-enum-value-names`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/unique-enum-value-names`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL enum type is only valid if all its values are uniquely named.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueEnumValueNamesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueEnumValueNamesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `unique-field-definition-names`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/unique-field-definition-names`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL complex type is only valid if all its fields are uniquely named.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueFieldDefinitionNamesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueFieldDefinitionNamesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `unique-input-field-names`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/unique-input-field-names`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL input object value is only valid if all supplied fields are uniquely named.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueInputFieldNamesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueInputFieldNamesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `unique-operation-types`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/unique-operation-types`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL document is only valid if it has only one type per operation.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueOperationTypesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueOperationTypesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `unique-type-names`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/unique-type-names`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL document is only valid if all defined types have unique names.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueTypeNamesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueTypeNamesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `unique-variable-names`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/unique-variable-names`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL operation is only valid if all its variables are uniquely named.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueVariableNamesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueVariableNamesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `value-literals-of-correct-type`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/value-literals-of-correct-type`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL document is only valid if all value literals are of the type expected at their position.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ValuesOfCorrectTypeRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ValuesOfCorrectTypeRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `variables-are-input-types`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/variables-are-input-types`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesAreInputTypesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesAreInputTypesRule.ts).
@@ -1,5 +1,7 @@
1
1
  # `variables-in-allowed-position`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
+
3
5
  - Category: `Validation`
4
6
  - Rule name: `@graphql-eslint/variables-in-allowed-position`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -7,4 +9,4 @@
7
9
 
8
10
  Variables passed to field arguments conform to type.
9
11
 
10
- > This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesInAllowedPositionRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesInAllowedPositionRule.ts).
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { configs } from './configs';
1
2
  export { rules } from './rules';
2
3
  export { processors } from './processors';
3
4
  export * from './parser';