@graphql-eslint/eslint-plugin 3.8.0-alpha-8ddf2a4.0 → 3.9.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 (80) hide show
  1. package/README.md +5 -5
  2. package/configs/base.json +4 -0
  3. package/configs/operations-all.json +24 -0
  4. package/configs/operations-recommended.json +50 -0
  5. package/configs/schema-all.json +26 -0
  6. package/configs/schema-recommended.json +49 -0
  7. package/docs/README.md +59 -57
  8. package/docs/custom-rules.md +8 -8
  9. package/docs/parser-options.md +4 -4
  10. package/docs/parser.md +2 -2
  11. package/docs/rules/alphabetize.md +11 -5
  12. package/docs/rules/description-style.md +2 -0
  13. package/docs/rules/executable-definitions.md +1 -1
  14. package/docs/rules/fields-on-correct-type.md +1 -1
  15. package/docs/rules/fragments-on-composite-type.md +1 -1
  16. package/docs/rules/input-name.md +2 -0
  17. package/docs/rules/known-argument-names.md +1 -1
  18. package/docs/rules/known-directives.md +29 -2
  19. package/docs/rules/known-fragment-names.md +1 -1
  20. package/docs/rules/known-type-names.md +1 -1
  21. package/docs/rules/lone-anonymous-operation.md +1 -1
  22. package/docs/rules/lone-schema-definition.md +1 -1
  23. package/docs/rules/naming-convention.md +2 -0
  24. package/docs/rules/no-anonymous-operations.md +2 -0
  25. package/docs/rules/no-case-insensitive-enum-values-duplicates.md +2 -0
  26. package/docs/rules/no-deprecated.md +2 -0
  27. package/docs/rules/no-duplicate-fields.md +2 -0
  28. package/docs/rules/no-fragment-cycles.md +1 -1
  29. package/docs/rules/no-hashtag-description.md +2 -0
  30. package/docs/rules/no-root-type.md +2 -0
  31. package/docs/rules/no-scalar-result-type-on-mutation.md +2 -0
  32. package/docs/rules/no-typename-prefix.md +2 -0
  33. package/docs/rules/no-undefined-variables.md +1 -1
  34. package/docs/rules/no-unreachable-types.md +2 -0
  35. package/docs/rules/no-unused-fields.md +2 -0
  36. package/docs/rules/no-unused-fragments.md +1 -1
  37. package/docs/rules/no-unused-variables.md +1 -1
  38. package/docs/rules/one-field-subscriptions.md +1 -1
  39. package/docs/rules/overlapping-fields-can-be-merged.md +1 -1
  40. package/docs/rules/possible-fragment-spread.md +1 -1
  41. package/docs/rules/possible-type-extension.md +1 -1
  42. package/docs/rules/provided-required-arguments.md +1 -1
  43. package/docs/rules/require-deprecation-date.md +2 -0
  44. package/docs/rules/require-id-when-available.md +2 -0
  45. package/docs/rules/scalar-leafs.md +1 -1
  46. package/docs/rules/selection-set-depth.md +2 -0
  47. package/docs/rules/unique-argument-names.md +1 -1
  48. package/docs/rules/unique-directive-names-per-location.md +1 -1
  49. package/docs/rules/unique-directive-names.md +1 -1
  50. package/docs/rules/unique-enum-value-names.md +1 -1
  51. package/docs/rules/unique-field-definition-names.md +1 -1
  52. package/docs/rules/unique-input-field-names.md +1 -1
  53. package/docs/rules/unique-operation-types.md +1 -1
  54. package/docs/rules/unique-type-names.md +1 -1
  55. package/docs/rules/unique-variable-names.md +1 -1
  56. package/docs/rules/value-literals-of-correct-type.md +1 -1
  57. package/docs/rules/variables-are-input-types.md +1 -1
  58. package/docs/rules/variables-in-allowed-position.md +1 -1
  59. package/estree-parser/converter.d.ts +3 -2
  60. package/estree-parser/estree-ast.d.ts +18 -18
  61. package/estree-parser/utils.d.ts +5 -9
  62. package/index.d.ts +6 -2
  63. package/index.js +699 -694
  64. package/index.mjs +699 -688
  65. package/package.json +1 -1
  66. package/rules/alphabetize.d.ts +1 -0
  67. package/rules/graphql-js-validation.d.ts +1 -1
  68. package/rules/index.d.ts +1 -4
  69. package/rules/selection-set-depth.d.ts +1 -1
  70. package/sibling-operations.d.ts +3 -3
  71. package/testkit.d.ts +3 -3
  72. package/types.d.ts +24 -18
  73. package/utils.d.ts +14 -4
  74. package/configs/base.d.ts +0 -5
  75. package/configs/index.d.ts +0 -133
  76. package/configs/operations-all.d.ts +0 -19
  77. package/configs/operations-recommended.d.ts +0 -50
  78. package/configs/schema-all.d.ts +0 -15
  79. package/configs/schema-recommended.d.ts +0 -47
  80. package/graphql-ast.d.ts +0 -6
package/README.md CHANGED
@@ -9,7 +9,7 @@ This project integrates GraphQL and ESLint, for a better developer experience.
9
9
  ## Key Features
10
10
 
11
11
  - 🚀 Integrates with ESLint core (as a ESTree parser)
12
- - 🚀 Works on `.graphql` files, `gql` usages and `/* GraphQL */` magic comments
12
+ - 🚀 Works on `.graphql` files, `gql` usages and `/* GraphQL */` magic comments
13
13
  - 🚀 Lints both GraphQL schema and GraphQL operations
14
14
  - 🚀 Extended type info for more advanced usages
15
15
  - 🚀 Supports ESLint directives (for example: `eslint-disable-next-line`)
@@ -189,10 +189,10 @@ See [docs/deprecated-rules.md](docs/deprecated-rules.md).
189
189
  <!-- prettier-ignore-start -->
190
190
  |Name|Description|
191
191
  |:-:|-|
192
- |[`schema-recommended`](packages/plugin/src/configs/schema-recommended.ts)|enables recommended rules for schema (SDL) development|
193
- |[`schema-all`](packages/plugin/src/configs/schema-all.ts)|enables all rules for schema (SDL) development, except for those that require `parserOptions.operations` option|
194
- |[`operations-recommended`](packages/plugin/src/configs/operations-recommended.ts) |enables recommended rules for consuming GraphQL (operations) development|
195
- |[`operations-all`](packages/plugin/src/configs/operations-all.ts)|enables all rules for consuming GraphQL (operations) development|
192
+ |[`schema-recommended`](packages/plugin/src/configs/schema-recommended.json)|enables recommended rules for schema (SDL) development|
193
+ |[`schema-all`](packages/plugin/src/configs/schema-all.json)|enables all rules for schema (SDL) development, except for those that require `parserOptions.operations` option|
194
+ |[`operations-recommended`](packages/plugin/src/configs/operations-recommended.json) |enables recommended rules for consuming GraphQL (operations) development|
195
+ |[`operations-all`](packages/plugin/src/configs/operations-all.json)|enables all rules for consuming GraphQL (operations) development|
196
196
  <!-- prettier-ignore-end -->
197
197
 
198
198
  > If you are in a project that develops the GraphQL schema, you'll need `schema` rules.
@@ -0,0 +1,4 @@
1
+ {
2
+ "parser": "@graphql-eslint/eslint-plugin",
3
+ "plugins": ["@graphql-eslint"]
4
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "extends": ["./base.json", "./operations-recommended.json"],
3
+ "rules": {
4
+ "@graphql-eslint/alphabetize": [
5
+ "error",
6
+ {
7
+ "selections": ["OperationDefinition", "FragmentDefinition"],
8
+ "variables": ["OperationDefinition"],
9
+ "arguments": ["Field", "Directive"]
10
+ }
11
+ ],
12
+ "@graphql-eslint/match-document-filename": [
13
+ "error",
14
+ {
15
+ "query": "kebab-case",
16
+ "mutation": "kebab-case",
17
+ "subscription": "kebab-case",
18
+ "fragment": "kebab-case"
19
+ }
20
+ ],
21
+ "@graphql-eslint/unique-fragment-name": "error",
22
+ "@graphql-eslint/unique-operation-name": "error"
23
+ }
24
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "extends": "./base.json",
3
+ "rules": {
4
+ "@graphql-eslint/executable-definitions": "error",
5
+ "@graphql-eslint/fields-on-correct-type": "error",
6
+ "@graphql-eslint/fragments-on-composite-type": "error",
7
+ "@graphql-eslint/known-argument-names": "error",
8
+ "@graphql-eslint/known-directives": "error",
9
+ "@graphql-eslint/known-fragment-names": "error",
10
+ "@graphql-eslint/known-type-names": "error",
11
+ "@graphql-eslint/lone-anonymous-operation": "error",
12
+ "@graphql-eslint/naming-convention": [
13
+ "error",
14
+ {
15
+ "VariableDefinition": "camelCase",
16
+ "OperationDefinition": {
17
+ "style": "PascalCase",
18
+ "forbiddenPrefixes": ["Query", "Mutation", "Subscription", "Get"],
19
+ "forbiddenSuffixes": ["Query", "Mutation", "Subscription"]
20
+ },
21
+ "FragmentDefinition": {
22
+ "style": "PascalCase",
23
+ "forbiddenPrefixes": ["Fragment"],
24
+ "forbiddenSuffixes": ["Fragment"]
25
+ }
26
+ }
27
+ ],
28
+ "@graphql-eslint/no-anonymous-operations": "error",
29
+ "@graphql-eslint/no-deprecated": "error",
30
+ "@graphql-eslint/no-duplicate-fields": "error",
31
+ "@graphql-eslint/no-fragment-cycles": "error",
32
+ "@graphql-eslint/no-undefined-variables": "error",
33
+ "@graphql-eslint/no-unused-fragments": "error",
34
+ "@graphql-eslint/no-unused-variables": "error",
35
+ "@graphql-eslint/one-field-subscriptions": "error",
36
+ "@graphql-eslint/overlapping-fields-can-be-merged": "error",
37
+ "@graphql-eslint/possible-fragment-spread": "error",
38
+ "@graphql-eslint/provided-required-arguments": "error",
39
+ "@graphql-eslint/require-id-when-available": "error",
40
+ "@graphql-eslint/scalar-leafs": "error",
41
+ "@graphql-eslint/selection-set-depth": ["error", { "maxDepth": 7 }],
42
+ "@graphql-eslint/unique-argument-names": "error",
43
+ "@graphql-eslint/unique-directive-names-per-location": "error",
44
+ "@graphql-eslint/unique-input-field-names": "error",
45
+ "@graphql-eslint/unique-variable-names": "error",
46
+ "@graphql-eslint/value-literals-of-correct-type": "error",
47
+ "@graphql-eslint/variables-are-input-types": "error",
48
+ "@graphql-eslint/variables-in-allowed-position": "error"
49
+ }
50
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "extends": ["./base.json", "./schema-recommended.json"],
3
+ "rules": {
4
+ "@graphql-eslint/alphabetize": [
5
+ "error",
6
+ {
7
+ "fields": [
8
+ "ObjectTypeDefinition",
9
+ "InterfaceTypeDefinition",
10
+ "InputObjectTypeDefinition"
11
+ ],
12
+ "values": ["EnumTypeDefinition"],
13
+ "arguments": [
14
+ "FieldDefinition",
15
+ "Field",
16
+ "DirectiveDefinition",
17
+ "Directive"
18
+ ]
19
+ }
20
+ ],
21
+ "@graphql-eslint/input-name": "error",
22
+ "@graphql-eslint/no-scalar-result-type-on-mutation": "error",
23
+ "@graphql-eslint/require-deprecation-date": "error",
24
+ "@graphql-eslint/require-field-of-type-query-in-mutation-result": "error"
25
+ }
26
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "extends": "./base.json",
3
+ "rules": {
4
+ "@graphql-eslint/description-style": "error",
5
+ "@graphql-eslint/known-argument-names": "error",
6
+ "@graphql-eslint/known-directives": "error",
7
+ "@graphql-eslint/known-type-names": "error",
8
+ "@graphql-eslint/lone-schema-definition": "error",
9
+ "@graphql-eslint/naming-convention": [
10
+ "error",
11
+ {
12
+ "types": "PascalCase",
13
+ "FieldDefinition": "camelCase",
14
+ "InputValueDefinition": "camelCase",
15
+ "Argument": "camelCase",
16
+ "DirectiveDefinition": "camelCase",
17
+ "EnumValueDefinition": "UPPER_CASE",
18
+ "FieldDefinition[parent.name.value=Query]": {
19
+ "forbiddenPrefixes": ["query", "get"],
20
+ "forbiddenSuffixes": ["Query"]
21
+ },
22
+ "FieldDefinition[parent.name.value=Mutation]": {
23
+ "forbiddenPrefixes": ["mutation"],
24
+ "forbiddenSuffixes": ["Mutation"]
25
+ },
26
+ "FieldDefinition[parent.name.value=Subscription]": {
27
+ "forbiddenPrefixes": ["subscription"],
28
+ "forbiddenSuffixes": ["Subscription"]
29
+ }
30
+ }
31
+ ],
32
+ "@graphql-eslint/no-case-insensitive-enum-values-duplicates": "error",
33
+ "@graphql-eslint/no-hashtag-description": "error",
34
+ "@graphql-eslint/no-typename-prefix": "error",
35
+ "@graphql-eslint/no-unreachable-types": "error",
36
+ "@graphql-eslint/provided-required-arguments": "error",
37
+ "@graphql-eslint/require-deprecation-reason": "error",
38
+ "@graphql-eslint/require-description": [
39
+ "error",
40
+ { "types": true, "DirectiveDefinition": true }
41
+ ],
42
+ "@graphql-eslint/strict-id-in-types": "error",
43
+ "@graphql-eslint/unique-directive-names": "error",
44
+ "@graphql-eslint/unique-directive-names-per-location": "error",
45
+ "@graphql-eslint/unique-field-definition-names": "error",
46
+ "@graphql-eslint/unique-operation-types": "error",
47
+ "@graphql-eslint/unique-type-names": "error"
48
+ }
49
+ }
package/docs/README.md CHANGED
@@ -4,66 +4,68 @@ Each rule has emojis denoting:
4
4
 
5
5
  - 🚀 `graphql-eslint` rule
6
6
  - 🔮 `graphql-js` rule
7
+ - 🔧 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
8
+ - 💡 if some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
7
9
 
8
10
  <!-- 🚨 IMPORTANT! Do not manually modify this table. Run: `yarn generate:docs` -->
9
11
  <!-- prettier-ignore-start -->
10
- Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Description|&nbsp;&nbsp;&nbsp;&nbsp;Config&nbsp;&nbsp;&nbsp;&nbsp;|🚀&nbsp;/&nbsp;🔮
11
- -|-|:-:|:-:
12
- [alphabetize](rules/alphabetize.md)|Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.|![all][]|🚀
13
- [description-style](rules/description-style.md)|Require all comments to follow the same style (either block or inline).|![recommended][]|🚀
14
- [executable-definitions](rules/executable-definitions.md)|A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.|![recommended][]|🔮
15
- [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`.|![recommended][]|🔮
16
- [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.|![recommended][]|🔮
17
- [input-name](rules/input-name.md)|Require mutation argument to be always called "input" and input type to be called Mutation name + "Input".|![all][]|🚀
18
- [known-argument-names](rules/known-argument-names.md)|A GraphQL field is only valid if all supplied arguments are defined by that field.|![recommended][]|🔮
19
- [known-directives](rules/known-directives.md)|A GraphQL document is only valid if all `@directives` are known by the schema and legally positioned.|![recommended][]|🔮
20
- [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.|![recommended][]|🔮
21
- [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.|![recommended][]|🔮
22
- [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.|![recommended][]|🔮
23
- [lone-schema-definition](rules/lone-schema-definition.md)|A GraphQL document is only valid if it contains only one schema definition.|![recommended][]|🔮
24
- [match-document-filename](rules/match-document-filename.md)|This rule allows you to enforce that the file name should match the operation name.|![all][]|🚀
25
- [naming-convention](rules/naming-convention.md)|Require names to follow specified conventions.|![recommended][]|🚀
26
- [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.|![recommended][]|🚀
27
- [no-case-insensitive-enum-values-duplicates](rules/no-case-insensitive-enum-values-duplicates.md)|Disallow case-insensitive enum values duplicates.|![recommended][]|🚀
28
- [no-deprecated](rules/no-deprecated.md)|Enforce that deprecated fields or enum values are not in use by operations.|![recommended][]|🚀
29
- [no-duplicate-fields](rules/no-duplicate-fields.md)|Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.|![recommended][]|🚀
30
- [no-fragment-cycles](rules/no-fragment-cycles.md)|A GraphQL fragment is only valid when it does not have cycles in fragments usage.|![recommended][]|🔮
31
- [no-hashtag-description](rules/no-hashtag-description.md)|Requires to use `"""` or `"` for adding a GraphQL description instead of `#`.|![recommended][]|🚀
32
- [no-root-type](rules/no-root-type.md)|Disallow using root types `mutation` and/or `subscription`.||🚀
33
- [no-scalar-result-type-on-mutation](rules/no-scalar-result-type-on-mutation.md)|Avoid scalar result type on mutation type to make sure to return a valid state.|![all][]|🚀
34
- [no-typename-prefix](rules/no-typename-prefix.md)|Enforces users to avoid using the type name in a field name while defining your schema.|![recommended][]|🚀
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.|![recommended][]|🔮
36
- [no-unreachable-types](rules/no-unreachable-types.md)|Requires all types to be reachable at some level by root level fields.|![recommended][]|🚀
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.|![recommended][]|🔮
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.|![recommended][]|🔮
40
- [one-field-subscriptions](rules/one-field-subscriptions.md)|A GraphQL subscription is valid only if it contains a single root field.|![recommended][]|🔮
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.|![recommended][]|🔮
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.|![recommended][]|🔮
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.|![recommended][]|🔮
45
- [require-deprecation-date](rules/require-deprecation-date.md)|Require deletion date on `@deprecated` directive. Suggest removing deprecated things after deprecated date.|![all][]|🚀
46
- [require-deprecation-reason](rules/require-deprecation-reason.md)|Require all deprecation directives to specify a reason.|![recommended][]|🚀
47
- [require-description](rules/require-description.md)|Enforce descriptions in type definitions and operations.|![recommended][]|🚀
48
- [require-field-of-type-query-in-mutation-result](rules/require-field-of-type-query-in-mutation-result.md)|Allow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application.|![all][]|🚀
49
- [require-id-when-available](rules/require-id-when-available.md)|Enforce selecting specific fields when they are available on the GraphQL type.|![recommended][]|🚀
50
- [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.|![recommended][]|🔮
51
- [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).|![recommended][]|🚀
52
- [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.|![recommended][]|🚀
53
- [unique-argument-names](rules/unique-argument-names.md)|A GraphQL field or directive is only valid if all supplied arguments are uniquely named.|![recommended][]|🔮
54
- [unique-directive-names](rules/unique-directive-names.md)|A GraphQL document is only valid if all defined directives have unique names.|![recommended][]|🔮
55
- [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.|![recommended][]|🔮
56
- [unique-enum-value-names](rules/unique-enum-value-names.md)|A GraphQL enum type is only valid if all its values are uniquely named.||🔮
57
- [unique-field-definition-names](rules/unique-field-definition-names.md)|A GraphQL complex type is only valid if all its fields are uniquely named.|![recommended][]|🔮
58
- [unique-fragment-name](rules/unique-fragment-name.md)|Enforce unique fragment names across your project.|![all][]|🚀
59
- [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.|![recommended][]|🔮
60
- [unique-operation-name](rules/unique-operation-name.md)|Enforce unique operation names across your project.|![all][]|🚀
61
- [unique-operation-types](rules/unique-operation-types.md)|A GraphQL document is only valid if it has only one type per operation.|![recommended][]|🔮
62
- [unique-type-names](rules/unique-type-names.md)|A GraphQL document is only valid if all defined types have unique names.|![recommended][]|🔮
63
- [unique-variable-names](rules/unique-variable-names.md)|A GraphQL operation is only valid if all its variables are uniquely named.|![recommended][]|🔮
64
- [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.|![recommended][]|🔮
65
- [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).|![recommended][]|🔮
66
- [variables-in-allowed-position](rules/variables-in-allowed-position.md)|Variables passed to field arguments conform to type.|![recommended][]|🔮
12
+ Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Description|&nbsp;&nbsp;&nbsp;&nbsp;Config&nbsp;&nbsp;&nbsp;&nbsp;|🚀&nbsp;/&nbsp;🔮|🔧&nbsp;/&nbsp;💡
13
+ -|-|:-:|:-:|:-:
14
+ [alphabetize](rules/alphabetize.md)|Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.|![all][]|🚀|🔧
15
+ [description-style](rules/description-style.md)|Require all comments to follow the same style (either block or inline).|![recommended][]|🚀|💡
16
+ [executable-definitions](rules/executable-definitions.md)|A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.|![recommended][]|🔮|
17
+ [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`.|![recommended][]|🔮|
18
+ [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.|![recommended][]|🔮|
19
+ [input-name](rules/input-name.md)|Require mutation argument to be always called "input" and input type to be called Mutation name + "Input".|![all][]|🚀|💡
20
+ [known-argument-names](rules/known-argument-names.md)|A GraphQL field is only valid if all supplied arguments are defined by that field.|![recommended][]|🔮|
21
+ [known-directives](rules/known-directives.md)|A GraphQL document is only valid if all `@directive`s are known by the schema and legally positioned.|![recommended][]|🔮|
22
+ [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.|![recommended][]|🔮|
23
+ [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.|![recommended][]|🔮|
24
+ [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.|![recommended][]|🔮|
25
+ [lone-schema-definition](rules/lone-schema-definition.md)|A GraphQL document is only valid if it contains only one schema definition.|![recommended][]|🔮|
26
+ [match-document-filename](rules/match-document-filename.md)|This rule allows you to enforce that the file name should match the operation name.|![all][]|🚀|
27
+ [naming-convention](rules/naming-convention.md)|Require names to follow specified conventions.|![recommended][]|🚀|💡
28
+ [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.|![recommended][]|🚀|💡
29
+ [no-case-insensitive-enum-values-duplicates](rules/no-case-insensitive-enum-values-duplicates.md)|Disallow case-insensitive enum values duplicates.|![recommended][]|🚀|💡
30
+ [no-deprecated](rules/no-deprecated.md)|Enforce that deprecated fields or enum values are not in use by operations.|![recommended][]|🚀|💡
31
+ [no-duplicate-fields](rules/no-duplicate-fields.md)|Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.|![recommended][]|🚀|💡
32
+ [no-fragment-cycles](rules/no-fragment-cycles.md)|A GraphQL fragment is only valid when it does not have cycles in fragments usage.|![recommended][]|🔮|
33
+ [no-hashtag-description](rules/no-hashtag-description.md)|Requires to use `"""` or `"` for adding a GraphQL description instead of `#`.|![recommended][]|🚀|💡
34
+ [no-root-type](rules/no-root-type.md)|Disallow using root types `mutation` and/or `subscription`.||🚀|💡
35
+ [no-scalar-result-type-on-mutation](rules/no-scalar-result-type-on-mutation.md)|Avoid scalar result type on mutation type to make sure to return a valid state.|![all][]|🚀|💡
36
+ [no-typename-prefix](rules/no-typename-prefix.md)|Enforces users to avoid using the type name in a field name while defining your schema.|![recommended][]|🚀|💡
37
+ [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.|![recommended][]|🔮|
38
+ [no-unreachable-types](rules/no-unreachable-types.md)|Requires all types to be reachable at some level by root level fields.|![recommended][]|🚀|💡
39
+ [no-unused-fields](rules/no-unused-fields.md)|Requires all fields to be used at some level by siblings operations.||🚀|💡
40
+ [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.|![recommended][]|🔮|
41
+ [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.|![recommended][]|🔮|
42
+ [one-field-subscriptions](rules/one-field-subscriptions.md)|A GraphQL subscription is valid only if it contains a single root field.|![recommended][]|🔮|
43
+ [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.|![recommended][]|🔮|
44
+ [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.|![recommended][]|🔮|
45
+ [possible-type-extension](rules/possible-type-extension.md)|A type extension is only valid if the type is defined and has the same kind.||🔮|
46
+ [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.|![recommended][]|🔮|
47
+ [require-deprecation-date](rules/require-deprecation-date.md)|Require deletion date on `@deprecated` directive. Suggest removing deprecated things after deprecated date.|![all][]|🚀|💡
48
+ [require-deprecation-reason](rules/require-deprecation-reason.md)|Require all deprecation directives to specify a reason.|![recommended][]|🚀|
49
+ [require-description](rules/require-description.md)|Enforce descriptions in type definitions and operations.|![recommended][]|🚀|
50
+ [require-field-of-type-query-in-mutation-result](rules/require-field-of-type-query-in-mutation-result.md)|Allow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application.|![all][]|🚀|
51
+ [require-id-when-available](rules/require-id-when-available.md)|Enforce selecting specific fields when they are available on the GraphQL type.|![recommended][]|🚀|💡
52
+ [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.|![recommended][]|🔮|
53
+ [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).|![recommended][]|🚀|💡
54
+ [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.|![recommended][]|🚀|
55
+ [unique-argument-names](rules/unique-argument-names.md)|A GraphQL field or directive is only valid if all supplied arguments are uniquely named.|![recommended][]|🔮|
56
+ [unique-directive-names](rules/unique-directive-names.md)|A GraphQL document is only valid if all defined directives have unique names.|![recommended][]|🔮|
57
+ [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.|![recommended][]|🔮|
58
+ [unique-enum-value-names](rules/unique-enum-value-names.md)|A GraphQL enum type is only valid if all its values are uniquely named.||🔮|
59
+ [unique-field-definition-names](rules/unique-field-definition-names.md)|A GraphQL complex type is only valid if all its fields are uniquely named.|![recommended][]|🔮|
60
+ [unique-fragment-name](rules/unique-fragment-name.md)|Enforce unique fragment names across your project.|![all][]|🚀|
61
+ [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.|![recommended][]|🔮|
62
+ [unique-operation-name](rules/unique-operation-name.md)|Enforce unique operation names across your project.|![all][]|🚀|
63
+ [unique-operation-types](rules/unique-operation-types.md)|A GraphQL document is only valid if it has only one type per operation.|![recommended][]|🔮|
64
+ [unique-type-names](rules/unique-type-names.md)|A GraphQL document is only valid if all defined types have unique names.|![recommended][]|🔮|
65
+ [unique-variable-names](rules/unique-variable-names.md)|A GraphQL operation is only valid if all its variables are uniquely named.|![recommended][]|🔮|
66
+ [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.|![recommended][]|🔮|
67
+ [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).|![recommended][]|🔮|
68
+ [variables-in-allowed-position](rules/variables-in-allowed-position.md)|Variables passed to field arguments conform to type.|![recommended][]|🔮|
67
69
  <!-- prettier-ignore-end -->
68
70
  [recommended]: https://img.shields.io/badge/-recommended-green.svg
69
71
  [all]: https://img.shields.io/badge/-all-blue.svg
@@ -2,7 +2,7 @@
2
2
 
3
3
  To get started with your own rules, start by understanding how [ESLint custom rules works](https://eslint.org/docs/developer-guide/working-with-rules).
4
4
 
5
- `graphql-eslint` converts the [GraphQL AST](https://graphql.org/graphql-js/language/) into [ESTree structure](https://github.com/estree/estree), so it allows you to easily travel the GraphQL AST tree easily.
5
+ `graphql-eslint` converts the [GraphQL AST](https://graphql.org/graphql-js/language) into [ESTree structure](https://github.com/estree/estree), so it allows you to easily travel the GraphQL AST tree easily.
6
6
 
7
7
  You can visit any GraphQL AST node in your custom rules, and report this as error. You don't need to have special handlers for code-files, since `graphql-eslint` extracts usages of `gql` and magic `/* GraphQL */` comments automatically, and runs it through the parser, and eventually it knows to adjust errors location to fit in your code files original location.
8
8
 
@@ -10,7 +10,7 @@ You can visit any GraphQL AST node in your custom rules, and report this as erro
10
10
 
11
11
  Start by creating a [simple ESLint rule file](https://eslint.org/docs/developer-guide/working-with-rules), and choose the AST nodes you wish to visit. It can either be a [simple AST node `Kind`](https://github.com/graphql/graphql-js/blob/master/src/language/kinds.d.ts) or a complex [ESLint selector](https://eslint.org/docs/developer-guide/selectors) that allows you to travel and filter AST nodes.
12
12
 
13
- We recommend you to read the [graphql-eslint parser documentation](./parser.md) before getting started, to understand the differences between the AST structures.
13
+ We recommend you to read the [graphql-eslint parser documentation](parser.md) before getting started, to understand the differences between the AST structures.
14
14
 
15
15
  The `graphql-eslint` comes with a TypeScript wrapper for ESLint rules, and provides a testkit to simplify testing process with GraphQL schemas, so you can use that by importing `GraphQLESLintRule` type. But if you wish to use JavaScript - that's fine :)
16
16
 
@@ -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 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
 
@@ -104,13 +104,12 @@ import { requireGraphQLSchemaFromContext } from '@graphql-eslint/eslint-plugin'
104
104
 
105
105
  export const rule = {
106
106
  create(context) {
107
- requireGraphQLSchemaFromContext(context)
107
+ requireGraphQLSchemaFromContext('your-rule-name', context)
108
108
 
109
109
  return {
110
110
  SelectionSet(node) {
111
111
  const typeInfo = node.typeInfo()
112
-
113
- if (typeInfo && typeInfo.gqlType) {
112
+ if (typeInfo.gqlType) {
114
113
  console.log(`The GraphQLOutputType is: ${typeInfo.gqlType}`)
115
114
  }
116
115
  }
@@ -119,7 +118,7 @@ export const rule = {
119
118
  }
120
119
  ```
121
120
 
122
- The structure of the return value of `.typeInfo()` is [defined here](https://github.com/dotansimha/graphql-eslint/blob/master/packages/plugin/src/estree-parser/converter.ts#L38-L46). So based on the `node` you are using, you'll get a different values on `.typeInfo()` result.
121
+ The structure of the return value of `.typeInfo()` is [defined here](https://github.com/dotansimha/graphql-eslint/blob/master/packages/plugin/src/estree-parser/converter.ts#L45-L53). So based on the `node` you are using, you'll get a different values on `.typeInfo()` result.
123
122
 
124
123
  ## Testing your rules
125
124
 
@@ -141,7 +140,8 @@ ruleTester.runGraphQLTests('my-rule', rule, {
141
140
  ],
142
141
  invalid: [
143
142
  {
144
- code: 'query invalid { foo }'
143
+ code: 'query invalid { foo }',
144
+ errors: [{ message: 'Your error message.' }],
145
145
  }
146
146
  ]
147
147
  })
@@ -2,13 +2,13 @@
2
2
 
3
3
  ### `graphQLParserOptions`
4
4
 
5
- With this configuration, you can specify custom configurations for GraphQL's `parse` method. By default, `graphql-eslint` parser just adds `noLocation: false` to make sure all parsed AST has `location` set, since we need this for tokening and for converting the GraphQL AST into ESTree.
5
+ With this configuration, you can specify custom configurations for GraphQL's `parse` method. By default, `graphql-eslint` parser just adds `noLocation: false` to make sure all parsed AST has `location` set, since we need this for tokenizing and for converting the GraphQL AST into ESTree.
6
6
 
7
- You can find the [complete set of options for this object here](https://github.com/graphql/graphql-js/blob/master/src/language/parser.d.ts#L7)
7
+ You can find the [complete set of options for this object here](https://github.com/graphql/graphql-js/blob/6e48d16f92b9a6df8638b1486354c6be2537033b/src/language/parser.ts#L73)
8
8
 
9
9
  ### `skipGraphQLConfig`
10
10
 
11
- If you are using [`graphql-config`](https://graphql-config.com/) in your project, the parser will automatically use that to load your default GraphQL schema.
11
+ If you are using [`graphql-config`](https://graphql-config.com) in your project, the parser will automatically use that to load your default GraphQL schema.
12
12
 
13
13
  You can disable this behaviour using `skipGraphQLConfig: true` in the `parserOptions`:
14
14
 
@@ -82,4 +82,4 @@ If you wish to send additional configuration for the `graphql-tools` loaders tha
82
82
  }
83
83
  ```
84
84
 
85
- > The configuration here is flexible, and will be sent to `graphql-tools` and it's loaders. So depends on the schema source, the options may vary. [You can read more about these loaders and their configuration here](https://www.graphql-tools.com/docs/api/interfaces/_loaders_graphql_file_src_index_.graphqlfileloaderoptions).
85
+ > The configuration here is flexible, and will be sent to `graphql-tools` and it's loaders. So depends on the schema source, the options may vary. [You can read more about these loaders and their configuration here](https://graphql-tools.com/docs/api/interfaces/loaders_graphql_file_src.GraphQLFileLoaderOptions#properties).
package/docs/parser.md CHANGED
@@ -40,10 +40,10 @@ Here's a list of changes that the parser performs, in order to make the GraphQL
40
40
 
41
41
  ### Loading GraphQL Schema
42
42
 
43
- If you are using [`graphql-config`](https://graphql-config.com/) in your project, the parser will automatically use that to load your default GraphQL schema (you can disable this behaviour using `skipGraphQLConfig: true` in the `parserOptions`).
43
+ If you are using [`graphql-config`](https://graphql-config.com) in your project, the parser will automatically use that to load your default GraphQL schema (you can disable this behaviour using `skipGraphQLConfig: true` in the `parserOptions`).
44
44
 
45
45
  If you are not using `graphql-config`, you can specify `parserOptions.schema` to load your GraphQL schema. The parser uses `graphql-tools` and it's loaders, that means you can either specify a URL, a path to a local `.json` (introspection) file, or a path to a local `.graphql` file(s). You can also use Glob expressions to load multiple files.
46
46
 
47
- [You can find more detail on the `parserOptions` config here](./parser-options.md)
47
+ [You can find more detail on the `parserOptions` config here](parser-options.md)
48
48
 
49
49
  Providing the schema will make sure that rules that needs it will be able to access it, and it enriches every converted AST node with `typeInfo`.
@@ -97,7 +97,7 @@ The schema defines the following properties:
97
97
 
98
98
  ### `fields` (array)
99
99
 
100
- Fields of `type`, `interface`, and `input`
100
+ Fields of `type`, `interface`, and `input`.
101
101
 
102
102
  The elements of the array can contain the following enum values:
103
103
 
@@ -112,7 +112,7 @@ Additional restrictions:
112
112
 
113
113
  ### `values` (array)
114
114
 
115
- Values of `enum`
115
+ Values of `enum`.
116
116
 
117
117
  The elements of the array can contain the following enum values:
118
118
 
@@ -125,7 +125,7 @@ Additional restrictions:
125
125
 
126
126
  ### `selections` (array)
127
127
 
128
- Selections of operations (`query`, `mutation` and `subscription`) and `fragment`
128
+ Selections of `fragment` and operations `query`, `mutation` and `subscription`.
129
129
 
130
130
  The elements of the array can contain the following enum values:
131
131
 
@@ -139,7 +139,7 @@ Additional restrictions:
139
139
 
140
140
  ### `variables` (array)
141
141
 
142
- Variables of operations (`query`, `mutation` and `subscription`)
142
+ Variables of operations `query`, `mutation` and `subscription`.
143
143
 
144
144
  The elements of the array can contain the following enum values:
145
145
 
@@ -152,7 +152,7 @@ Additional restrictions:
152
152
 
153
153
  ### `arguments` (array)
154
154
 
155
- Arguments of fields and directives
155
+ Arguments of fields and directives.
156
156
 
157
157
  The elements of the array can contain the following enum values:
158
158
 
@@ -166,6 +166,12 @@ Additional restrictions:
166
166
  * Minimum items: `1`
167
167
  * Unique items: `true`
168
168
 
169
+ ### `definitions` (boolean)
170
+
171
+ Definitions – `type`, `interface`, `enum`, `scalar`, `input`, `union` and `directive`.
172
+
173
+ Default: `false`
174
+
169
175
  ## Resources
170
176
 
171
177
  - [Rule source](../../packages/plugin/src/rules/alphabetize.ts)
@@ -2,6 +2,8 @@
2
2
 
3
3
  ✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file enables this rule.
4
4
 
5
+ 💡 This rule provides [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
6
+
5
7
  - Category: `Schema`
6
8
  - Rule name: `@graphql-eslint/description-style`
7
9
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -9,7 +9,7 @@
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.
13
13
 
14
14
  ## Resources
15
15
 
@@ -9,7 +9,7 @@
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.
13
13
 
14
14
  ## Resources
15
15
 
@@ -9,7 +9,7 @@
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.
13
13
 
14
14
  ## Resources
15
15
 
@@ -1,5 +1,7 @@
1
1
  # `input-name`
2
2
 
3
+ 💡 This rule provides [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
4
+
3
5
  - Category: `Schema`
4
6
  - Rule name: `@graphql-eslint/input-name`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
@@ -9,7 +9,7 @@
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.
13
13
 
14
14
  ## Resources
15
15
 
@@ -7,9 +7,36 @@
7
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
8
8
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
9
9
 
10
- A GraphQL document is only valid if all `@directives` are known by the schema and legally positioned.
10
+ A GraphQL document is only valid if all `@directive`s 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.
13
+
14
+ ## Usage Examples
15
+
16
+ ### Valid
17
+
18
+ ```graphql
19
+ # eslint @graphql-eslint/known-directives: ['error', { ignoreClientDirectives: ['client'] }]
20
+
21
+ {
22
+ product {
23
+ someClientField @client
24
+ }
25
+ }
26
+ ```
27
+
28
+ ## Config Schema
29
+
30
+ The schema defines the following properties:
31
+
32
+ ### `ignoreClientDirectives` (array, required)
33
+
34
+ The object is an array with all elements of the type `string`.
35
+
36
+ Additional restrictions:
37
+
38
+ * Minimum items: `1`
39
+ * Unique items: `true`
13
40
 
14
41
  ## Resources
15
42
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  A GraphQL document is only valid if all `...Fragment` fragment spreads refer to fragments defined in the same document.
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/KnownFragmentNamesRule.ts).
12
+ > This rule is a wrapper around a `graphql-js` validation function.
13
13
 
14
14
  ## Usage Examples
15
15
 
@@ -9,7 +9,7 @@
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.
13
13
 
14
14
  ## Resources
15
15
 
@@ -9,7 +9,7 @@
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.
13
13
 
14
14
  ## Resources
15
15