@graphql-eslint/eslint-plugin 3.0.0-alpha-069461d.0 → 3.0.0-alpha-698204a.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 +59 -91
- package/configs/operations-all.d.ts +19 -0
- package/configs/{recommended.d.ts → operations-recommended.d.ts} +11 -30
- package/configs/schema-all.d.ts +23 -0
- package/configs/schema-recommended.d.ts +44 -0
- package/docs/README.md +9 -17
- package/docs/deprecated-rules.md +21 -0
- package/docs/rules/alphabetize.md +1 -1
- package/docs/rules/description-style.md +4 -2
- 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 +26 -27
- 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 +7 -1
- 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 -7
- 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 +566 -599
- package/index.mjs +567 -600
- 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 +18 -8
- package/rules/input-name.d.ts +1 -1
- package/rules/match-document-filename.d.ts +8 -10
- package/rules/naming-convention.d.ts +1 -1
- package/rules/{avoid-duplicate-fields.d.ts → no-duplicate-fields.d.ts} +0 -0
- 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 +10 -6
- 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/utils.d.ts +1 -1
- package/configs/all.d.ts +0 -99
- 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,58 +1,21 @@
|
|
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
|
-
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
27
|
-
'@graphql-eslint/require-id-when-available': string;
|
28
|
-
'@graphql-eslint/selection-set-depth': string;
|
29
|
-
'@graphql-eslint/unique-fragment-name': string;
|
30
|
-
'@graphql-eslint/unique-operation-name': string;
|
31
|
-
'@graphql-eslint/avoid-typename-prefix': string;
|
32
|
-
'@graphql-eslint/executable-definitions': string;
|
33
|
-
'@graphql-eslint/fields-on-correct-type': string;
|
34
|
-
'@graphql-eslint/fragments-on-composite-type': string;
|
35
10
|
'@graphql-eslint/known-argument-names': string;
|
36
11
|
'@graphql-eslint/known-directives': string;
|
37
|
-
'@graphql-eslint/known-fragment-names': string;
|
38
12
|
'@graphql-eslint/known-type-names': string;
|
39
|
-
'@graphql-eslint/lone-anonymous-operation': string;
|
40
13
|
'@graphql-eslint/lone-schema-definition': string;
|
41
14
|
'@graphql-eslint/naming-convention': (string | {
|
42
15
|
types: string;
|
43
16
|
fields: string;
|
44
17
|
overrides: {
|
45
18
|
EnumValueDefinition: string;
|
46
|
-
OperationDefinition: {
|
47
|
-
style: string;
|
48
|
-
forbiddenPrefixes: string[];
|
49
|
-
forbiddenSuffixes: string[];
|
50
|
-
};
|
51
|
-
FragmentDefinition: {
|
52
|
-
style: string;
|
53
|
-
forbiddenPrefixes: string[];
|
54
|
-
forbiddenSuffixes: string[];
|
55
|
-
};
|
56
19
|
'FieldDefinition[parent.name.value=Query]': {
|
57
20
|
forbiddenPrefixes: string[];
|
58
21
|
forbiddenSuffixes: string[];
|
@@ -67,42 +30,47 @@ export declare const configs: {
|
|
67
30
|
};
|
68
31
|
};
|
69
32
|
})[];
|
70
|
-
'@graphql-eslint/no-anonymous-operations': string;
|
71
33
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
72
|
-
'@graphql-eslint/no-
|
73
|
-
'@graphql-eslint/no-
|
74
|
-
'@graphql-eslint/no-
|
75
|
-
'@graphql-eslint/no-unused-fragments': string;
|
76
|
-
'@graphql-eslint/no-unused-variables': string;
|
77
|
-
'@graphql-eslint/one-field-subscriptions': string;
|
78
|
-
'@graphql-eslint/overlapping-fields-can-be-merged': string;
|
79
|
-
'@graphql-eslint/possible-fragment-spread': string;
|
34
|
+
'@graphql-eslint/no-hashtag-description': string;
|
35
|
+
'@graphql-eslint/no-typename-prefix': string;
|
36
|
+
'@graphql-eslint/no-unreachable-types': string;
|
80
37
|
'@graphql-eslint/possible-type-extension': string;
|
81
38
|
'@graphql-eslint/provided-required-arguments': string;
|
82
39
|
'@graphql-eslint/require-deprecation-reason': string;
|
83
|
-
'@graphql-eslint/scalar-leafs': string;
|
84
40
|
'@graphql-eslint/strict-id-in-types': string;
|
85
|
-
'@graphql-eslint/unique-argument-names': string;
|
86
41
|
'@graphql-eslint/unique-directive-names': string;
|
87
42
|
'@graphql-eslint/unique-directive-names-per-location': string;
|
88
43
|
'@graphql-eslint/unique-enum-value-names': string;
|
89
44
|
'@graphql-eslint/unique-field-definition-names': string;
|
90
|
-
'@graphql-eslint/unique-input-field-names': string;
|
91
45
|
'@graphql-eslint/unique-operation-types': string;
|
92
46
|
'@graphql-eslint/unique-type-names': string;
|
93
|
-
'@graphql-eslint/unique-variable-names': string;
|
94
|
-
'@graphql-eslint/value-literals-of-correct-type': string;
|
95
|
-
'@graphql-eslint/variables-are-input-types': string;
|
96
|
-
'@graphql-eslint/variables-in-allowed-position': string;
|
97
47
|
};
|
98
|
-
parser: string;
|
99
|
-
plugins: string[];
|
100
48
|
};
|
101
|
-
|
102
|
-
|
103
|
-
|
49
|
+
'schema-all': {
|
50
|
+
extends: string[];
|
51
|
+
rules: {
|
52
|
+
'@graphql-eslint/alphabetize': (string | {
|
53
|
+
fields: string[];
|
54
|
+
values: string[];
|
55
|
+
arguments: string[];
|
56
|
+
})[];
|
57
|
+
'@graphql-eslint/input-name': string;
|
58
|
+
'@graphql-eslint/no-root-type': string;
|
59
|
+
'@graphql-eslint/no-scalar-result-type-on-mutation': string;
|
60
|
+
'@graphql-eslint/no-unused-fields': string;
|
61
|
+
'@graphql-eslint/require-deprecation-date': string;
|
62
|
+
'@graphql-eslint/require-description': (string | {
|
63
|
+
types: boolean;
|
64
|
+
overrides: {
|
65
|
+
DirectiveDefinition: boolean;
|
66
|
+
};
|
67
|
+
})[];
|
68
|
+
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
69
|
+
};
|
70
|
+
};
|
71
|
+
'operations-recommended': {
|
72
|
+
extends: string[];
|
104
73
|
rules: {
|
105
|
-
'@graphql-eslint/avoid-typename-prefix': string;
|
106
74
|
'@graphql-eslint/executable-definitions': string;
|
107
75
|
'@graphql-eslint/fields-on-correct-type': string;
|
108
76
|
'@graphql-eslint/fragments-on-composite-type': string;
|
@@ -111,12 +79,10 @@ export declare const configs: {
|
|
111
79
|
'@graphql-eslint/known-fragment-names': string;
|
112
80
|
'@graphql-eslint/known-type-names': string;
|
113
81
|
'@graphql-eslint/lone-anonymous-operation': string;
|
114
|
-
'@graphql-eslint/lone-schema-definition': string;
|
115
82
|
'@graphql-eslint/naming-convention': (string | {
|
116
|
-
types: string;
|
117
|
-
fields: string;
|
118
83
|
overrides: {
|
119
|
-
|
84
|
+
Argument: string;
|
85
|
+
VariableDefinition: string;
|
120
86
|
OperationDefinition: {
|
121
87
|
style: string;
|
122
88
|
forbiddenPrefixes: string[];
|
@@ -127,47 +93,49 @@ export declare const configs: {
|
|
127
93
|
forbiddenPrefixes: string[];
|
128
94
|
forbiddenSuffixes: string[];
|
129
95
|
};
|
130
|
-
'FieldDefinition[parent.name.value=Query]': {
|
131
|
-
forbiddenPrefixes: string[];
|
132
|
-
forbiddenSuffixes: string[];
|
133
|
-
};
|
134
|
-
'FieldDefinition[parent.name.value=Mutation]': {
|
135
|
-
forbiddenPrefixes: string[];
|
136
|
-
forbiddenSuffixes: string[];
|
137
|
-
};
|
138
|
-
'FieldDefinition[parent.name.value=Subscription]': {
|
139
|
-
forbiddenPrefixes: string[];
|
140
|
-
forbiddenSuffixes: string[];
|
141
|
-
};
|
142
96
|
};
|
143
97
|
})[];
|
144
98
|
'@graphql-eslint/no-anonymous-operations': string;
|
145
|
-
'@graphql-eslint/no-
|
99
|
+
'@graphql-eslint/no-deprecated': string;
|
100
|
+
'@graphql-eslint/no-duplicate-fields': string;
|
146
101
|
'@graphql-eslint/no-fragment-cycles': string;
|
147
|
-
'@graphql-eslint/no-operation-name-suffix': string;
|
148
102
|
'@graphql-eslint/no-undefined-variables': string;
|
149
103
|
'@graphql-eslint/no-unused-fragments': string;
|
150
104
|
'@graphql-eslint/no-unused-variables': string;
|
151
105
|
'@graphql-eslint/one-field-subscriptions': string;
|
152
106
|
'@graphql-eslint/overlapping-fields-can-be-merged': string;
|
153
107
|
'@graphql-eslint/possible-fragment-spread': string;
|
154
|
-
'@graphql-eslint/possible-type-extension': string;
|
155
108
|
'@graphql-eslint/provided-required-arguments': string;
|
156
|
-
'@graphql-eslint/require-
|
109
|
+
'@graphql-eslint/require-id-when-available': string;
|
157
110
|
'@graphql-eslint/scalar-leafs': string;
|
158
|
-
'@graphql-eslint/
|
111
|
+
'@graphql-eslint/selection-set-depth': (string | {
|
112
|
+
maxDepth: number;
|
113
|
+
})[];
|
159
114
|
'@graphql-eslint/unique-argument-names': string;
|
160
|
-
'@graphql-eslint/unique-directive-names': string;
|
161
115
|
'@graphql-eslint/unique-directive-names-per-location': string;
|
162
|
-
'@graphql-eslint/unique-enum-value-names': string;
|
163
|
-
'@graphql-eslint/unique-field-definition-names': string;
|
164
116
|
'@graphql-eslint/unique-input-field-names': string;
|
165
|
-
'@graphql-eslint/unique-operation-types': string;
|
166
|
-
'@graphql-eslint/unique-type-names': string;
|
167
117
|
'@graphql-eslint/unique-variable-names': string;
|
168
118
|
'@graphql-eslint/value-literals-of-correct-type': string;
|
169
119
|
'@graphql-eslint/variables-are-input-types': string;
|
170
120
|
'@graphql-eslint/variables-in-allowed-position': string;
|
171
121
|
};
|
172
122
|
};
|
123
|
+
'operations-all': {
|
124
|
+
extends: string[];
|
125
|
+
rules: {
|
126
|
+
'@graphql-eslint/alphabetize': (string | {
|
127
|
+
selections: string[];
|
128
|
+
variables: string[];
|
129
|
+
arguments: string[];
|
130
|
+
})[];
|
131
|
+
'@graphql-eslint/match-document-filename': (string | {
|
132
|
+
query: string;
|
133
|
+
mutation: string;
|
134
|
+
subscription: string;
|
135
|
+
fragment: string;
|
136
|
+
})[];
|
137
|
+
'@graphql-eslint/unique-fragment-name': string;
|
138
|
+
'@graphql-eslint/unique-operation-name': string;
|
139
|
+
};
|
140
|
+
};
|
173
141
|
};
|
@@ -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;
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
plugins: string[];
|
1
|
+
declare const _default: {
|
2
|
+
extends: string[];
|
4
3
|
rules: {
|
5
|
-
'@graphql-eslint/avoid-typename-prefix': string;
|
6
4
|
'@graphql-eslint/executable-definitions': string;
|
7
5
|
'@graphql-eslint/fields-on-correct-type': string;
|
8
6
|
'@graphql-eslint/fragments-on-composite-type': string;
|
@@ -11,12 +9,10 @@ export declare const recommendedConfig: {
|
|
11
9
|
'@graphql-eslint/known-fragment-names': string;
|
12
10
|
'@graphql-eslint/known-type-names': string;
|
13
11
|
'@graphql-eslint/lone-anonymous-operation': string;
|
14
|
-
'@graphql-eslint/lone-schema-definition': string;
|
15
12
|
'@graphql-eslint/naming-convention': (string | {
|
16
|
-
types: string;
|
17
|
-
fields: string;
|
18
13
|
overrides: {
|
19
|
-
|
14
|
+
Argument: string;
|
15
|
+
VariableDefinition: string;
|
20
16
|
OperationDefinition: {
|
21
17
|
style: string;
|
22
18
|
forbiddenPrefixes: string[];
|
@@ -27,46 +23,31 @@ export declare const recommendedConfig: {
|
|
27
23
|
forbiddenPrefixes: string[];
|
28
24
|
forbiddenSuffixes: string[];
|
29
25
|
};
|
30
|
-
'FieldDefinition[parent.name.value=Query]': {
|
31
|
-
forbiddenPrefixes: string[];
|
32
|
-
forbiddenSuffixes: string[];
|
33
|
-
};
|
34
|
-
'FieldDefinition[parent.name.value=Mutation]': {
|
35
|
-
forbiddenPrefixes: string[];
|
36
|
-
forbiddenSuffixes: string[];
|
37
|
-
};
|
38
|
-
'FieldDefinition[parent.name.value=Subscription]': {
|
39
|
-
forbiddenPrefixes: string[];
|
40
|
-
forbiddenSuffixes: string[];
|
41
|
-
};
|
42
26
|
};
|
43
27
|
})[];
|
44
28
|
'@graphql-eslint/no-anonymous-operations': string;
|
45
|
-
'@graphql-eslint/no-
|
29
|
+
'@graphql-eslint/no-deprecated': string;
|
30
|
+
'@graphql-eslint/no-duplicate-fields': string;
|
46
31
|
'@graphql-eslint/no-fragment-cycles': string;
|
47
|
-
'@graphql-eslint/no-operation-name-suffix': string;
|
48
32
|
'@graphql-eslint/no-undefined-variables': string;
|
49
33
|
'@graphql-eslint/no-unused-fragments': string;
|
50
34
|
'@graphql-eslint/no-unused-variables': string;
|
51
35
|
'@graphql-eslint/one-field-subscriptions': string;
|
52
36
|
'@graphql-eslint/overlapping-fields-can-be-merged': string;
|
53
37
|
'@graphql-eslint/possible-fragment-spread': string;
|
54
|
-
'@graphql-eslint/possible-type-extension': string;
|
55
38
|
'@graphql-eslint/provided-required-arguments': string;
|
56
|
-
'@graphql-eslint/require-
|
39
|
+
'@graphql-eslint/require-id-when-available': string;
|
57
40
|
'@graphql-eslint/scalar-leafs': string;
|
58
|
-
'@graphql-eslint/
|
41
|
+
'@graphql-eslint/selection-set-depth': (string | {
|
42
|
+
maxDepth: number;
|
43
|
+
})[];
|
59
44
|
'@graphql-eslint/unique-argument-names': string;
|
60
|
-
'@graphql-eslint/unique-directive-names': string;
|
61
45
|
'@graphql-eslint/unique-directive-names-per-location': string;
|
62
|
-
'@graphql-eslint/unique-enum-value-names': string;
|
63
|
-
'@graphql-eslint/unique-field-definition-names': string;
|
64
46
|
'@graphql-eslint/unique-input-field-names': string;
|
65
|
-
'@graphql-eslint/unique-operation-types': string;
|
66
|
-
'@graphql-eslint/unique-type-names': string;
|
67
47
|
'@graphql-eslint/unique-variable-names': string;
|
68
48
|
'@graphql-eslint/value-literals-of-correct-type': string;
|
69
49
|
'@graphql-eslint/variables-are-input-types': string;
|
70
50
|
'@graphql-eslint/variables-in-allowed-position': string;
|
71
51
|
};
|
72
52
|
};
|
53
|
+
export default _default;
|
@@ -0,0 +1,23 @@
|
|
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
|
+
overrides: {
|
17
|
+
DirectiveDefinition: boolean;
|
18
|
+
};
|
19
|
+
})[];
|
20
|
+
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
21
|
+
};
|
22
|
+
};
|
23
|
+
export default _default;
|
@@ -0,0 +1,44 @@
|
|
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
|
+
overrides: {
|
13
|
+
EnumValueDefinition: string;
|
14
|
+
'FieldDefinition[parent.name.value=Query]': {
|
15
|
+
forbiddenPrefixes: string[];
|
16
|
+
forbiddenSuffixes: string[];
|
17
|
+
};
|
18
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
19
|
+
forbiddenPrefixes: string[];
|
20
|
+
forbiddenSuffixes: string[];
|
21
|
+
};
|
22
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
23
|
+
forbiddenPrefixes: string[];
|
24
|
+
forbiddenSuffixes: string[];
|
25
|
+
};
|
26
|
+
};
|
27
|
+
})[];
|
28
|
+
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
29
|
+
'@graphql-eslint/no-hashtag-description': string;
|
30
|
+
'@graphql-eslint/no-typename-prefix': string;
|
31
|
+
'@graphql-eslint/no-unreachable-types': string;
|
32
|
+
'@graphql-eslint/possible-type-extension': string;
|
33
|
+
'@graphql-eslint/provided-required-arguments': string;
|
34
|
+
'@graphql-eslint/require-deprecation-reason': string;
|
35
|
+
'@graphql-eslint/strict-id-in-types': string;
|
36
|
+
'@graphql-eslint/unique-directive-names': string;
|
37
|
+
'@graphql-eslint/unique-directive-names-per-location': string;
|
38
|
+
'@graphql-eslint/unique-enum-value-names': string;
|
39
|
+
'@graphql-eslint/unique-field-definition-names': string;
|
40
|
+
'@graphql-eslint/unique-operation-types': string;
|
41
|
+
'@graphql-eslint/unique-type-names': string;
|
42
|
+
};
|
43
|
+
};
|
44
|
+
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-operation-name-suffix](rules/no-operation-name-suffix.md)|Makes sure you are not adding the operation type to the name of the operation.|🚀|🔧|✅
|
33
|
+
[no-hashtag-description](rules/no-hashtag-description.md)|Requires to use `"""` or `"` for adding a GraphQL description instead of `#`.|🚀||✅
|
38
34
|
[no-root-type](rules/no-root-type.md)|Disallow using root types for `read-only` or `write-only` schemas.|🚀||
|
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,7 +37,7 @@ 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
|
|
@@ -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)
|
@@ -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: `
|
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)
|