@graphql-eslint/eslint-plugin 2.3.0 → 2.3.2-alpha-13a11c2.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 (65) hide show
  1. package/README.md +1 -1
  2. package/docs/README.md +1 -1
  3. package/docs/custom-rules.md +3 -3
  4. package/docs/rules/alphabetize.md +6 -1
  5. package/docs/rules/avoid-duplicate-fields.md +6 -1
  6. package/docs/rules/avoid-operation-name-prefix.md +5 -1
  7. package/docs/rules/avoid-scalar-result-type-on-mutation.md +6 -1
  8. package/docs/rules/avoid-typename-prefix.md +6 -1
  9. package/docs/rules/description-style.md +6 -1
  10. package/docs/rules/executable-definitions.md +6 -1
  11. package/docs/rules/fields-on-correct-type.md +6 -1
  12. package/docs/rules/fragments-on-composite-type.md +6 -1
  13. package/docs/rules/input-name.md +6 -1
  14. package/docs/rules/known-argument-names.md +6 -1
  15. package/docs/rules/known-directives.md +6 -1
  16. package/docs/rules/known-fragment-names.md +6 -1
  17. package/docs/rules/known-type-names.md +6 -1
  18. package/docs/rules/lone-anonymous-operation.md +6 -1
  19. package/docs/rules/lone-schema-definition.md +6 -1
  20. package/docs/rules/match-document-filename.md +6 -1
  21. package/docs/rules/naming-convention.md +6 -1
  22. package/docs/rules/no-anonymous-operations.md +6 -1
  23. package/docs/rules/no-case-insensitive-enum-values-duplicates.md +5 -1
  24. package/docs/rules/no-deprecated.md +6 -1
  25. package/docs/rules/no-fragment-cycles.md +6 -1
  26. package/docs/rules/no-hashtag-description.md +6 -1
  27. package/docs/rules/no-operation-name-suffix.md +5 -1
  28. package/docs/rules/no-undefined-variables.md +6 -1
  29. package/docs/rules/no-unreachable-types.md +6 -1
  30. package/docs/rules/no-unused-fields.md +6 -1
  31. package/docs/rules/no-unused-fragments.md +6 -1
  32. package/docs/rules/no-unused-variables.md +6 -1
  33. package/docs/rules/one-field-subscriptions.md +6 -1
  34. package/docs/rules/overlapping-fields-can-be-merged.md +6 -1
  35. package/docs/rules/possible-fragment-spread.md +6 -1
  36. package/docs/rules/possible-type-extension.md +6 -1
  37. package/docs/rules/provided-required-arguments.md +6 -1
  38. package/docs/rules/require-deprecation-date.md +6 -1
  39. package/docs/rules/require-deprecation-reason.md +6 -1
  40. package/docs/rules/require-description.md +6 -1
  41. package/docs/rules/require-field-of-type-query-in-mutation-result.md +6 -1
  42. package/docs/rules/require-id-when-available.md +6 -1
  43. package/docs/rules/scalar-leafs.md +6 -1
  44. package/docs/rules/selection-set-depth.md +6 -1
  45. package/docs/rules/strict-id-in-types.md +6 -1
  46. package/docs/rules/unique-argument-names.md +6 -1
  47. package/docs/rules/unique-directive-names-per-location.md +6 -1
  48. package/docs/rules/unique-directive-names.md +6 -1
  49. package/docs/rules/unique-enum-value-names.md +6 -1
  50. package/docs/rules/unique-field-definition-names.md +6 -1
  51. package/docs/rules/unique-fragment-name.md +6 -1
  52. package/docs/rules/unique-input-field-names.md +6 -1
  53. package/docs/rules/unique-operation-name.md +6 -1
  54. package/docs/rules/unique-operation-types.md +6 -1
  55. package/docs/rules/unique-type-names.md +6 -1
  56. package/docs/rules/unique-variable-names.md +6 -1
  57. package/docs/rules/value-literals-of-correct-type.md +6 -1
  58. package/docs/rules/variables-are-input-types.md +6 -1
  59. package/docs/rules/variables-in-allowed-position.md +6 -1
  60. package/index.js +183 -58
  61. package/index.mjs +183 -58
  62. package/package.json +1 -1
  63. package/testkit.d.ts +5 -3
  64. package/types.d.ts +2 -0
  65. package/utils.d.ts +4 -0
package/README.md CHANGED
@@ -46,7 +46,7 @@ npm install --save-dev @graphql-eslint/eslint-plugin
46
46
 
47
47
  ### Configuration
48
48
 
49
- To get started, create an override configuration for your ESLint, while applying it to to `.graphql` files (do that even if you are declaring your operations in code files):
49
+ To get started, create an override configuration for your ESLint, while applying it to `.graphql` files (do that even if you are declaring your operations in code files):
50
50
 
51
51
  ```json
52
52
  {
package/docs/README.md CHANGED
@@ -73,4 +73,4 @@ Name            &nbs
73
73
 
74
74
  - [Writing Custom Rules](custom-rules.md)
75
75
  - [How the parser works?](parser.md)
76
- - [`parserOptions`](parser-options.md)
76
+ - [`parserOptions`](parser-options.md)
@@ -38,7 +38,7 @@ const rule: GraphQLESLintRule = {
38
38
  So what happens here?
39
39
 
40
40
  1. `@graphql-eslint/eslint-plugin` handles the parsing process for your GraphQL content. It will load the GraphQL files (either from code files or from `.graphql` files with SDL), parse it using GraphQL parser, converts it to ESTree structure and let ESLint do the rest.
41
- 1. You rule is being loaded by ESLint, and executes just like any other ESLint rule.
41
+ 1. Your rule is being loaded by ESLint, and executes just like any other ESLint rule.
42
42
  1. Our custom rule asks ESLint to run our function for every `OperationDefinition` found.
43
43
  1. If the `OperationDefinition` node doesn't have a valid `name` - we report an error to ESLint.
44
44
 
@@ -49,7 +49,7 @@ You can scan the `packages/plugin/src/rules` directory in this repo for referenc
49
49
  ## Accessing original GraphQL AST nodes
50
50
 
51
51
  Since our parser converts GraphQL AST to ESTree structure, there are some minor differences in the structure of the objects.
52
- If you are using TypeScript, and you typed your rule with `GraphQLESLintRule` - you'll see that each `node` is a bit different from from the AST nodes of GraphQL (you can read more about that in [graphql-eslint parser documentation](./parser.md)).
52
+ If you are using TypeScript, and you typed your rule with `GraphQLESLintRule` - you'll see that each `node` is a bit different from the AST nodes of GraphQL (you can read more about that in [graphql-eslint parser documentation](./parser.md)).
53
53
 
54
54
  If you need access to the original GraphQL AST `node`, you can use `.rawNode()` method on each node you get from the AST structure of ESLint.
55
55
 
@@ -58,7 +58,7 @@ This is useful if you wish to use other GraphQL tools that works with the origin
58
58
  Here's an example for using original `graphql-js` validate method to validate `OperationDefinition`:
59
59
 
60
60
  ```ts
61
- import { validate } from 'graphql-js';
61
+ import { validate } from 'graphql';
62
62
  import { requireGraphQLSchemaFromContext } from '@graphql-eslint/eslint-plugin';
63
63
 
64
64
  export const rule = {
@@ -137,4 +137,9 @@ The elements of the array must contain the following properties:
137
137
  - `FieldDefinition`
138
138
  - `Field`
139
139
  - `DirectiveDefinition`
140
- - `Directive`
140
+ - `Directive`
141
+
142
+ ## Resources
143
+
144
+ - [Rule source](../../packages/plugin/src/rules/alphabetize.ts)
145
+ - [Test source](../../packages/plugin/tests/alphabetize.spec.ts)
@@ -51,4 +51,9 @@ query getUsers($first: Int!, $first: Int!) {
51
51
  id
52
52
  }
53
53
  }
54
- ```
54
+ ```
55
+
56
+ ## Resources
57
+
58
+ - [Rule source](../../packages/plugin/src/rules/avoid-duplicate-fields.ts)
59
+ - [Test source](../../packages/plugin/tests/avoid-duplicate-fields.spec.ts)
@@ -43,4 +43,8 @@ The object is an array with all elements of the type `string`.
43
43
 
44
44
  Additional restrictions:
45
45
 
46
- * Minimum items: `1`
46
+ * Minimum items: `1`
47
+
48
+ ## Resources
49
+
50
+ - [Rule source](../../packages/plugin/src/rules/avoid-operation-name-prefix.ts)
@@ -27,4 +27,9 @@ type Mutation {
27
27
  type Mutation {
28
28
  createUser: User!
29
29
  }
30
- ```
30
+ ```
31
+
32
+ ## Resources
33
+
34
+ - [Rule source](../../packages/plugin/src/rules/avoid-scalar-result-type-on-mutation.ts)
35
+ - [Test source](../../packages/plugin/tests/avoid-scalar-result-type-on-mutation.spec.ts)
@@ -29,4 +29,9 @@ type User {
29
29
  type User {
30
30
  id: ID!
31
31
  }
32
- ```
32
+ ```
33
+
34
+ ## Resources
35
+
36
+ - [Rule source](../../packages/plugin/src/rules/avoid-typename-prefix.ts)
37
+ - [Test source](../../packages/plugin/tests/avoid-typename-prefix.spec.ts)
@@ -42,4 +42,9 @@ This element must be one of the following enum values:
42
42
  * `block`
43
43
  * `inline`
44
44
 
45
- Default: `"inline"`
45
+ Default: `"inline"`
46
+
47
+ ## Resources
48
+
49
+ - [Rule source](../../packages/plugin/src/rules/description-style.ts)
50
+ - [Test source](../../packages/plugin/tests/description-style.spec.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.
11
11
 
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/ExecutableDefinitionsRule.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/ExecutableDefinitionsRule.ts).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ExecutableDefinitionsRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/ExecutableDefinitionsRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  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`.
11
11
 
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/FieldsOnCorrectTypeRule.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/FieldsOnCorrectTypeRule.ts).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/FieldsOnCorrectTypeRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/FieldsOnCorrectTypeRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  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.
11
11
 
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/FragmentsOnCompositeTypesRule.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/FragmentsOnCompositeTypesRule.ts).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/FragmentsOnCompositeTypesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/FragmentsOnCompositeTypesRule-test.ts)
@@ -66,4 +66,9 @@ Default: `false`
66
66
 
67
67
  Apply the rule to Mutations
68
68
 
69
- Default: `true`
69
+ Default: `true`
70
+
71
+ ## Resources
72
+
73
+ - [Rule source](../../packages/plugin/src/rules/input-name.ts)
74
+ - [Test source](../../packages/plugin/tests/input-name.spec.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL field is only valid if all supplied arguments are defined by that field.
11
11
 
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/KnownArgumentNamesRule.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/KnownArgumentNamesRule.ts).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownArgumentNamesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/KnownArgumentNamesRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL document is only valid if all `@directives` are known by the schema and legally positioned.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownDirectivesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/KnownDirectivesRule-test.ts)
@@ -82,4 +82,9 @@ const GET_USER = /* GraphQL */ `
82
82
  # Will give false positive error 'Unknown fragment "UserFields"'
83
83
  ${USER_FIELDS}
84
84
  `
85
- ```
85
+ ```
86
+
87
+ ## Resources
88
+
89
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownFragmentNamesRule.ts)
90
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/KnownFragmentNamesRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownTypeNamesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/KnownTypeNamesRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
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.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneAnonymousOperationRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/LoneAnonymousOperationRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL document is only valid if it contains only one schema definition.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneSchemaDefinitionRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/LoneSchemaDefinitionRule-test.ts)
@@ -145,4 +145,9 @@ This element must be one of the following enum values:
145
145
  * `PascalCase`
146
146
  * `snake_case`
147
147
  * `UPPER_CASE`
148
- * `kebab-case`
148
+ * `kebab-case`
149
+
150
+ ## Resources
151
+
152
+ - [Rule source](../../packages/plugin/src/rules/match-document-filename.ts)
153
+ - [Test source](../../packages/plugin/tests/match-document-filename.spec.ts)
@@ -178,4 +178,9 @@ The object is an array with all elements of the type `string`.
178
178
 
179
179
  Additional restrictions:
180
180
 
181
- * Minimum items: `1`
181
+ * Minimum items: `1`
182
+
183
+ ## Resources
184
+
185
+ - [Rule source](../../packages/plugin/src/rules/naming-convention.ts)
186
+ - [Test source](../../packages/plugin/tests/naming-convention.spec.ts)
@@ -29,4 +29,9 @@ query {
29
29
  query user {
30
30
  # ...
31
31
  }
32
- ```
32
+ ```
33
+
34
+ ## Resources
35
+
36
+ - [Rule source](../../packages/plugin/src/rules/no-anonymous-operations.ts)
37
+ - [Test source](../../packages/plugin/tests/no-anonymous-operations.spec.ts)
@@ -35,4 +35,8 @@ enum MyEnum {
35
35
  Value2
36
36
  Value3
37
37
  }
38
- ```
38
+ ```
39
+
40
+ ## Resources
41
+
42
+ - [Rule source](../../packages/plugin/src/rules/no-case-insensitive-enum-values-duplicates.ts)
@@ -73,4 +73,9 @@ query user {
73
73
  fullName
74
74
  }
75
75
  }
76
- ```
76
+ ```
77
+
78
+ ## Resources
79
+
80
+ - [Rule source](../../packages/plugin/src/rules/no-deprecated.ts)
81
+ - [Test source](../../packages/plugin/tests/no-deprecated.spec.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL fragment is only valid when it does not have cycles in fragments usage.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoFragmentCyclesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/NoFragmentCyclesRule-test.ts)
@@ -47,4 +47,9 @@ type User {
47
47
  id: ID! # This one is also valid, since it comes after the AST object
48
48
  name: String
49
49
  }
50
- ```
50
+ ```
51
+
52
+ ## Resources
53
+
54
+ - [Rule source](../../packages/plugin/src/rules/no-hashtag-description.ts)
55
+ - [Test source](../../packages/plugin/tests/no-hashtag-description.spec.ts)
@@ -31,4 +31,8 @@ query userQuery {
31
31
  query user {
32
32
  # ...
33
33
  }
34
- ```
34
+ ```
35
+
36
+ ## Resources
37
+
38
+ - [Rule source](../../packages/plugin/src/rules/no-operation-name-suffix.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUndefinedVariablesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/NoUndefinedVariablesRule-test.ts)
@@ -39,4 +39,9 @@ type User {
39
39
  type Query {
40
40
  me: User
41
41
  }
42
- ```
42
+ ```
43
+
44
+ ## Resources
45
+
46
+ - [Rule source](../../packages/plugin/src/rules/no-unreachable-types.ts)
47
+ - [Test source](../../packages/plugin/tests/no-unreachable-types.spec.ts)
@@ -54,4 +54,9 @@ query {
54
54
  name
55
55
  }
56
56
  }
57
- ```
57
+ ```
58
+
59
+ ## Resources
60
+
61
+ - [Rule source](../../packages/plugin/src/rules/no-unused-fields.ts)
62
+ - [Test source](../../packages/plugin/tests/no-unused-fields.spec.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedFragmentsRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/NoUnusedFragmentsRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedVariablesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/NoUnusedVariablesRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL subscription is valid only if it contains a single root field.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/SingleFieldSubscriptionsRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/SingleFieldSubscriptionsRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
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.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
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.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleFragmentSpreadsRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/PossibleFragmentSpreadsRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A type extension is only valid if the type is defined and has the same kind.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleTypeExtensionsRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/PossibleTypeExtensionsRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ProvidedRequiredArgumentsRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/ProvidedRequiredArgumentsRule-test.ts)
@@ -46,4 +46,9 @@ type User {
46
46
 
47
47
  The schema defines the following properties:
48
48
 
49
- ### `argumentName` (string)
49
+ ### `argumentName` (string)
50
+
51
+ ## Resources
52
+
53
+ - [Rule source](../../packages/plugin/src/rules/require-deprecation-date.ts)
54
+ - [Test source](../../packages/plugin/tests/require-deprecation-date.spec.ts)
@@ -39,4 +39,9 @@ type MyType {
39
39
  type MyType {
40
40
  name: String @deprecated(reason: "no longer relevant, please use fullName field")
41
41
  }
42
- ```
42
+ ```
43
+
44
+ ## Resources
45
+
46
+ - [Rule source](../../packages/plugin/src/rules/require-deprecation-reason.ts)
47
+ - [Test source](../../packages/plugin/tests/require-deprecation-reason.spec.ts)
@@ -45,4 +45,9 @@ The object is an array with all elements of the type `string`.
45
45
 
46
46
  Additional restrictions:
47
47
 
48
- * Minimum items: `1`
48
+ * Minimum items: `1`
49
+
50
+ ## Resources
51
+
52
+ - [Rule source](../../packages/plugin/src/rules/require-description.ts)
53
+ - [Test source](../../packages/plugin/tests/require-description.spec.ts)
@@ -39,4 +39,9 @@ type CreateUserPayload {
39
39
  type Mutation {
40
40
  createUser: CreateUserPayload!
41
41
  }
42
- ```
42
+ ```
43
+
44
+ ## Resources
45
+
46
+ - [Rule source](../../packages/plugin/src/rules/require-field-of-type-query-in-mutation-result.ts)
47
+ - [Test source](../../packages/plugin/tests/require-field-of-type-query-in-mutation-result.spec.ts)
@@ -54,4 +54,9 @@ The schema defines the following properties:
54
54
 
55
55
  ### `fieldName` (string)
56
56
 
57
- Default: `"id"`
57
+ Default: `"id"`
58
+
59
+ ## Resources
60
+
61
+ - [Rule source](../../packages/plugin/src/rules/require-id-when-available.ts)
62
+ - [Test source](../../packages/plugin/tests/require-id-when-available.spec.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ScalarLeafsRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/ScalarLeafsRule-test.ts)
@@ -59,4 +59,9 @@ The schema defines the following properties:
59
59
 
60
60
  ### `ignore` (array)
61
61
 
62
- The object is an array with all elements of the type `string`.
62
+ The object is an array with all elements of the type `string`.
63
+
64
+ ## Resources
65
+
66
+ - [Rule source](../../packages/plugin/src/rules/selection-set-depth.ts)
67
+ - [Test source](../../packages/plugin/tests/selection-set-depth.spec.ts)
@@ -114,4 +114,9 @@ Default:
114
114
 
115
115
  ```
116
116
  []
117
- ```
117
+ ```
118
+
119
+ ## Resources
120
+
121
+ - [Rule source](../../packages/plugin/src/rules/strict-id-in-types.ts)
122
+ - [Test source](../../packages/plugin/tests/strict-id-in-types.spec.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL field or directive is only valid if all supplied arguments are uniquely named.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueArgumentNamesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueArgumentNamesRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectivesPerLocationRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueDirectivesPerLocationRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL document is only valid if all defined directives have unique names.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectiveNamesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueDirectiveNamesRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL enum type is only valid if all its values are uniquely named.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueEnumValueNamesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueEnumValueNamesRule-test.ts)
@@ -9,4 +9,9 @@
9
9
 
10
10
  A GraphQL complex type is only valid if all its fields are uniquely named.
11
11
 
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).
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).
13
+
14
+ ## Resources
15
+
16
+ - [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueFieldDefinitionNamesRule.ts)
17
+ - [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueFieldDefinitionNamesRule-test.ts)