@graphql-eslint/eslint-plugin 3.0.0-alpha-580615a.0 → 3.0.0-alpha-4613dfe.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 (89) hide show
  1. package/README.md +19 -8
  2. package/configs/base.d.ts +5 -0
  3. package/configs/index.d.ts +78 -121
  4. package/configs/operations-all.d.ts +19 -0
  5. package/configs/operations-recommended.d.ts +51 -0
  6. package/configs/schema-all.d.ts +17 -0
  7. package/configs/schema-recommended.d.ts +46 -0
  8. package/docs/README.md +11 -19
  9. package/docs/deprecated-rules.md +21 -0
  10. package/docs/rules/alphabetize.md +1 -1
  11. package/docs/rules/description-style.md +5 -3
  12. package/docs/rules/executable-definitions.md +2 -2
  13. package/docs/rules/fields-on-correct-type.md +2 -2
  14. package/docs/rules/fragments-on-composite-type.md +2 -2
  15. package/docs/rules/input-name.md +1 -1
  16. package/docs/rules/known-argument-names.md +2 -2
  17. package/docs/rules/known-directives.md +2 -2
  18. package/docs/rules/known-fragment-names.md +2 -2
  19. package/docs/rules/known-type-names.md +2 -2
  20. package/docs/rules/lone-anonymous-operation.md +2 -2
  21. package/docs/rules/lone-schema-definition.md +2 -2
  22. package/docs/rules/match-document-filename.md +6 -4
  23. package/docs/rules/naming-convention.md +180 -41
  24. package/docs/rules/no-anonymous-operations.md +2 -2
  25. package/docs/rules/no-case-insensitive-enum-values-duplicates.md +2 -2
  26. package/docs/rules/no-deprecated.md +3 -1
  27. package/docs/rules/{avoid-duplicate-fields.md → no-duplicate-fields.md} +10 -8
  28. package/docs/rules/no-fragment-cycles.md +2 -2
  29. package/docs/rules/no-hashtag-description.md +3 -1
  30. package/docs/rules/no-root-type.md +9 -14
  31. package/docs/rules/{avoid-scalar-result-type-on-mutation.md → no-scalar-result-type-on-mutation.md} +7 -7
  32. package/docs/rules/no-typename-prefix.md +37 -0
  33. package/docs/rules/no-undefined-variables.md +2 -2
  34. package/docs/rules/no-unreachable-types.md +3 -1
  35. package/docs/rules/no-unused-fields.md +1 -1
  36. package/docs/rules/no-unused-fragments.md +2 -2
  37. package/docs/rules/no-unused-variables.md +2 -2
  38. package/docs/rules/one-field-subscriptions.md +2 -2
  39. package/docs/rules/overlapping-fields-can-be-merged.md +2 -2
  40. package/docs/rules/possible-fragment-spread.md +2 -2
  41. package/docs/rules/possible-type-extension.md +2 -2
  42. package/docs/rules/provided-required-arguments.md +2 -2
  43. package/docs/rules/require-deprecation-date.md +1 -1
  44. package/docs/rules/require-deprecation-reason.md +2 -2
  45. package/docs/rules/require-description.md +38 -22
  46. package/docs/rules/require-field-of-type-query-in-mutation-result.md +1 -1
  47. package/docs/rules/require-id-when-available.md +3 -1
  48. package/docs/rules/scalar-leafs.md +2 -2
  49. package/docs/rules/selection-set-depth.md +9 -2
  50. package/docs/rules/strict-id-in-types.md +16 -10
  51. package/docs/rules/unique-argument-names.md +2 -2
  52. package/docs/rules/unique-directive-names-per-location.md +2 -2
  53. package/docs/rules/unique-directive-names.md +2 -2
  54. package/docs/rules/unique-enum-value-names.md +2 -2
  55. package/docs/rules/unique-field-definition-names.md +2 -2
  56. package/docs/rules/unique-fragment-name.md +1 -1
  57. package/docs/rules/unique-input-field-names.md +2 -2
  58. package/docs/rules/unique-operation-name.md +1 -1
  59. package/docs/rules/unique-operation-types.md +2 -2
  60. package/docs/rules/unique-type-names.md +2 -2
  61. package/docs/rules/unique-variable-names.md +2 -2
  62. package/docs/rules/value-literals-of-correct-type.md +2 -2
  63. package/docs/rules/variables-are-input-types.md +2 -2
  64. package/docs/rules/variables-in-allowed-position.md +2 -2
  65. package/index.js +682 -718
  66. package/index.mjs +683 -719
  67. package/package.json +1 -1
  68. package/rules/alphabetize.d.ts +8 -10
  69. package/rules/description-style.d.ts +4 -6
  70. package/rules/index.d.ts +115 -119
  71. package/rules/input-name.d.ts +1 -1
  72. package/rules/match-document-filename.d.ts +8 -10
  73. package/rules/naming-convention.d.ts +3 -4
  74. package/rules/{avoid-duplicate-fields.d.ts → no-duplicate-fields.d.ts} +0 -0
  75. package/rules/no-root-type.d.ts +1 -1
  76. package/rules/{avoid-scalar-result-type-on-mutation.d.ts → no-scalar-result-type-on-mutation.d.ts} +0 -0
  77. package/rules/{avoid-typename-prefix.d.ts → no-typename-prefix.d.ts} +0 -0
  78. package/rules/require-description.d.ts +2 -3
  79. package/rules/require-id-when-available.d.ts +3 -3
  80. package/rules/selection-set-depth.d.ts +3 -3
  81. package/rules/strict-id-in-types.d.ts +6 -8
  82. package/types.d.ts +9 -5
  83. package/configs/all.d.ts +0 -104
  84. package/configs/recommended.d.ts +0 -72
  85. package/docs/rules/avoid-operation-name-prefix.md +0 -50
  86. package/docs/rules/avoid-typename-prefix.md +0 -37
  87. package/docs/rules/no-operation-name-suffix.md +0 -38
  88. package/rules/avoid-operation-name-prefix.d.ts +0 -9
  89. package/rules/no-operation-name-suffix.d.ts +0 -3
@@ -1,8 +1,8 @@
1
1
  # `known-directives`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` and `"plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
4
 
5
- - Category: `Validation`
5
+ - Category: `Schema & Operations`
6
6
  - Rule name: `@graphql-eslint/known-directives`
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)
@@ -1,8 +1,8 @@
1
1
  # `known-fragment-names`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
4
 
5
- - Category: `Validation`
5
+ - Category: `Operations`
6
6
  - Rule name: `@graphql-eslint/known-fragment-names`
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)
@@ -1,8 +1,8 @@
1
1
  # `known-type-names`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` and `"plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
4
 
5
- - Category: `Validation`
5
+ - Category: `Schema & Operations`
6
6
  - Rule name: `@graphql-eslint/known-type-names`
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)
@@ -1,8 +1,8 @@
1
1
  # `lone-anonymous-operation`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
4
 
5
- - Category: `Validation`
5
+ - Category: `Operations`
6
6
  - Rule name: `@graphql-eslint/lone-anonymous-operation`
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)
@@ -1,8 +1,8 @@
1
1
  # `lone-schema-definition`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file enables this rule.
4
4
 
5
- - Category: `Validation`
5
+ - Category: `Schema`
6
6
  - Rule name: `@graphql-eslint/lone-schema-definition`
7
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
8
8
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
@@ -1,6 +1,6 @@
1
1
  # `match-document-filename`
2
2
 
3
- - Category: `Best Practices`
3
+ - Category: `Operations`
4
4
  - Rule name: `@graphql-eslint/match-document-filename`
5
5
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
6
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
@@ -88,7 +88,7 @@ query UserById {
88
88
 
89
89
  The schema defines the following properties:
90
90
 
91
- ### `fileExtension` (string, enum)
91
+ ### `fileExtension` (enum)
92
92
 
93
93
  This element must be one of the following enum values:
94
94
 
@@ -129,7 +129,7 @@ The object must be one of the following types:
129
129
 
130
130
  The schema defines the following additional types:
131
131
 
132
- ## `asString` (string)
132
+ ## `asString` (enum)
133
133
 
134
134
  One of: `camelCase`, `PascalCase`, `snake_case`, `UPPER_CASE`, `kebab-case`
135
135
 
@@ -137,7 +137,7 @@ One of: `camelCase`, `PascalCase`, `snake_case`, `UPPER_CASE`, `kebab-case`
137
137
 
138
138
  Properties of the `asObject` object:
139
139
 
140
- ### `style` (string, enum)
140
+ ### `style` (enum)
141
141
 
142
142
  This element must be one of the following enum values:
143
143
 
@@ -147,6 +147,8 @@ This element must be one of the following enum values:
147
147
  - `UPPER_CASE`
148
148
  - `kebab-case`
149
149
 
150
+ ### `suffix` (string)
151
+
150
152
  ## Resources
151
153
 
152
154
  - [Rule source](../../packages/plugin/src/rules/match-document-filename.ts)
@@ -1,8 +1,8 @@
1
1
  # `naming-convention`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` and `"plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
4
 
5
- - Category: `Best Practices`
5
+ - Category: `Schema & Operations`
6
6
  - Rule name: `@graphql-eslint/naming-convention`
7
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
8
8
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
@@ -21,6 +21,26 @@ type user {
21
21
  }
22
22
  ```
23
23
 
24
+ ### Incorrect
25
+
26
+ ```graphql
27
+ # eslint @graphql-eslint/naming-convention: ['error', { FragmentDefinition: { style: 'PascalCase', forbiddenSuffixes: ['Fragment'] } }]
28
+
29
+ fragment UserFragment on User {
30
+ # ...
31
+ }
32
+ ```
33
+
34
+ ### Incorrect
35
+
36
+ ```graphql
37
+ # eslint @graphql-eslint/naming-convention: ['error', { 'FieldDefinition[parent.name.value=Query]': { forbiddenPrefixes: ['get'] } }]
38
+
39
+ type Query {
40
+ getUsers: [User!]!
41
+ }
42
+ ```
43
+
24
44
  ### Correct
25
45
 
26
46
  ```graphql
@@ -31,20 +51,46 @@ type User {
31
51
  }
32
52
  ```
33
53
 
54
+ ### Correct
55
+
56
+ ```graphql
57
+ # eslint @graphql-eslint/naming-convention: ['error', { FragmentDefinition: { style: 'PascalCase', forbiddenSuffixes: ['Fragment'] } }]
58
+
59
+ fragment UserFields on User {
60
+ # ...
61
+ }
62
+ ```
63
+
64
+ ### Correct
65
+
66
+ ```graphql
67
+ # eslint @graphql-eslint/naming-convention: ['error', { 'FieldDefinition[parent.name.value=Query]': { forbiddenPrefixes: ['get'] } }]
68
+
69
+ type Query {
70
+ users: [User!]!
71
+ }
72
+ ```
73
+
34
74
  ## Config Schema
35
75
 
76
+ > It's possible to use a [`selector`](https://eslint.org/docs/developer-guide/selectors) that starts with allowed `ASTNode` names which are described below.
77
+ >
78
+ > Paste or drop code into the editor in [ASTExplorer](https://astexplorer.net) and inspect the generated AST to compose your selector.
79
+ >
80
+ > Example: pattern property `FieldDefinition[parent.name.value=Query]` will match only fields for type `Query`.
81
+
36
82
  The schema defines the following properties:
37
83
 
38
84
  ### `types`
39
85
 
40
86
  Includes:
41
87
 
42
- - [ObjectTypeDefinition](https://spec.graphql.org/October2021/#ObjectTypeDefinition)
43
- - [InterfaceTypeDefinition](https://spec.graphql.org/October2021/#InterfaceTypeDefinition)
44
- - [EnumTypeDefinition](https://spec.graphql.org/October2021/#EnumTypeDefinition)
45
- - [ScalarTypeDefinition](https://spec.graphql.org/October2021/#ScalarTypeDefinition)
46
- - [InputObjectTypeDefinition](https://spec.graphql.org/October2021/#InputObjectTypeDefinition)
47
- - [UnionTypeDefinition](https://spec.graphql.org/October2021/#UnionTypeDefinition)
88
+ - `ObjectTypeDefinition`
89
+ - `InterfaceTypeDefinition`
90
+ - `EnumTypeDefinition`
91
+ - `ScalarTypeDefinition`
92
+ - `InputObjectTypeDefinition`
93
+ - `UnionTypeDefinition`
48
94
 
49
95
  The object must be one of the following types:
50
96
 
@@ -55,57 +101,150 @@ The object must be one of the following types:
55
101
 
56
102
  Includes:
57
103
 
58
- - [FieldDefinition](https://spec.graphql.org/October2021/#FieldDefinition)
59
- - [InputValueDefinition](https://spec.graphql.org/October2021/#InputValueDefinition)
60
- - [VariableDefinition](https://spec.graphql.org/October2021/#VariableDefinition)
61
- - [Argument](https://spec.graphql.org/October2021/#Argument)
62
- - [DirectiveDefinition](https://spec.graphql.org/October2021/#DirectiveDefinition)
104
+ - `FieldDefinition`
105
+ - `InputValueDefinition`
106
+ - `Argument`
107
+ - `DirectiveDefinition`
63
108
 
64
109
  The object must be one of the following types:
65
110
 
66
111
  * `asString`
67
112
  * `asObject`
68
113
 
69
- ### `allowLeadingUnderscore` (boolean)
114
+ ### `Argument`
70
115
 
71
- Default: `false`
116
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#Argument).
72
117
 
73
- ### `allowTrailingUnderscore` (boolean)
118
+ The object must be one of the following types:
74
119
 
75
- Default: `false`
120
+ * `asString`
121
+ * `asObject`
76
122
 
77
- ### `overrides` (object)
78
-
79
- May contain the following `ASTNode` names:
80
-
81
- - [Argument](https://spec.graphql.org/October2021/#Argument)
82
- - [DirectiveDefinition](https://spec.graphql.org/October2021/#DirectiveDefinition)
83
- - [EnumTypeDefinition](https://spec.graphql.org/October2021/#EnumTypeDefinition)
84
- - [EnumValueDefinition](https://spec.graphql.org/October2021/#EnumValueDefinition)
85
- - [FieldDefinition](https://spec.graphql.org/October2021/#FieldDefinition)
86
- - [FragmentDefinition](https://spec.graphql.org/October2021/#FragmentDefinition)
87
- - [InputObjectTypeDefinition](https://spec.graphql.org/October2021/#InputObjectTypeDefinition)
88
- - [InputValueDefinition](https://spec.graphql.org/October2021/#InputValueDefinition)
89
- - [InterfaceTypeDefinition](https://spec.graphql.org/October2021/#InterfaceTypeDefinition)
90
- - [ObjectTypeDefinition](https://spec.graphql.org/October2021/#ObjectTypeDefinition)
91
- - [OperationDefinition](https://spec.graphql.org/October2021/#OperationDefinition)
92
- - [ScalarTypeDefinition](https://spec.graphql.org/October2021/#ScalarTypeDefinition)
93
- - [UnionTypeDefinition](https://spec.graphql.org/October2021/#UnionTypeDefinition)
94
- - [VariableDefinition](https://spec.graphql.org/October2021/#VariableDefinition)
95
-
96
- > It's also possible to use a [`selector`](https://eslint.org/docs/developer-guide/selectors) that starts with `ASTNode` name
97
- >
98
- > Example: pattern property `FieldDefinition[parent.name.value=Query]` will match only fields for type `Query`
123
+ ### `DirectiveDefinition`
124
+
125
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#DirectiveDefinition).
126
+
127
+ The object must be one of the following types:
128
+
129
+ * `asString`
130
+ * `asObject`
131
+
132
+ ### `EnumTypeDefinition`
133
+
134
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#EnumTypeDefinition).
135
+
136
+ The object must be one of the following types:
137
+
138
+ * `asString`
139
+ * `asObject`
140
+
141
+ ### `EnumValueDefinition`
142
+
143
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#EnumValueDefinition).
144
+
145
+ The object must be one of the following types:
146
+
147
+ * `asString`
148
+ * `asObject`
149
+
150
+ ### `FieldDefinition`
151
+
152
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#FieldDefinition).
153
+
154
+ The object must be one of the following types:
155
+
156
+ * `asString`
157
+ * `asObject`
99
158
 
100
- Pattern properties of the `overrides` object:
159
+ ### `FragmentDefinition`
101
160
 
102
- #### `^(Argument|DirectiveDefinition|EnumTypeDefinition|EnumValueDefinition|FieldDefinition|FragmentDefinition|InputObjectTypeDefinition|InputValueDefinition|InterfaceTypeDefinition|ObjectTypeDefinition|OperationDefinition|ScalarTypeDefinition|UnionTypeDefinition|VariableDefinition)(.+)?$`
161
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#FragmentDefinition).
103
162
 
104
163
  The object must be one of the following types:
105
164
 
106
165
  * `asString`
107
166
  * `asObject`
108
167
 
168
+ ### `InputObjectTypeDefinition`
169
+
170
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#InputObjectTypeDefinition).
171
+
172
+ The object must be one of the following types:
173
+
174
+ * `asString`
175
+ * `asObject`
176
+
177
+ ### `InputValueDefinition`
178
+
179
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#InputValueDefinition).
180
+
181
+ The object must be one of the following types:
182
+
183
+ * `asString`
184
+ * `asObject`
185
+
186
+ ### `InterfaceTypeDefinition`
187
+
188
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#InterfaceTypeDefinition).
189
+
190
+ The object must be one of the following types:
191
+
192
+ * `asString`
193
+ * `asObject`
194
+
195
+ ### `ObjectTypeDefinition`
196
+
197
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#ObjectTypeDefinition).
198
+
199
+ The object must be one of the following types:
200
+
201
+ * `asString`
202
+ * `asObject`
203
+
204
+ ### `OperationDefinition`
205
+
206
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#OperationDefinition).
207
+
208
+ The object must be one of the following types:
209
+
210
+ * `asString`
211
+ * `asObject`
212
+
213
+ ### `ScalarTypeDefinition`
214
+
215
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#ScalarTypeDefinition).
216
+
217
+ The object must be one of the following types:
218
+
219
+ * `asString`
220
+ * `asObject`
221
+
222
+ ### `UnionTypeDefinition`
223
+
224
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#UnionTypeDefinition).
225
+
226
+ The object must be one of the following types:
227
+
228
+ * `asString`
229
+ * `asObject`
230
+
231
+ ### `VariableDefinition`
232
+
233
+ Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#VariableDefinition).
234
+
235
+ The object must be one of the following types:
236
+
237
+ * `asString`
238
+ * `asObject`
239
+
240
+ ### `allowLeadingUnderscore` (boolean)
241
+
242
+ Default: `false`
243
+
244
+ ### `allowTrailingUnderscore` (boolean)
245
+
246
+ Default: `false`
247
+
109
248
  ---
110
249
 
111
250
  # Sub Schemas
@@ -1,8 +1,8 @@
1
1
  # `no-anonymous-operations`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
4
 
5
- - Category: `Best Practices`
5
+ - Category: `Operations`
6
6
  - Rule name: `@graphql-eslint/no-anonymous-operations`
7
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
8
8
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
@@ -1,10 +1,10 @@
1
1
  # `no-case-insensitive-enum-values-duplicates`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file enables this rule.
4
4
 
5
5
  🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
6
6
 
7
- - Category: `Best Practices`
7
+ - Category: `Schema`
8
8
  - Rule name: `@graphql-eslint/no-case-insensitive-enum-values-duplicates`
9
9
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
10
10
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
@@ -1,6 +1,8 @@
1
1
  # `no-deprecated`
2
2
 
3
- - Category: `Best Practices`
3
+ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
+
5
+ - Category: `Operations`
4
6
  - Rule name: `@graphql-eslint/no-deprecated`
5
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
8
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
@@ -1,7 +1,9 @@
1
- # `avoid-duplicate-fields`
1
+ # `no-duplicate-fields`
2
2
 
3
- - Category: `Stylistic Issues`
4
- - Rule name: `@graphql-eslint/avoid-duplicate-fields`
3
+ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
+
5
+ - Category: `Operations`
6
+ - Rule name: `@graphql-eslint/no-duplicate-fields`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
8
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7
9
 
@@ -12,7 +14,7 @@ Checks for duplicate fields in selection set, variables in operation definition,
12
14
  ### Incorrect
13
15
 
14
16
  ```graphql
15
- # eslint @graphql-eslint/avoid-duplicate-fields: 'error'
17
+ # eslint @graphql-eslint/no-duplicate-fields: 'error'
16
18
 
17
19
  query {
18
20
  user {
@@ -26,7 +28,7 @@ query {
26
28
  ### Incorrect
27
29
 
28
30
  ```graphql
29
- # eslint @graphql-eslint/avoid-duplicate-fields: 'error'
31
+ # eslint @graphql-eslint/no-duplicate-fields: 'error'
30
32
 
31
33
  query {
32
34
  users(
@@ -43,7 +45,7 @@ query {
43
45
  ### Incorrect
44
46
 
45
47
  ```graphql
46
- # eslint @graphql-eslint/avoid-duplicate-fields: 'error'
48
+ # eslint @graphql-eslint/no-duplicate-fields: 'error'
47
49
 
48
50
  query (
49
51
  $first: Int!
@@ -57,5 +59,5 @@ query (
57
59
 
58
60
  ## Resources
59
61
 
60
- - [Rule source](../../packages/plugin/src/rules/avoid-duplicate-fields.ts)
61
- - [Test source](../../packages/plugin/tests/avoid-duplicate-fields.spec.ts)
62
+ - [Rule source](../../packages/plugin/src/rules/no-duplicate-fields.ts)
63
+ - [Test source](../../packages/plugin/tests/no-duplicate-fields.spec.ts)
@@ -1,8 +1,8 @@
1
1
  # `no-fragment-cycles`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
4
 
5
- - Category: `Validation`
5
+ - Category: `Operations`
6
6
  - Rule name: `@graphql-eslint/no-fragment-cycles`
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)
@@ -1,6 +1,8 @@
1
1
  # `no-hashtag-description`
2
2
 
3
- - Category: `Best Practices`
3
+ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file enables this rule.
4
+
5
+ - Category: `Schema`
4
6
  - Rule name: `@graphql-eslint/no-hashtag-description`
5
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
8
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
@@ -1,15 +1,15 @@
1
1
  # `no-root-type`
2
2
 
3
- - Category: `Validation`
3
+ - Category: `Schema`
4
4
  - Rule name: `@graphql-eslint/no-root-type`
5
5
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
6
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7
7
 
8
- Disallow using root types for `read-only` or `write-only` schemas.
8
+ Disallow using root types `mutation` and/or `subscription`.
9
9
 
10
10
  ## Usage Examples
11
11
 
12
- ### Incorrect (`read-only` schema)
12
+ ### Incorrect
13
13
 
14
14
  ```graphql
15
15
  # eslint @graphql-eslint/no-root-type: ['error', { disallow: ['mutation', 'subscription'] }]
@@ -19,17 +19,7 @@ type Mutation {
19
19
  }
20
20
  ```
21
21
 
22
- ### Incorrect (`write-only` schema)
23
-
24
- ```graphql
25
- # eslint @graphql-eslint/no-root-type: ['error', { disallow: ['query'] }]
26
-
27
- type Query {
28
- users: [User!]!
29
- }
30
- ```
31
-
32
- ### Correct (`read-only` schema)
22
+ ### Correct
33
23
 
34
24
  ```graphql
35
25
  # eslint @graphql-eslint/no-root-type: ['error', { disallow: ['mutation', 'subscription'] }]
@@ -45,6 +35,11 @@ The schema defines the following properties:
45
35
 
46
36
  ### `disallow` (array, required)
47
37
 
38
+ The elements of the array can contain the following enum values:
39
+
40
+ - `mutation`
41
+ - `subscription`
42
+
48
43
  Additional restrictions:
49
44
 
50
45
  * Minimum items: `1`
@@ -1,7 +1,7 @@
1
- # `avoid-scalar-result-type-on-mutation`
1
+ # `no-scalar-result-type-on-mutation`
2
2
 
3
- - Category: `Best Practices`
4
- - Rule name: `@graphql-eslint/avoid-scalar-result-type-on-mutation`
3
+ - Category: `Schema`
4
+ - Rule name: `@graphql-eslint/no-scalar-result-type-on-mutation`
5
5
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
6
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7
7
 
@@ -12,7 +12,7 @@ Avoid scalar result type on mutation type to make sure to return a valid state.
12
12
  ### Incorrect
13
13
 
14
14
  ```graphql
15
- # eslint @graphql-eslint/avoid-scalar-result-type-on-mutation: 'error'
15
+ # eslint @graphql-eslint/no-scalar-result-type-on-mutation: 'error'
16
16
 
17
17
  type Mutation {
18
18
  createUser: Boolean
@@ -22,7 +22,7 @@ type Mutation {
22
22
  ### Correct
23
23
 
24
24
  ```graphql
25
- # eslint @graphql-eslint/avoid-scalar-result-type-on-mutation: 'error'
25
+ # eslint @graphql-eslint/no-scalar-result-type-on-mutation: 'error'
26
26
 
27
27
  type Mutation {
28
28
  createUser: User!
@@ -31,5 +31,5 @@ type Mutation {
31
31
 
32
32
  ## Resources
33
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)
34
+ - [Rule source](../../packages/plugin/src/rules/no-scalar-result-type-on-mutation.ts)
35
+ - [Test source](../../packages/plugin/tests/no-scalar-result-type-on-mutation.spec.ts)
@@ -0,0 +1,37 @@
1
+ # `no-typename-prefix`
2
+
3
+ ✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file enables this rule.
4
+
5
+ - Category: `Schema`
6
+ - Rule name: `@graphql-eslint/no-typename-prefix`
7
+ - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
8
+ - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
9
+
10
+ Enforces users to avoid using the type name in a field name while defining your schema.
11
+
12
+ ## Usage Examples
13
+
14
+ ### Incorrect
15
+
16
+ ```graphql
17
+ # eslint @graphql-eslint/no-typename-prefix: 'error'
18
+
19
+ type User {
20
+ userId: ID!
21
+ }
22
+ ```
23
+
24
+ ### Correct
25
+
26
+ ```graphql
27
+ # eslint @graphql-eslint/no-typename-prefix: 'error'
28
+
29
+ type User {
30
+ id: ID!
31
+ }
32
+ ```
33
+
34
+ ## Resources
35
+
36
+ - [Rule source](../../packages/plugin/src/rules/no-typename-prefix.ts)
37
+ - [Test source](../../packages/plugin/tests/no-typename-prefix.spec.ts)
@@ -1,8 +1,8 @@
1
1
  # `no-undefined-variables`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
4
 
5
- - Category: `Validation`
5
+ - Category: `Operations`
6
6
  - Rule name: `@graphql-eslint/no-undefined-variables`
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)
@@ -1,8 +1,10 @@
1
1
  # `no-unreachable-types`
2
2
 
3
+ ✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file enables this rule.
4
+
3
5
  🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
4
6
 
5
- - Category: `Best Practices`
7
+ - Category: `Schema`
6
8
  - Rule name: `@graphql-eslint/no-unreachable-types`
7
9
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
8
10
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
@@ -2,7 +2,7 @@
2
2
 
3
3
  🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
4
4
 
5
- - Category: `Best Practices`
5
+ - Category: `Schema`
6
6
  - Rule name: `@graphql-eslint/no-unused-fields`
7
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
8
8
  - Requires GraphQL Operations: `true` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
@@ -1,8 +1,8 @@
1
1
  # `no-unused-fragments`
2
2
 
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
3
+ ✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this rule.
4
4
 
5
- - Category: `Validation`
5
+ - Category: `Operations`
6
6
  - Rule name: `@graphql-eslint/no-unused-fragments`
7
7
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
8
8
  - Requires GraphQL Operations: `true` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)