@graphql-eslint/eslint-plugin 2.3.0-alpha-6ba4002.0 → 2.3.2-alpha-99be3d2.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 (70) hide show
  1. package/README.md +1 -1
  2. package/configs/all.d.ts +7 -0
  3. package/configs/index.d.ts +7 -0
  4. package/docs/README.md +2 -1
  5. package/docs/custom-rules.md +3 -3
  6. package/docs/rules/alphabetize.md +145 -0
  7. package/docs/rules/avoid-duplicate-fields.md +6 -1
  8. package/docs/rules/avoid-operation-name-prefix.md +8 -8
  9. package/docs/rules/avoid-scalar-result-type-on-mutation.md +6 -1
  10. package/docs/rules/avoid-typename-prefix.md +6 -1
  11. package/docs/rules/description-style.md +10 -9
  12. package/docs/rules/executable-definitions.md +6 -1
  13. package/docs/rules/fields-on-correct-type.md +6 -1
  14. package/docs/rules/fragments-on-composite-type.md +6 -1
  15. package/docs/rules/input-name.md +11 -10
  16. package/docs/rules/known-argument-names.md +6 -1
  17. package/docs/rules/known-directives.md +6 -1
  18. package/docs/rules/known-fragment-names.md +6 -1
  19. package/docs/rules/known-type-names.md +6 -1
  20. package/docs/rules/lone-anonymous-operation.md +6 -1
  21. package/docs/rules/lone-schema-definition.md +6 -1
  22. package/docs/rules/match-document-filename.md +12 -11
  23. package/docs/rules/naming-convention.md +21 -20
  24. package/docs/rules/no-anonymous-operations.md +6 -1
  25. package/docs/rules/no-case-insensitive-enum-values-duplicates.md +5 -1
  26. package/docs/rules/no-deprecated.md +6 -1
  27. package/docs/rules/no-fragment-cycles.md +6 -1
  28. package/docs/rules/no-hashtag-description.md +6 -1
  29. package/docs/rules/no-operation-name-suffix.md +5 -1
  30. package/docs/rules/no-undefined-variables.md +6 -1
  31. package/docs/rules/no-unreachable-types.md +6 -1
  32. package/docs/rules/no-unused-fields.md +6 -1
  33. package/docs/rules/no-unused-fragments.md +6 -1
  34. package/docs/rules/no-unused-variables.md +6 -1
  35. package/docs/rules/one-field-subscriptions.md +6 -1
  36. package/docs/rules/overlapping-fields-can-be-merged.md +6 -1
  37. package/docs/rules/possible-fragment-spread.md +6 -1
  38. package/docs/rules/possible-type-extension.md +6 -1
  39. package/docs/rules/provided-required-arguments.md +6 -1
  40. package/docs/rules/require-deprecation-date.md +5 -4
  41. package/docs/rules/require-deprecation-reason.md +6 -1
  42. package/docs/rules/require-description.md +5 -8
  43. package/docs/rules/require-field-of-type-query-in-mutation-result.md +6 -1
  44. package/docs/rules/require-id-when-available.md +6 -5
  45. package/docs/rules/scalar-leafs.md +6 -1
  46. package/docs/rules/selection-set-depth.md +6 -9
  47. package/docs/rules/strict-id-in-types.md +12 -11
  48. package/docs/rules/unique-argument-names.md +6 -1
  49. package/docs/rules/unique-directive-names-per-location.md +6 -1
  50. package/docs/rules/unique-directive-names.md +6 -1
  51. package/docs/rules/unique-enum-value-names.md +6 -1
  52. package/docs/rules/unique-field-definition-names.md +6 -1
  53. package/docs/rules/unique-fragment-name.md +6 -1
  54. package/docs/rules/unique-input-field-names.md +6 -1
  55. package/docs/rules/unique-operation-name.md +6 -1
  56. package/docs/rules/unique-operation-types.md +6 -1
  57. package/docs/rules/unique-type-names.md +6 -1
  58. package/docs/rules/unique-variable-names.md +6 -1
  59. package/docs/rules/value-literals-of-correct-type.md +6 -1
  60. package/docs/rules/variables-are-input-types.md +6 -1
  61. package/docs/rules/variables-in-allowed-position.md +6 -1
  62. package/estree-parser/estree-ast.d.ts +2 -2
  63. package/index.js +466 -102
  64. package/index.mjs +466 -102
  65. package/package.json +1 -1
  66. package/rules/alphabetize.d.ts +17 -0
  67. package/rules/index.d.ts +7 -0
  68. package/testkit.d.ts +6 -4
  69. package/types.d.ts +3 -0
  70. 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/configs/all.d.ts CHANGED
@@ -1,5 +1,12 @@
1
1
  export declare const allConfig: {
2
2
  rules: {
3
+ '@graphql-eslint/alphabetize': (string | {
4
+ fields: string[];
5
+ values: string[];
6
+ selections: string[];
7
+ variables: string[];
8
+ arguments: string[];
9
+ })[];
3
10
  '@graphql-eslint/avoid-duplicate-fields': string;
4
11
  '@graphql-eslint/avoid-operation-name-prefix': string;
5
12
  '@graphql-eslint/avoid-scalar-result-type-on-mutation': string;
@@ -1,6 +1,13 @@
1
1
  export declare const configs: {
2
2
  all: {
3
3
  rules: {
4
+ '@graphql-eslint/alphabetize': (string | {
5
+ fields: string[];
6
+ values: string[];
7
+ selections: string[];
8
+ variables: string[];
9
+ arguments: string[];
10
+ })[];
4
11
  '@graphql-eslint/avoid-duplicate-fields': string;
5
12
  '@graphql-eslint/avoid-operation-name-prefix': string;
6
13
  '@graphql-eslint/avoid-scalar-result-type-on-mutation': string;
package/docs/README.md CHANGED
@@ -11,6 +11,7 @@ Each rule has emojis denoting:
11
11
  <!-- prettier-ignore-start -->
12
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;🔮|🔧|✅
13
13
  -|-|:-:|-|-
14
+ [alphabetize](rules/alphabetize.md)|Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.|🚀||
14
15
  [avoid-duplicate-fields](rules/avoid-duplicate-fields.md)|Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.|🚀||
15
16
  [avoid-operation-name-prefix](rules/avoid-operation-name-prefix.md)|Enforce/avoid operation name prefix, useful if you wish to avoid prefix in your root fields, or avoid using REST terminology in your schema.|🚀||
16
17
  [avoid-scalar-result-type-on-mutation](rules/avoid-scalar-result-type-on-mutation.md)|Avoid scalar result type on mutation type to make sure to return a valid state.|🚀||
@@ -72,4 +73,4 @@ Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
72
73
 
73
74
  - [Writing Custom Rules](custom-rules.md)
74
75
  - [How the parser works?](parser.md)
75
- - [`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 = {
@@ -0,0 +1,145 @@
1
+ # `alphabetize`
2
+
3
+ - Category: `Best Practices`
4
+ - Rule name: `@graphql-eslint/alphabetize`
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
+ Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.
9
+
10
+ ## Usage Examples
11
+
12
+ ### Incorrect
13
+
14
+ ```graphql
15
+ # eslint @graphql-eslint/alphabetize: ['error', { fields: ['ObjectTypeDefinition'] }]
16
+
17
+ type User {
18
+ password: String
19
+ firstName: String! # should be before "password"
20
+ age: Int # should be before "firstName"
21
+ lastName: String!
22
+ }
23
+ ```
24
+
25
+ ### Correct
26
+
27
+ ```graphql
28
+ # eslint @graphql-eslint/alphabetize: ['error', { fields: ['ObjectTypeDefinition'] }]
29
+
30
+ type User {
31
+ age: Int
32
+ firstName: String!
33
+ lastName: String!
34
+ password: String
35
+ }
36
+ ```
37
+
38
+ ### Incorrect
39
+
40
+ ```graphql
41
+ # eslint @graphql-eslint/alphabetize: ['error', { values: ['EnumTypeDefinition'] }]
42
+
43
+ enum Role {
44
+ SUPER_ADMIN
45
+ ADMIN # should be before "SUPER_ADMIN"
46
+ USER
47
+ GOD # should be before "USER"
48
+ }
49
+ ```
50
+
51
+ ### Correct
52
+
53
+ ```graphql
54
+ # eslint @graphql-eslint/alphabetize: ['error', { values: ['EnumTypeDefinition'] }]
55
+
56
+ enum Role {
57
+ ADMIN
58
+ GOD
59
+ SUPER_ADMIN
60
+ USER
61
+ }
62
+ ```
63
+
64
+ ### Incorrect
65
+
66
+ ```graphql
67
+ # eslint @graphql-eslint/alphabetize: ['error', { selections: ['OperationDefinition'] }]
68
+
69
+ query {
70
+ me {
71
+ firstName
72
+ lastName
73
+ email # should be before "lastName"
74
+ }
75
+ }
76
+ ```
77
+
78
+ ### Correct
79
+
80
+ ```graphql
81
+ # eslint @graphql-eslint/alphabetize: ['error', { selections: ['OperationDefinition'] }]
82
+
83
+ query {
84
+ me {
85
+ email
86
+ firstName
87
+ lastName
88
+ }
89
+ }
90
+ ```
91
+
92
+ ## Config Schema
93
+
94
+ The schema defines the following properties:
95
+
96
+ ### `fields` (array)
97
+
98
+ Fields of `type`, `interface`, and `input`.
99
+
100
+ The elements of the array must contain the following properties:
101
+
102
+ - `ObjectTypeDefinition`
103
+ - `InterfaceTypeDefinition`
104
+ - `InputObjectTypeDefinition`
105
+
106
+ ### `values` (array)
107
+
108
+ Values of `enum`.
109
+
110
+ The elements of the array must contain the following properties:
111
+
112
+ - `EnumTypeDefinition`
113
+
114
+ ### `selections` (array)
115
+
116
+ Selections of operations (`query`, `mutation` and `subscription`) and `fragment`.
117
+
118
+ The elements of the array must contain the following properties:
119
+
120
+ - `OperationDefinition`
121
+ - `FragmentDefinition`
122
+
123
+ ### `variables` (array)
124
+
125
+ Variables of operations (`query`, `mutation` and `subscription`).
126
+
127
+ The elements of the array must contain the following properties:
128
+
129
+ - `OperationDefinition`
130
+
131
+ ### `arguments` (array)
132
+
133
+ Arguments of fields and directives.
134
+
135
+ The elements of the array must contain the following properties:
136
+
137
+ - `FieldDefinition`
138
+ - `Field`
139
+ - `DirectiveDefinition`
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)
@@ -31,20 +31,20 @@ query userDetails {
31
31
 
32
32
  ## Config Schema
33
33
 
34
- ### (array)
34
+ The schema defines the following properties:
35
35
 
36
- The schema defines an array with all elements of the type `object`.
37
-
38
- The array object has the following properties:
39
-
40
- #### `caseSensitive` (boolean)
36
+ ### `caseSensitive` (boolean)
41
37
 
42
38
  Default: `false`
43
39
 
44
- #### `keywords` (array, required)
40
+ ### `keywords` (array, required)
45
41
 
46
42
  The object is an array with all elements of the type `string`.
47
43
 
48
44
  Additional restrictions:
49
45
 
50
- * 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)
@@ -16,7 +16,7 @@ Require all comments to follow the same style (either block or inline).
16
16
 
17
17
  """ Description """
18
18
  type someTypeName {
19
- ...
19
+ # ...
20
20
  }
21
21
  ```
22
22
 
@@ -27,23 +27,24 @@ type someTypeName {
27
27
 
28
28
  " Description "
29
29
  type someTypeName {
30
- ...
30
+ # ...
31
31
  }
32
32
  ```
33
33
 
34
34
  ## Config Schema
35
35
 
36
- ### (array)
36
+ The schema defines the following properties:
37
37
 
38
- The schema defines an array with all elements of the type `object`.
39
-
40
- The array object has the following properties:
41
-
42
- #### `style` (string, enum)
38
+ ### `style` (string, enum)
43
39
 
44
40
  This element must be one of the following enum values:
45
41
 
46
42
  * `block`
47
43
  * `inline`
48
44
 
49
- 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)
@@ -42,32 +42,33 @@ type Mutation {
42
42
 
43
43
  ## Config Schema
44
44
 
45
- ### (array)
45
+ The schema defines the following properties:
46
46
 
47
- The schema defines an array with all elements of the type `object`.
48
-
49
- The array object has the following properties:
50
-
51
- #### `checkInputType` (boolean)
47
+ ### `checkInputType` (boolean)
52
48
 
53
49
  Check that the input type name follows the convention <mutationName>Input
54
50
 
55
51
  Default: `false`
56
52
 
57
- #### `caseSensitiveInputType` (boolean)
53
+ ### `caseSensitiveInputType` (boolean)
58
54
 
59
55
  Allow for case discrepancies in the input type name
60
56
 
61
57
  Default: `true`
62
58
 
63
- #### `checkQueries` (boolean)
59
+ ### `checkQueries` (boolean)
64
60
 
65
61
  Apply the rule to Queries
66
62
 
67
63
  Default: `false`
68
64
 
69
- #### `checkMutations` (boolean)
65
+ ### `checkMutations` (boolean)
70
66
 
71
67
  Apply the rule to Mutations
72
68
 
73
- 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)
@@ -86,41 +86,37 @@ query UserById {
86
86
 
87
87
  ## Config Schema
88
88
 
89
- ### (array)
89
+ The schema defines the following properties:
90
90
 
91
- The schema defines an array with all elements of the type `object`.
92
-
93
- The array object has the following properties:
94
-
95
- #### `fileExtension` (string, enum)
91
+ ### `fileExtension` (string, enum)
96
92
 
97
93
  This element must be one of the following enum values:
98
94
 
99
95
  * `.gql`
100
96
  * `.graphql`
101
97
 
102
- #### `query`
98
+ ### `query`
103
99
 
104
100
  The object must be one of the following types:
105
101
 
106
102
  * `asString`
107
103
  * `asObject`
108
104
 
109
- #### `mutation`
105
+ ### `mutation`
110
106
 
111
107
  The object must be one of the following types:
112
108
 
113
109
  * `asString`
114
110
  * `asObject`
115
111
 
116
- #### `subscription`
112
+ ### `subscription`
117
113
 
118
114
  The object must be one of the following types:
119
115
 
120
116
  * `asString`
121
117
  * `asObject`
122
118
 
123
- #### `fragment`
119
+ ### `fragment`
124
120
 
125
121
  The object must be one of the following types:
126
122
 
@@ -149,4 +145,9 @@ This element must be one of the following enum values:
149
145
  * `PascalCase`
150
146
  * `snake_case`
151
147
  * `UPPER_CASE`
152
- * `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)