@graphql-eslint/eslint-plugin 3.0.0-alpha-7462f3d.0 → 3.0.0-alpha-636cc2a.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.
- package/README.md +19 -8
- package/configs/base.d.ts +5 -0
- package/configs/index.d.ts +76 -117
- package/configs/operations-all.d.ts +19 -0
- package/configs/operations-recommended.d.ts +50 -0
- package/configs/schema-all.d.ts +17 -0
- package/configs/schema-recommended.d.ts +46 -0
- package/docs/README.md +9 -15
- package/docs/rules/alphabetize.md +1 -1
- package/docs/rules/description-style.md +5 -3
- package/docs/rules/executable-definitions.md +2 -2
- package/docs/rules/fields-on-correct-type.md +2 -2
- package/docs/rules/fragments-on-composite-type.md +2 -2
- package/docs/rules/input-name.md +1 -1
- package/docs/rules/known-argument-names.md +2 -2
- package/docs/rules/known-directives.md +2 -2
- package/docs/rules/known-fragment-names.md +2 -2
- package/docs/rules/known-type-names.md +2 -2
- package/docs/rules/lone-anonymous-operation.md +2 -2
- package/docs/rules/lone-schema-definition.md +2 -2
- package/docs/rules/match-document-filename.md +6 -4
- package/docs/rules/naming-convention.md +180 -41
- package/docs/rules/no-anonymous-operations.md +2 -2
- package/docs/rules/no-case-insensitive-enum-values-duplicates.md +2 -2
- package/docs/rules/no-deprecated.md +3 -1
- package/docs/rules/no-duplicate-fields.md +3 -1
- package/docs/rules/no-fragment-cycles.md +2 -2
- package/docs/rules/no-hashtag-description.md +3 -1
- package/docs/rules/no-root-type.md +4 -15
- package/docs/rules/no-scalar-result-type-on-mutation.md +1 -1
- package/docs/rules/no-typename-prefix.md +2 -2
- package/docs/rules/no-undefined-variables.md +2 -2
- package/docs/rules/no-unreachable-types.md +3 -1
- package/docs/rules/no-unused-fields.md +1 -1
- package/docs/rules/no-unused-fragments.md +2 -2
- package/docs/rules/no-unused-variables.md +2 -2
- package/docs/rules/one-field-subscriptions.md +2 -2
- package/docs/rules/overlapping-fields-can-be-merged.md +2 -2
- package/docs/rules/possible-fragment-spread.md +2 -2
- package/docs/rules/possible-type-extension.md +2 -2
- package/docs/rules/provided-required-arguments.md +2 -2
- package/docs/rules/require-deprecation-date.md +1 -1
- package/docs/rules/require-deprecation-reason.md +2 -2
- package/docs/rules/require-description.md +38 -22
- package/docs/rules/require-field-of-type-query-in-mutation-result.md +1 -1
- package/docs/rules/require-id-when-available.md +3 -1
- package/docs/rules/scalar-leafs.md +2 -2
- package/docs/rules/selection-set-depth.md +9 -2
- package/docs/rules/strict-id-in-types.md +16 -10
- package/docs/rules/unique-argument-names.md +2 -2
- package/docs/rules/unique-directive-names-per-location.md +2 -2
- package/docs/rules/unique-directive-names.md +2 -2
- package/docs/rules/unique-enum-value-names.md +2 -2
- package/docs/rules/unique-field-definition-names.md +2 -2
- package/docs/rules/unique-fragment-name.md +1 -1
- package/docs/rules/unique-input-field-names.md +2 -2
- package/docs/rules/unique-operation-name.md +1 -1
- package/docs/rules/unique-operation-types.md +2 -2
- package/docs/rules/unique-type-names.md +2 -2
- package/docs/rules/unique-variable-names.md +2 -2
- package/docs/rules/value-literals-of-correct-type.md +2 -2
- package/docs/rules/variables-are-input-types.md +2 -2
- package/docs/rules/variables-in-allowed-position.md +2 -2
- package/index.js +329 -208
- package/index.mjs +329 -208
- package/package.json +1 -1
- package/rules/alphabetize.d.ts +8 -10
- package/rules/description-style.d.ts +4 -6
- package/rules/index.d.ts +112 -114
- package/rules/input-name.d.ts +1 -1
- package/rules/match-document-filename.d.ts +8 -10
- package/rules/naming-convention.d.ts +3 -4
- package/rules/no-root-type.d.ts +1 -1
- package/rules/require-description.d.ts +2 -3
- package/rules/require-id-when-available.d.ts +3 -3
- package/rules/selection-set-depth.d.ts +3 -3
- package/rules/strict-id-in-types.d.ts +6 -8
- package/types.d.ts +9 -5
- package/configs/all.d.ts +0 -102
- package/configs/recommended.d.ts +0 -71
@@ -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: `
|
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: `
|
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: `
|
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` (
|
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` (
|
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` (
|
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: `
|
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
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
46
|
-
-
|
47
|
-
-
|
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
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
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
|
-
### `
|
114
|
+
### `Argument`
|
70
115
|
|
71
|
-
|
116
|
+
Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#Argument).
|
72
117
|
|
73
|
-
|
118
|
+
The object must be one of the following types:
|
74
119
|
|
75
|
-
|
120
|
+
* `asString`
|
121
|
+
* `asObject`
|
76
122
|
|
77
|
-
### `
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
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
|
-
|
159
|
+
### `FragmentDefinition`
|
101
160
|
|
102
|
-
|
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: `
|
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: `
|
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
|
-
|
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,6 +1,8 @@
|
|
1
1
|
# `no-duplicate-fields`
|
2
2
|
|
3
|
-
|
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-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)
|
@@ -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: `
|
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
|
-
|
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: `
|
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
|
8
|
+
Disallow using root types `mutation` and/or `subscription`.
|
9
9
|
|
10
10
|
## Usage Examples
|
11
11
|
|
12
|
-
### Incorrect
|
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
|
-
###
|
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'] }]
|
@@ -47,7 +37,6 @@ The schema defines the following properties:
|
|
47
37
|
|
48
38
|
The elements of the array can contain the following enum values:
|
49
39
|
|
50
|
-
- `query`
|
51
40
|
- `mutation`
|
52
41
|
- `subscription`
|
53
42
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# `no-scalar-result-type-on-mutation`
|
2
2
|
|
3
|
-
- Category: `
|
3
|
+
- Category: `Schema`
|
4
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)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# `no-typename-prefix`
|
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: `
|
5
|
+
- Category: `Schema`
|
6
6
|
- Rule name: `@graphql-eslint/no-typename-prefix`
|
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,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: `
|
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: `
|
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: `
|
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: `
|
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)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# `no-unused-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: `
|
5
|
+
- Category: `Operations`
|
6
6
|
- Rule name: `@graphql-eslint/no-unused-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,8 @@
|
|
1
1
|
# `one-field-subscriptions`
|
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: `
|
5
|
+
- Category: `Operations`
|
6
6
|
- Rule name: `@graphql-eslint/one-field-subscriptions`
|
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
|
# `overlapping-fields-can-be-merged`
|
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: `
|
5
|
+
- Category: `Operations`
|
6
6
|
- Rule name: `@graphql-eslint/overlapping-fields-can-be-merged`
|
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
|
# `possible-fragment-spread`
|
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: `
|
5
|
+
- Category: `Operations`
|
6
6
|
- Rule name: `@graphql-eslint/possible-fragment-spread`
|
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
|
# `possible-type-extension`
|
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: `
|
5
|
+
- Category: `Schema`
|
6
6
|
- Rule name: `@graphql-eslint/possible-type-extension`
|
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,8 +1,8 @@
|
|
1
1
|
# `provided-required-arguments`
|
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: `
|
5
|
+
- Category: `Schema & Operations`
|
6
6
|
- Rule name: `@graphql-eslint/provided-required-arguments`
|
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,6 @@
|
|
1
1
|
# `require-deprecation-date`
|
2
2
|
|
3
|
-
- Category: `
|
3
|
+
- Category: `Schema`
|
4
4
|
- Rule name: `@graphql-eslint/require-deprecation-date`
|
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)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# `require-deprecation-reason`
|
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: `
|
5
|
+
- Category: `Schema`
|
6
6
|
- Rule name: `@graphql-eslint/require-deprecation-reason`
|
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)
|