@graphql-eslint/eslint-plugin 3.0.0-alpha-0a66b90.0 → 3.0.0-alpha-2918431.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 +78 -121
- package/configs/operations-all.d.ts +19 -0
- package/configs/operations-recommended.d.ts +51 -0
- package/configs/schema-all.d.ts +21 -0
- package/configs/schema-recommended.d.ts +42 -0
- package/docs/README.md +10 -18
- package/docs/deprecated-rules.md +21 -0
- 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 +140 -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/{avoid-duplicate-fields.md → no-duplicate-fields.md} +10 -8
- 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 +9 -14
- package/docs/rules/{avoid-scalar-result-type-on-mutation.md → no-scalar-result-type-on-mutation.md} +7 -7
- package/docs/rules/no-typename-prefix.md +37 -0
- 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 +36 -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 +651 -724
- package/index.mjs +652 -725
- 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 +115 -119
- 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/{avoid-duplicate-fields.d.ts → no-duplicate-fields.d.ts} +0 -0
- package/rules/no-root-type.d.ts +1 -1
- package/rules/{avoid-scalar-result-type-on-mutation.d.ts → no-scalar-result-type-on-mutation.d.ts} +0 -0
- package/rules/{avoid-typename-prefix.d.ts → no-typename-prefix.d.ts} +0 -0
- 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 -104
- package/configs/recommended.d.ts +0 -72
- package/docs/rules/avoid-operation-name-prefix.md +0 -50
- package/docs/rules/avoid-typename-prefix.md +0 -37
- package/docs/rules/no-operation-name-suffix.md +0 -38
- package/rules/avoid-operation-name-prefix.d.ts +0 -9
- package/rules/no-operation-name-suffix.d.ts +0 -3
package/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
This project integrates GraphQL and ESLint, for a better developer experience.
|
2
2
|
|
3
|
-
<
|
4
|
-
<img height="150" src="./logo.png">
|
5
|
-
</p>
|
3
|
+
<img height="150" src="./logo.png">
|
6
4
|
|
7
5
|
[](https://badge.fury.io/js/%40graphql-eslint%2Feslint-plugin)
|
8
6
|
|
@@ -184,11 +182,20 @@ You can find a complete list of [all available rules here](docs/README.md).
|
|
184
182
|
|
185
183
|
## Available Configs
|
186
184
|
|
187
|
-
|
185
|
+
<!-- prettier-ignore-start -->
|
186
|
+
|Name|Description|
|
187
|
+
|:-:|-|
|
188
|
+
|[`schema-recommended`](packages/plugin/src/configs/schema-recommended.ts)|enables all recommended rules|
|
189
|
+
|[`operations-recommended`](packages/plugin/src/configs/operations-recommended.ts) |enables all recommended rules|
|
190
|
+
|[`schema-all`](packages/plugin/src/configs/schema-all.ts)|enables all rules (except for the rules that require `parserOptions.operations` option)|
|
191
|
+
|[`operations-all`](packages/plugin/src/configs/operations-all.ts)|enables all rules|
|
192
|
+
<!-- prettier-ignore-end -->
|
188
193
|
|
189
|
-
|
194
|
+
## Config usage
|
190
195
|
|
191
|
-
|
196
|
+
For example, to enable the `schema-recommended` config, enable it in your `.eslintrc` file with the `extends` option:
|
197
|
+
|
198
|
+
> All configs under the hood set `parser` as `@graphql-eslint/eslint-plugin` and add `@graphql-eslint` to `plugins` array, so you don't need to specify them.
|
192
199
|
|
193
200
|
```diff
|
194
201
|
{
|
@@ -201,7 +208,7 @@ Enable it in your `.eslintrc` file with the `extends` option.
|
|
201
208
|
"files": ["*.graphql"],
|
202
209
|
- "parser": "@graphql-eslint/eslint-plugin",
|
203
210
|
- "plugins": ["@graphql-eslint"],
|
204
|
-
+ "extends": "plugin:@graphql-eslint/recommended"
|
211
|
+
+ "extends": "plugin:@graphql-eslint/schema-recommended"
|
205
212
|
}
|
206
213
|
]
|
207
214
|
}
|
@@ -248,7 +255,11 @@ Please help to vote up if you want to speed up the progress.
|
|
248
255
|
|
249
256
|
## Further Reading
|
250
257
|
|
251
|
-
If you wish to learn more about this project, how the parser works, how to add custom rules and more
|
258
|
+
If you wish to learn more about this project, how the parser works, how to add custom rules and more please refer to the below links:
|
259
|
+
|
260
|
+
- [Writing Custom Rules](docs/custom-rules.md)
|
261
|
+
- [How the parser works?](docs/parser.md)
|
262
|
+
- [`parserOptions`](docs/parser-options.md)
|
252
263
|
|
253
264
|
## Contributions
|
254
265
|
|
package/configs/index.d.ts
CHANGED
@@ -1,113 +1,72 @@
|
|
1
1
|
export declare const configs: {
|
2
|
-
|
2
|
+
base: {
|
3
|
+
parser: string;
|
4
|
+
plugins: string[];
|
5
|
+
};
|
6
|
+
'schema-recommended': {
|
7
|
+
extends: string[];
|
3
8
|
rules: {
|
4
|
-
'@graphql-eslint/alphabetize': (string | {
|
5
|
-
fields: string[];
|
6
|
-
values: string[];
|
7
|
-
selections: string[];
|
8
|
-
variables: string[];
|
9
|
-
arguments: string[];
|
10
|
-
})[];
|
11
|
-
'@graphql-eslint/avoid-duplicate-fields': string;
|
12
|
-
'@graphql-eslint/avoid-operation-name-prefix': string;
|
13
|
-
'@graphql-eslint/avoid-scalar-result-type-on-mutation': string;
|
14
9
|
'@graphql-eslint/description-style': string;
|
15
|
-
'@graphql-eslint/input-name': string;
|
16
|
-
'@graphql-eslint/match-document-filename': string;
|
17
|
-
'@graphql-eslint/no-deprecated': string;
|
18
|
-
'@graphql-eslint/no-hashtag-description': string;
|
19
|
-
'@graphql-eslint/no-root-type': (string | {
|
20
|
-
disallow: string[];
|
21
|
-
})[];
|
22
|
-
'@graphql-eslint/no-unreachable-types': string;
|
23
|
-
'@graphql-eslint/no-unused-fields': string;
|
24
|
-
'@graphql-eslint/require-deprecation-date': string;
|
25
|
-
'@graphql-eslint/require-description': (string | {
|
26
|
-
types: boolean;
|
27
|
-
overrides: {
|
28
|
-
DirectiveDefinition: boolean;
|
29
|
-
};
|
30
|
-
})[];
|
31
|
-
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
32
|
-
'@graphql-eslint/require-id-when-available': string;
|
33
|
-
'@graphql-eslint/selection-set-depth': string;
|
34
|
-
'@graphql-eslint/unique-fragment-name': string;
|
35
|
-
'@graphql-eslint/unique-operation-name': string;
|
36
|
-
'@graphql-eslint/avoid-typename-prefix': string;
|
37
|
-
'@graphql-eslint/executable-definitions': string;
|
38
|
-
'@graphql-eslint/fields-on-correct-type': string;
|
39
|
-
'@graphql-eslint/fragments-on-composite-type': string;
|
40
10
|
'@graphql-eslint/known-argument-names': string;
|
41
11
|
'@graphql-eslint/known-directives': string;
|
42
|
-
'@graphql-eslint/known-fragment-names': string;
|
43
12
|
'@graphql-eslint/known-type-names': string;
|
44
|
-
'@graphql-eslint/lone-anonymous-operation': string;
|
45
13
|
'@graphql-eslint/lone-schema-definition': string;
|
46
14
|
'@graphql-eslint/naming-convention': (string | {
|
47
15
|
types: string;
|
48
16
|
fields: string;
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
'FieldDefinition[parent.name.value=Query]': {
|
62
|
-
forbiddenPrefixes: string[];
|
63
|
-
forbiddenSuffixes: string[];
|
64
|
-
};
|
65
|
-
'FieldDefinition[parent.name.value=Mutation]': {
|
66
|
-
forbiddenPrefixes: string[];
|
67
|
-
forbiddenSuffixes: string[];
|
68
|
-
};
|
69
|
-
'FieldDefinition[parent.name.value=Subscription]': {
|
70
|
-
forbiddenPrefixes: string[];
|
71
|
-
forbiddenSuffixes: string[];
|
72
|
-
};
|
17
|
+
EnumValueDefinition: string;
|
18
|
+
'FieldDefinition[parent.name.value=Query]': {
|
19
|
+
forbiddenPrefixes: string[];
|
20
|
+
forbiddenSuffixes: string[];
|
21
|
+
};
|
22
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
23
|
+
forbiddenPrefixes: string[];
|
24
|
+
forbiddenSuffixes: string[];
|
25
|
+
};
|
26
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
27
|
+
forbiddenPrefixes: string[];
|
28
|
+
forbiddenSuffixes: string[];
|
73
29
|
};
|
74
30
|
})[];
|
75
|
-
'@graphql-eslint/no-anonymous-operations': string;
|
76
31
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
77
|
-
'@graphql-eslint/no-
|
78
|
-
'@graphql-eslint/no-
|
79
|
-
'@graphql-eslint/no-
|
80
|
-
'@graphql-eslint/no-unused-fragments': string;
|
81
|
-
'@graphql-eslint/no-unused-variables': string;
|
82
|
-
'@graphql-eslint/one-field-subscriptions': string;
|
83
|
-
'@graphql-eslint/overlapping-fields-can-be-merged': string;
|
84
|
-
'@graphql-eslint/possible-fragment-spread': string;
|
32
|
+
'@graphql-eslint/no-hashtag-description': string;
|
33
|
+
'@graphql-eslint/no-typename-prefix': string;
|
34
|
+
'@graphql-eslint/no-unreachable-types': string;
|
85
35
|
'@graphql-eslint/possible-type-extension': string;
|
86
36
|
'@graphql-eslint/provided-required-arguments': string;
|
87
37
|
'@graphql-eslint/require-deprecation-reason': string;
|
88
|
-
'@graphql-eslint/scalar-leafs': string;
|
89
38
|
'@graphql-eslint/strict-id-in-types': string;
|
90
|
-
'@graphql-eslint/unique-argument-names': string;
|
91
39
|
'@graphql-eslint/unique-directive-names': string;
|
92
40
|
'@graphql-eslint/unique-directive-names-per-location': string;
|
93
41
|
'@graphql-eslint/unique-enum-value-names': string;
|
94
42
|
'@graphql-eslint/unique-field-definition-names': string;
|
95
|
-
'@graphql-eslint/unique-input-field-names': string;
|
96
43
|
'@graphql-eslint/unique-operation-types': string;
|
97
44
|
'@graphql-eslint/unique-type-names': string;
|
98
|
-
'@graphql-eslint/unique-variable-names': string;
|
99
|
-
'@graphql-eslint/value-literals-of-correct-type': string;
|
100
|
-
'@graphql-eslint/variables-are-input-types': string;
|
101
|
-
'@graphql-eslint/variables-in-allowed-position': string;
|
102
45
|
};
|
103
|
-
parser: string;
|
104
|
-
plugins: string[];
|
105
46
|
};
|
106
|
-
|
107
|
-
|
108
|
-
|
47
|
+
'schema-all': {
|
48
|
+
extends: string[];
|
49
|
+
rules: {
|
50
|
+
'@graphql-eslint/alphabetize': (string | {
|
51
|
+
fields: string[];
|
52
|
+
values: string[];
|
53
|
+
arguments: string[];
|
54
|
+
})[];
|
55
|
+
'@graphql-eslint/input-name': string;
|
56
|
+
'@graphql-eslint/no-root-type': string;
|
57
|
+
'@graphql-eslint/no-scalar-result-type-on-mutation': string;
|
58
|
+
'@graphql-eslint/no-unused-fields': string;
|
59
|
+
'@graphql-eslint/require-deprecation-date': string;
|
60
|
+
'@graphql-eslint/require-description': (string | {
|
61
|
+
types: boolean;
|
62
|
+
DirectiveDefinition: boolean;
|
63
|
+
})[];
|
64
|
+
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
65
|
+
};
|
66
|
+
};
|
67
|
+
'operations-recommended': {
|
68
|
+
extends: string[];
|
109
69
|
rules: {
|
110
|
-
'@graphql-eslint/avoid-typename-prefix': string;
|
111
70
|
'@graphql-eslint/executable-definitions': string;
|
112
71
|
'@graphql-eslint/fields-on-correct-type': string;
|
113
72
|
'@graphql-eslint/fragments-on-composite-type': string;
|
@@ -116,63 +75,61 @@ export declare const configs: {
|
|
116
75
|
'@graphql-eslint/known-fragment-names': string;
|
117
76
|
'@graphql-eslint/known-type-names': string;
|
118
77
|
'@graphql-eslint/lone-anonymous-operation': string;
|
119
|
-
'@graphql-eslint/lone-schema-definition': string;
|
120
78
|
'@graphql-eslint/naming-convention': (string | {
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
forbiddenPrefixes: string[];
|
133
|
-
forbiddenSuffixes: string[];
|
134
|
-
};
|
135
|
-
'FieldDefinition[parent.name.value=Query]': {
|
136
|
-
forbiddenPrefixes: string[];
|
137
|
-
forbiddenSuffixes: string[];
|
138
|
-
};
|
139
|
-
'FieldDefinition[parent.name.value=Mutation]': {
|
140
|
-
forbiddenPrefixes: string[];
|
141
|
-
forbiddenSuffixes: string[];
|
142
|
-
};
|
143
|
-
'FieldDefinition[parent.name.value=Subscription]': {
|
144
|
-
forbiddenPrefixes: string[];
|
145
|
-
forbiddenSuffixes: string[];
|
146
|
-
};
|
79
|
+
Argument: string;
|
80
|
+
VariableDefinition: string;
|
81
|
+
OperationDefinition: {
|
82
|
+
style: string;
|
83
|
+
forbiddenPrefixes: string[];
|
84
|
+
forbiddenSuffixes: string[];
|
85
|
+
};
|
86
|
+
FragmentDefinition: {
|
87
|
+
style: string;
|
88
|
+
forbiddenPrefixes: string[];
|
89
|
+
forbiddenSuffixes: string[];
|
147
90
|
};
|
148
91
|
})[];
|
149
92
|
'@graphql-eslint/no-anonymous-operations': string;
|
150
|
-
'@graphql-eslint/no-
|
93
|
+
'@graphql-eslint/no-deprecated': string;
|
94
|
+
'@graphql-eslint/no-duplicate-fields': string;
|
151
95
|
'@graphql-eslint/no-fragment-cycles': string;
|
152
|
-
'@graphql-eslint/no-operation-name-suffix': string;
|
153
96
|
'@graphql-eslint/no-undefined-variables': string;
|
154
97
|
'@graphql-eslint/no-unused-fragments': string;
|
155
98
|
'@graphql-eslint/no-unused-variables': string;
|
156
99
|
'@graphql-eslint/one-field-subscriptions': string;
|
157
100
|
'@graphql-eslint/overlapping-fields-can-be-merged': string;
|
158
101
|
'@graphql-eslint/possible-fragment-spread': string;
|
159
|
-
'@graphql-eslint/possible-type-extension': string;
|
160
102
|
'@graphql-eslint/provided-required-arguments': string;
|
161
|
-
'@graphql-eslint/require-
|
103
|
+
'@graphql-eslint/require-id-when-available': string;
|
162
104
|
'@graphql-eslint/scalar-leafs': string;
|
163
|
-
'@graphql-eslint/
|
105
|
+
'@graphql-eslint/selection-set-depth': (string | {
|
106
|
+
maxDepth: number;
|
107
|
+
})[];
|
164
108
|
'@graphql-eslint/unique-argument-names': string;
|
165
|
-
'@graphql-eslint/unique-directive-names': string;
|
166
109
|
'@graphql-eslint/unique-directive-names-per-location': string;
|
167
|
-
'@graphql-eslint/unique-enum-value-names': string;
|
168
|
-
'@graphql-eslint/unique-field-definition-names': string;
|
169
110
|
'@graphql-eslint/unique-input-field-names': string;
|
170
|
-
'@graphql-eslint/unique-operation-types': string;
|
171
|
-
'@graphql-eslint/unique-type-names': string;
|
172
111
|
'@graphql-eslint/unique-variable-names': string;
|
173
112
|
'@graphql-eslint/value-literals-of-correct-type': string;
|
174
113
|
'@graphql-eslint/variables-are-input-types': string;
|
175
114
|
'@graphql-eslint/variables-in-allowed-position': string;
|
176
115
|
};
|
177
116
|
};
|
117
|
+
'operations-all': {
|
118
|
+
extends: string[];
|
119
|
+
rules: {
|
120
|
+
'@graphql-eslint/alphabetize': (string | {
|
121
|
+
selections: string[];
|
122
|
+
variables: string[];
|
123
|
+
arguments: string[];
|
124
|
+
})[];
|
125
|
+
'@graphql-eslint/match-document-filename': (string | {
|
126
|
+
query: string;
|
127
|
+
mutation: string;
|
128
|
+
subscription: string;
|
129
|
+
fragment: string;
|
130
|
+
})[];
|
131
|
+
'@graphql-eslint/unique-fragment-name': string;
|
132
|
+
'@graphql-eslint/unique-operation-name': string;
|
133
|
+
};
|
134
|
+
};
|
178
135
|
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
extends: string[];
|
3
|
+
rules: {
|
4
|
+
'@graphql-eslint/alphabetize': (string | {
|
5
|
+
selections: string[];
|
6
|
+
variables: string[];
|
7
|
+
arguments: string[];
|
8
|
+
})[];
|
9
|
+
'@graphql-eslint/match-document-filename': (string | {
|
10
|
+
query: string;
|
11
|
+
mutation: string;
|
12
|
+
subscription: string;
|
13
|
+
fragment: string;
|
14
|
+
})[];
|
15
|
+
'@graphql-eslint/unique-fragment-name': string;
|
16
|
+
'@graphql-eslint/unique-operation-name': string;
|
17
|
+
};
|
18
|
+
};
|
19
|
+
export default _default;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
extends: string[];
|
3
|
+
rules: {
|
4
|
+
'@graphql-eslint/executable-definitions': string;
|
5
|
+
'@graphql-eslint/fields-on-correct-type': string;
|
6
|
+
'@graphql-eslint/fragments-on-composite-type': string;
|
7
|
+
'@graphql-eslint/known-argument-names': string;
|
8
|
+
'@graphql-eslint/known-directives': string;
|
9
|
+
'@graphql-eslint/known-fragment-names': string;
|
10
|
+
'@graphql-eslint/known-type-names': string;
|
11
|
+
'@graphql-eslint/lone-anonymous-operation': string;
|
12
|
+
'@graphql-eslint/naming-convention': (string | {
|
13
|
+
Argument: string;
|
14
|
+
VariableDefinition: string;
|
15
|
+
OperationDefinition: {
|
16
|
+
style: string;
|
17
|
+
forbiddenPrefixes: string[];
|
18
|
+
forbiddenSuffixes: string[];
|
19
|
+
};
|
20
|
+
FragmentDefinition: {
|
21
|
+
style: string;
|
22
|
+
forbiddenPrefixes: string[];
|
23
|
+
forbiddenSuffixes: string[];
|
24
|
+
};
|
25
|
+
})[];
|
26
|
+
'@graphql-eslint/no-anonymous-operations': string;
|
27
|
+
'@graphql-eslint/no-deprecated': string;
|
28
|
+
'@graphql-eslint/no-duplicate-fields': string;
|
29
|
+
'@graphql-eslint/no-fragment-cycles': string;
|
30
|
+
'@graphql-eslint/no-undefined-variables': string;
|
31
|
+
'@graphql-eslint/no-unused-fragments': string;
|
32
|
+
'@graphql-eslint/no-unused-variables': string;
|
33
|
+
'@graphql-eslint/one-field-subscriptions': string;
|
34
|
+
'@graphql-eslint/overlapping-fields-can-be-merged': string;
|
35
|
+
'@graphql-eslint/possible-fragment-spread': string;
|
36
|
+
'@graphql-eslint/provided-required-arguments': string;
|
37
|
+
'@graphql-eslint/require-id-when-available': string;
|
38
|
+
'@graphql-eslint/scalar-leafs': string;
|
39
|
+
'@graphql-eslint/selection-set-depth': (string | {
|
40
|
+
maxDepth: number;
|
41
|
+
})[];
|
42
|
+
'@graphql-eslint/unique-argument-names': string;
|
43
|
+
'@graphql-eslint/unique-directive-names-per-location': string;
|
44
|
+
'@graphql-eslint/unique-input-field-names': string;
|
45
|
+
'@graphql-eslint/unique-variable-names': string;
|
46
|
+
'@graphql-eslint/value-literals-of-correct-type': string;
|
47
|
+
'@graphql-eslint/variables-are-input-types': string;
|
48
|
+
'@graphql-eslint/variables-in-allowed-position': string;
|
49
|
+
};
|
50
|
+
};
|
51
|
+
export default _default;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
extends: string[];
|
3
|
+
rules: {
|
4
|
+
'@graphql-eslint/alphabetize': (string | {
|
5
|
+
fields: string[];
|
6
|
+
values: string[];
|
7
|
+
arguments: string[];
|
8
|
+
})[];
|
9
|
+
'@graphql-eslint/input-name': string;
|
10
|
+
'@graphql-eslint/no-root-type': string;
|
11
|
+
'@graphql-eslint/no-scalar-result-type-on-mutation': string;
|
12
|
+
'@graphql-eslint/no-unused-fields': string;
|
13
|
+
'@graphql-eslint/require-deprecation-date': string;
|
14
|
+
'@graphql-eslint/require-description': (string | {
|
15
|
+
types: boolean;
|
16
|
+
DirectiveDefinition: boolean;
|
17
|
+
})[];
|
18
|
+
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
19
|
+
};
|
20
|
+
};
|
21
|
+
export default _default;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
extends: string[];
|
3
|
+
rules: {
|
4
|
+
'@graphql-eslint/description-style': string;
|
5
|
+
'@graphql-eslint/known-argument-names': string;
|
6
|
+
'@graphql-eslint/known-directives': string;
|
7
|
+
'@graphql-eslint/known-type-names': string;
|
8
|
+
'@graphql-eslint/lone-schema-definition': string;
|
9
|
+
'@graphql-eslint/naming-convention': (string | {
|
10
|
+
types: string;
|
11
|
+
fields: string;
|
12
|
+
EnumValueDefinition: string;
|
13
|
+
'FieldDefinition[parent.name.value=Query]': {
|
14
|
+
forbiddenPrefixes: string[];
|
15
|
+
forbiddenSuffixes: string[];
|
16
|
+
};
|
17
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
18
|
+
forbiddenPrefixes: string[];
|
19
|
+
forbiddenSuffixes: string[];
|
20
|
+
};
|
21
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
22
|
+
forbiddenPrefixes: string[];
|
23
|
+
forbiddenSuffixes: string[];
|
24
|
+
};
|
25
|
+
})[];
|
26
|
+
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
27
|
+
'@graphql-eslint/no-hashtag-description': string;
|
28
|
+
'@graphql-eslint/no-typename-prefix': string;
|
29
|
+
'@graphql-eslint/no-unreachable-types': string;
|
30
|
+
'@graphql-eslint/possible-type-extension': string;
|
31
|
+
'@graphql-eslint/provided-required-arguments': string;
|
32
|
+
'@graphql-eslint/require-deprecation-reason': string;
|
33
|
+
'@graphql-eslint/strict-id-in-types': string;
|
34
|
+
'@graphql-eslint/unique-directive-names': string;
|
35
|
+
'@graphql-eslint/unique-directive-names-per-location': string;
|
36
|
+
'@graphql-eslint/unique-enum-value-names': string;
|
37
|
+
'@graphql-eslint/unique-field-definition-names': string;
|
38
|
+
'@graphql-eslint/unique-operation-types': string;
|
39
|
+
'@graphql-eslint/unique-type-names': string;
|
40
|
+
};
|
41
|
+
};
|
42
|
+
export default _default;
|
package/docs/README.md
CHANGED
@@ -12,11 +12,7 @@ Each rule has emojis denoting:
|
|
12
12
|
Name |Description|🚀 / 🔮|🔧|✅
|
13
13
|
-|-|:-:|-|-
|
14
14
|
[alphabetize](rules/alphabetize.md)|Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.|🚀||
|
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.|🚀||
|
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.|🚀||
|
18
|
-
[avoid-typename-prefix](rules/avoid-typename-prefix.md)|Enforces users to avoid using the type name in a field name while defining your schema.|🚀||✅
|
19
|
-
[description-style](rules/description-style.md)|Require all comments to follow the same style (either block or inline).|🚀||
|
15
|
+
[description-style](rules/description-style.md)|Require all comments to follow the same style (either block or inline).|🚀||✅
|
20
16
|
[executable-definitions](rules/executable-definitions.md)|A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.|🔮||✅
|
21
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`.|🔮||✅
|
22
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.|🔮||✅
|
@@ -31,13 +27,15 @@ Name &nbs
|
|
31
27
|
[naming-convention](rules/naming-convention.md)|Require names to follow specified conventions.|🚀||✅
|
32
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.|🚀||✅
|
33
29
|
[no-case-insensitive-enum-values-duplicates](rules/no-case-insensitive-enum-values-duplicates.md)|Disallow case-insensitive enum values duplicates.|🚀|🔧|✅
|
34
|
-
[no-deprecated](rules/no-deprecated.md)|Enforce that deprecated fields or enum values are not in use by operations
|
30
|
+
[no-deprecated](rules/no-deprecated.md)|Enforce that deprecated fields or enum values are not in use by operations.|🚀||✅
|
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.|🚀||✅
|
35
32
|
[no-fragment-cycles](rules/no-fragment-cycles.md)|A GraphQL fragment is only valid when it does not have cycles in fragments usage.|🔮||✅
|
36
|
-
[no-hashtag-description](rules/no-hashtag-description.md)|Requires to use `"""` or `"` for adding a GraphQL description instead of
|
37
|
-
[no-
|
38
|
-
[no-
|
33
|
+
[no-hashtag-description](rules/no-hashtag-description.md)|Requires to use `"""` or `"` for adding a GraphQL description instead of `#`.|🚀||✅
|
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.|🚀||
|
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.|🚀||✅
|
39
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.|🔮||✅
|
40
|
-
[no-unreachable-types](rules/no-unreachable-types.md)|Requires all types to be reachable at some level by root level fields
|
38
|
+
[no-unreachable-types](rules/no-unreachable-types.md)|Requires all types to be reachable at some level by root level fields.|🚀|🔧|✅
|
41
39
|
[no-unused-fields](rules/no-unused-fields.md)|Requires all fields to be used at some level by siblings operations.|🚀|🔧|
|
42
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.|🔮||✅
|
43
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.|🔮||✅
|
@@ -50,9 +48,9 @@ Name &nbs
|
|
50
48
|
[require-deprecation-reason](rules/require-deprecation-reason.md)|Require all deprecation directives to specify a reason.|🚀||✅
|
51
49
|
[require-description](rules/require-description.md)|Enforce descriptions in your type definitions.|🚀||
|
52
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.|🚀||
|
53
|
-
[require-id-when-available](rules/require-id-when-available.md)|Enforce selecting specific fields when they are available on the GraphQL type
|
51
|
+
[require-id-when-available](rules/require-id-when-available.md)|Enforce selecting specific fields when they are available on the GraphQL type.|🚀||✅
|
54
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.|🔮||✅
|
55
|
-
[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)
|
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).|🚀||✅
|
56
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.|🚀||✅
|
57
55
|
[unique-argument-names](rules/unique-argument-names.md)|A GraphQL field or directive is only valid if all supplied arguments are uniquely named.|🔮||✅
|
58
56
|
[unique-directive-names](rules/unique-directive-names.md)|A GraphQL document is only valid if all defined directives have unique names.|🔮||✅
|
@@ -69,9 +67,3 @@ Name &nbs
|
|
69
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).|🔮||✅
|
70
68
|
[variables-in-allowed-position](rules/variables-in-allowed-position.md)|Variables passed to field arguments conform to type.|🔮||✅
|
71
69
|
<!-- prettier-ignore-end -->
|
72
|
-
|
73
|
-
## Further Reading
|
74
|
-
|
75
|
-
- [Writing Custom Rules](custom-rules.md)
|
76
|
-
- [How the parser works?](parser.md)
|
77
|
-
- [`parserOptions`](parser-options.md)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Deprecated Rules
|
2
|
+
|
3
|
+
## avoid-duplicate-fields
|
4
|
+
|
5
|
+
This rule was renamed to [`no-duplicate-fields`](rules/no-duplicate-fields.md).
|
6
|
+
|
7
|
+
## avoid-scalar-result-type-on-mutation
|
8
|
+
|
9
|
+
This rule was renamed to [`no-scalar-result-type-on-mutation`](rules/no-scalar-result-type-on-mutation.md).
|
10
|
+
|
11
|
+
## avoid-typename-prefix
|
12
|
+
|
13
|
+
This rule was renamed to [`no-typename-prefix`](rules/no-typename-prefix.md).
|
14
|
+
|
15
|
+
## avoid-operation-name-prefix
|
16
|
+
|
17
|
+
This rule was removed because the same things can be validated using [`naming-convention`](rules/naming-convention.md).
|
18
|
+
|
19
|
+
## no-operation-name-suffix
|
20
|
+
|
21
|
+
This rule was removed because the same things can be validated using [`naming-convention`](rules/naming-convention.md).
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# `alphabetize`
|
2
2
|
|
3
|
-
- Category: `
|
3
|
+
- Category: `Schema & Operations`
|
4
4
|
- Rule name: `@graphql-eslint/alphabetize`
|
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,6 +1,8 @@
|
|
1
1
|
# `description-style`
|
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/description-style`
|
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)
|
@@ -35,14 +37,14 @@ type someTypeName {
|
|
35
37
|
|
36
38
|
The schema defines the following properties:
|
37
39
|
|
38
|
-
### `style` (
|
40
|
+
### `style` (enum)
|
39
41
|
|
40
42
|
This element must be one of the following enum values:
|
41
43
|
|
42
44
|
- `block`
|
43
45
|
- `inline`
|
44
46
|
|
45
|
-
Default: `"
|
47
|
+
Default: `"block"`
|
46
48
|
|
47
49
|
## Resources
|
48
50
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# `executable-definitions`
|
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/executable-definitions`
|
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
|
# `fields-on-correct-type`
|
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/fields-on-correct-type`
|
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
|
# `fragments-on-composite-type`
|
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/fragments-on-composite-type`
|
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)
|
package/docs/rules/input-name.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# `input-name`
|
2
2
|
|
3
|
-
- Category: `
|
3
|
+
- Category: `Schema`
|
4
4
|
- Rule name: `@graphql-eslint/input-name`
|
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
|
# `known-argument-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: `
|
5
|
+
- Category: `Schema & Operations`
|
6
6
|
- Rule name: `@graphql-eslint/known-argument-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)
|