@graphql-eslint/eslint-plugin 3.0.0-alpha-7462f3d.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 +58 -92
- package/configs/operations-all.d.ts +19 -0
- package/configs/{recommended.d.ts → operations-recommended.d.ts} +11 -29
- package/configs/schema-all.d.ts +23 -0
- package/configs/schema-recommended.d.ts +44 -0
- package/docs/README.md +7 -13
- 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 +2 -3
- 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 +1 -1
- 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 +1 -1
- 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 +246 -136
- package/index.mjs +246 -136
- 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 +2 -2
- 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/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/index.js
CHANGED
@@ -18,21 +18,21 @@ const codeFileLoader = require('@graphql-tools/code-file-loader');
|
|
18
18
|
const eslint = require('eslint');
|
19
19
|
const codeFrame = require('@babel/code-frame');
|
20
20
|
|
21
|
+
const base = {
|
22
|
+
parser: '@graphql-eslint/eslint-plugin',
|
23
|
+
plugins: ['@graphql-eslint'],
|
24
|
+
};
|
25
|
+
|
21
26
|
/*
|
22
27
|
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
|
23
28
|
*/
|
24
|
-
const
|
25
|
-
|
26
|
-
plugins: ['@graphql-eslint'],
|
29
|
+
const schemaRecommendedConfig = {
|
30
|
+
extends: ['plugin:@graphql-eslint/base'],
|
27
31
|
rules: {
|
28
|
-
'@graphql-eslint/
|
29
|
-
'@graphql-eslint/fields-on-correct-type': 'error',
|
30
|
-
'@graphql-eslint/fragments-on-composite-type': 'error',
|
32
|
+
'@graphql-eslint/description-style': 'error',
|
31
33
|
'@graphql-eslint/known-argument-names': 'error',
|
32
34
|
'@graphql-eslint/known-directives': 'error',
|
33
|
-
'@graphql-eslint/known-fragment-names': 'error',
|
34
35
|
'@graphql-eslint/known-type-names': 'error',
|
35
|
-
'@graphql-eslint/lone-anonymous-operation': 'error',
|
36
36
|
'@graphql-eslint/lone-schema-definition': 'error',
|
37
37
|
'@graphql-eslint/naming-convention': [
|
38
38
|
'error',
|
@@ -41,12 +41,6 @@ const recommendedConfig = {
|
|
41
41
|
fields: 'camelCase',
|
42
42
|
overrides: {
|
43
43
|
EnumValueDefinition: 'UPPER_CASE',
|
44
|
-
OperationDefinition: {
|
45
|
-
style: 'PascalCase',
|
46
|
-
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
|
47
|
-
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'],
|
48
|
-
},
|
49
|
-
FragmentDefinition: { style: 'PascalCase', forbiddenPrefixes: ['Fragment'], forbiddenSuffixes: ['Fragment'] },
|
50
44
|
'FieldDefinition[parent.name.value=Query]': {
|
51
45
|
forbiddenPrefixes: ['query', 'get'],
|
52
46
|
forbiddenSuffixes: ['Query'],
|
@@ -62,76 +56,129 @@ const recommendedConfig = {
|
|
62
56
|
},
|
63
57
|
},
|
64
58
|
],
|
65
|
-
'@graphql-eslint/no-anonymous-operations': 'error',
|
66
59
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': 'error',
|
67
|
-
'@graphql-eslint/no-
|
60
|
+
'@graphql-eslint/no-hashtag-description': 'error',
|
68
61
|
'@graphql-eslint/no-typename-prefix': 'error',
|
69
|
-
'@graphql-eslint/no-
|
70
|
-
'@graphql-eslint/no-unused-fragments': 'error',
|
71
|
-
'@graphql-eslint/no-unused-variables': 'error',
|
72
|
-
'@graphql-eslint/one-field-subscriptions': 'error',
|
73
|
-
'@graphql-eslint/overlapping-fields-can-be-merged': 'error',
|
74
|
-
'@graphql-eslint/possible-fragment-spread': 'error',
|
62
|
+
'@graphql-eslint/no-unreachable-types': 'error',
|
75
63
|
'@graphql-eslint/possible-type-extension': 'error',
|
76
64
|
'@graphql-eslint/provided-required-arguments': 'error',
|
77
65
|
'@graphql-eslint/require-deprecation-reason': 'error',
|
78
|
-
'@graphql-eslint/scalar-leafs': 'error',
|
79
66
|
'@graphql-eslint/strict-id-in-types': 'error',
|
80
|
-
'@graphql-eslint/unique-argument-names': 'error',
|
81
67
|
'@graphql-eslint/unique-directive-names': 'error',
|
82
68
|
'@graphql-eslint/unique-directive-names-per-location': 'error',
|
83
69
|
'@graphql-eslint/unique-enum-value-names': 'error',
|
84
70
|
'@graphql-eslint/unique-field-definition-names': 'error',
|
85
|
-
'@graphql-eslint/unique-input-field-names': 'error',
|
86
71
|
'@graphql-eslint/unique-operation-types': 'error',
|
87
72
|
'@graphql-eslint/unique-type-names': 'error',
|
88
|
-
'@graphql-eslint/unique-variable-names': 'error',
|
89
|
-
'@graphql-eslint/value-literals-of-correct-type': 'error',
|
90
|
-
'@graphql-eslint/variables-are-input-types': 'error',
|
91
|
-
'@graphql-eslint/variables-in-allowed-position': 'error',
|
92
73
|
},
|
93
74
|
};
|
94
75
|
|
95
76
|
/*
|
96
77
|
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
|
97
78
|
*/
|
98
|
-
const
|
99
|
-
|
79
|
+
const schemaAllConfig = {
|
80
|
+
extends: ['plugin:@graphql-eslint/base', 'plugin:@graphql-eslint/schema-recommended'],
|
100
81
|
rules: {
|
101
|
-
...recommendedConfig.rules,
|
102
82
|
'@graphql-eslint/alphabetize': [
|
103
83
|
'error',
|
104
84
|
{
|
105
85
|
fields: ['ObjectTypeDefinition', 'InterfaceTypeDefinition', 'InputObjectTypeDefinition'],
|
106
86
|
values: ['EnumTypeDefinition'],
|
107
|
-
selections: ['OperationDefinition', 'FragmentDefinition'],
|
108
|
-
variables: ['OperationDefinition'],
|
109
87
|
arguments: ['FieldDefinition', 'Field', 'DirectiveDefinition', 'Directive'],
|
110
88
|
},
|
111
89
|
],
|
112
|
-
'@graphql-eslint/description-style': 'error',
|
113
90
|
'@graphql-eslint/input-name': 'error',
|
114
|
-
'@graphql-eslint/
|
115
|
-
'@graphql-eslint/no-deprecated': 'error',
|
116
|
-
'@graphql-eslint/no-duplicate-fields': 'error',
|
117
|
-
'@graphql-eslint/no-hashtag-description': 'error',
|
118
|
-
'@graphql-eslint/no-root-type': ['error', { disallow: ['subscription'] }],
|
91
|
+
'@graphql-eslint/no-root-type': 'off',
|
119
92
|
'@graphql-eslint/no-scalar-result-type-on-mutation': 'error',
|
120
|
-
'@graphql-eslint/no-
|
121
|
-
'@graphql-eslint/no-unused-fields': 'error',
|
93
|
+
'@graphql-eslint/no-unused-fields': 'off',
|
122
94
|
'@graphql-eslint/require-deprecation-date': 'error',
|
123
95
|
'@graphql-eslint/require-description': ['error', { types: true, overrides: { DirectiveDefinition: true } }],
|
124
96
|
'@graphql-eslint/require-field-of-type-query-in-mutation-result': 'error',
|
97
|
+
},
|
98
|
+
};
|
99
|
+
|
100
|
+
/*
|
101
|
+
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
|
102
|
+
*/
|
103
|
+
const operationsRecommendedConfig = {
|
104
|
+
extends: ['plugin:@graphql-eslint/base'],
|
105
|
+
rules: {
|
106
|
+
'@graphql-eslint/executable-definitions': 'error',
|
107
|
+
'@graphql-eslint/fields-on-correct-type': 'error',
|
108
|
+
'@graphql-eslint/fragments-on-composite-type': 'error',
|
109
|
+
'@graphql-eslint/known-argument-names': 'error',
|
110
|
+
'@graphql-eslint/known-directives': 'error',
|
111
|
+
'@graphql-eslint/known-fragment-names': 'error',
|
112
|
+
'@graphql-eslint/known-type-names': 'error',
|
113
|
+
'@graphql-eslint/lone-anonymous-operation': 'error',
|
114
|
+
'@graphql-eslint/naming-convention': [
|
115
|
+
'error',
|
116
|
+
{
|
117
|
+
overrides: {
|
118
|
+
Argument: 'camelCase',
|
119
|
+
VariableDefinition: 'camelCase',
|
120
|
+
OperationDefinition: {
|
121
|
+
style: 'PascalCase',
|
122
|
+
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
|
123
|
+
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'],
|
124
|
+
},
|
125
|
+
FragmentDefinition: { style: 'PascalCase', forbiddenPrefixes: ['Fragment'], forbiddenSuffixes: ['Fragment'] },
|
126
|
+
},
|
127
|
+
},
|
128
|
+
],
|
129
|
+
'@graphql-eslint/no-anonymous-operations': 'error',
|
130
|
+
'@graphql-eslint/no-deprecated': 'error',
|
131
|
+
'@graphql-eslint/no-duplicate-fields': 'error',
|
132
|
+
'@graphql-eslint/no-fragment-cycles': 'error',
|
133
|
+
'@graphql-eslint/no-undefined-variables': 'error',
|
134
|
+
'@graphql-eslint/no-unused-fragments': 'error',
|
135
|
+
'@graphql-eslint/no-unused-variables': 'error',
|
136
|
+
'@graphql-eslint/one-field-subscriptions': 'error',
|
137
|
+
'@graphql-eslint/overlapping-fields-can-be-merged': 'error',
|
138
|
+
'@graphql-eslint/possible-fragment-spread': 'error',
|
139
|
+
'@graphql-eslint/provided-required-arguments': 'error',
|
125
140
|
'@graphql-eslint/require-id-when-available': 'error',
|
126
|
-
'@graphql-eslint/
|
141
|
+
'@graphql-eslint/scalar-leafs': 'error',
|
142
|
+
'@graphql-eslint/selection-set-depth': ['error', { maxDepth: 7 }],
|
143
|
+
'@graphql-eslint/unique-argument-names': 'error',
|
144
|
+
'@graphql-eslint/unique-directive-names-per-location': 'error',
|
145
|
+
'@graphql-eslint/unique-input-field-names': 'error',
|
146
|
+
'@graphql-eslint/unique-variable-names': 'error',
|
147
|
+
'@graphql-eslint/value-literals-of-correct-type': 'error',
|
148
|
+
'@graphql-eslint/variables-are-input-types': 'error',
|
149
|
+
'@graphql-eslint/variables-in-allowed-position': 'error',
|
150
|
+
},
|
151
|
+
};
|
152
|
+
|
153
|
+
/*
|
154
|
+
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
|
155
|
+
*/
|
156
|
+
const operationsAllConfig = {
|
157
|
+
extends: ['plugin:@graphql-eslint/base', 'plugin:@graphql-eslint/operations-recommended'],
|
158
|
+
rules: {
|
159
|
+
'@graphql-eslint/alphabetize': [
|
160
|
+
'error',
|
161
|
+
{
|
162
|
+
selections: ['OperationDefinition', 'FragmentDefinition'],
|
163
|
+
variables: ['OperationDefinition'],
|
164
|
+
arguments: ['Field', 'Directive'],
|
165
|
+
},
|
166
|
+
],
|
167
|
+
'@graphql-eslint/match-document-filename': [
|
168
|
+
'error',
|
169
|
+
{ query: 'kebab-case', mutation: 'kebab-case', subscription: 'kebab-case', fragment: 'kebab-case' },
|
170
|
+
],
|
127
171
|
'@graphql-eslint/unique-fragment-name': 'error',
|
128
172
|
'@graphql-eslint/unique-operation-name': 'error',
|
129
173
|
},
|
130
174
|
};
|
131
175
|
|
132
176
|
const configs = {
|
133
|
-
|
134
|
-
recommended:
|
177
|
+
base,
|
178
|
+
'schema-recommended': schemaRecommendedConfig,
|
179
|
+
'schema-all': schemaAllConfig,
|
180
|
+
'operations-recommended': operationsRecommendedConfig,
|
181
|
+
'operations-all': operationsAllConfig,
|
135
182
|
};
|
136
183
|
|
137
184
|
function requireSiblingsOperations(ruleName, context) {
|
@@ -344,7 +391,6 @@ const validationToRule = (name, ruleName, docs, getDocumentNode) => {
|
|
344
391
|
docs: {
|
345
392
|
...docs,
|
346
393
|
graphQLJSRuleName: ruleName,
|
347
|
-
category: 'Validation',
|
348
394
|
recommended: true,
|
349
395
|
requiresSchema,
|
350
396
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${name}.md`,
|
@@ -381,16 +427,22 @@ const importFiles = (context) => {
|
|
381
427
|
return _import.processImport(context.getFilename());
|
382
428
|
};
|
383
429
|
const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-definitions', 'ExecutableDefinitions', {
|
430
|
+
category: 'Operations',
|
384
431
|
description: `A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.`,
|
385
432
|
}), validationToRule('fields-on-correct-type', 'FieldsOnCorrectType', {
|
433
|
+
category: 'Operations',
|
386
434
|
description: '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`.',
|
387
435
|
}), validationToRule('fragments-on-composite-type', 'FragmentsOnCompositeTypes', {
|
436
|
+
category: 'Operations',
|
388
437
|
description: `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.`,
|
389
438
|
}), validationToRule('known-argument-names', 'KnownArgumentNames', {
|
439
|
+
category: ['Schema', 'Operations'],
|
390
440
|
description: `A GraphQL field is only valid if all supplied arguments are defined by that field.`,
|
391
441
|
}), validationToRule('known-directives', 'KnownDirectives', {
|
442
|
+
category: ['Schema', 'Operations'],
|
392
443
|
description: `A GraphQL document is only valid if all \`@directives\` are known by the schema and legally positioned.`,
|
393
444
|
}), validationToRule('known-fragment-names', 'KnownFragmentNames', {
|
445
|
+
category: 'Operations',
|
394
446
|
description: `A GraphQL document is only valid if all \`...Fragment\` fragment spreads refer to fragments defined in the same document.`,
|
395
447
|
examples: [
|
396
448
|
{
|
@@ -457,17 +509,23 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
457
509
|
},
|
458
510
|
],
|
459
511
|
}, importFiles), validationToRule('known-type-names', 'KnownTypeNames', {
|
512
|
+
category: ['Schema', 'Operations'],
|
460
513
|
description: `A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.`,
|
461
514
|
}), validationToRule('lone-anonymous-operation', 'LoneAnonymousOperation', {
|
515
|
+
category: 'Operations',
|
462
516
|
description: `A GraphQL document is only valid if when it contains an anonymous operation (the query short-hand) that it contains only that one operation definition.`,
|
463
517
|
}), validationToRule('lone-schema-definition', 'LoneSchemaDefinition', {
|
518
|
+
category: 'Schema',
|
464
519
|
description: `A GraphQL document is only valid if it contains only one schema definition.`,
|
465
520
|
requiresSchema: false,
|
466
521
|
}), validationToRule('no-fragment-cycles', 'NoFragmentCycles', {
|
522
|
+
category: 'Operations',
|
467
523
|
description: `A GraphQL fragment is only valid when it does not have cycles in fragments usage.`,
|
468
524
|
}), validationToRule('no-undefined-variables', 'NoUndefinedVariables', {
|
525
|
+
category: 'Operations',
|
469
526
|
description: `A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.`,
|
470
527
|
}, importFiles), validationToRule('no-unused-fragments', 'NoUnusedFragments', {
|
528
|
+
category: 'Operations',
|
471
529
|
description: `A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.`,
|
472
530
|
requiresSiblings: true,
|
473
531
|
}, context => {
|
@@ -497,49 +555,68 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
497
555
|
};
|
498
556
|
return getParentNode(context.getFilename());
|
499
557
|
}), validationToRule('no-unused-variables', 'NoUnusedVariables', {
|
558
|
+
category: 'Operations',
|
500
559
|
description: `A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.`,
|
501
560
|
}, importFiles), validationToRule('overlapping-fields-can-be-merged', 'OverlappingFieldsCanBeMerged', {
|
561
|
+
category: 'Operations',
|
502
562
|
description: `A selection set is only valid if all fields (including spreading any fragments) either correspond to distinct response names or can be merged without ambiguity.`,
|
503
563
|
}), validationToRule('possible-fragment-spread', 'PossibleFragmentSpreads', {
|
564
|
+
category: 'Operations',
|
504
565
|
description: `A fragment spread is only valid if the type condition could ever possibly be true: if there is a non-empty intersection of the possible parent types, and possible types which pass the type condition.`,
|
505
566
|
}), validationToRule('possible-type-extension', 'PossibleTypeExtensions', {
|
567
|
+
category: 'Schema',
|
506
568
|
description: `A type extension is only valid if the type is defined and has the same kind.`,
|
507
569
|
requiresSchema: false,
|
508
570
|
}), validationToRule('provided-required-arguments', 'ProvidedRequiredArguments', {
|
571
|
+
category: ['Schema', 'Operations'],
|
509
572
|
description: `A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.`,
|
510
573
|
}), validationToRule('scalar-leafs', 'ScalarLeafs', {
|
574
|
+
category: 'Operations',
|
511
575
|
description: `A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.`,
|
512
576
|
}), validationToRule('one-field-subscriptions', 'SingleFieldSubscriptions', {
|
577
|
+
category: 'Operations',
|
513
578
|
description: `A GraphQL subscription is valid only if it contains a single root field.`,
|
514
579
|
}), validationToRule('unique-argument-names', 'UniqueArgumentNames', {
|
580
|
+
category: 'Operations',
|
515
581
|
description: `A GraphQL field or directive is only valid if all supplied arguments are uniquely named.`,
|
516
582
|
}), validationToRule('unique-directive-names', 'UniqueDirectiveNames', {
|
583
|
+
category: 'Schema',
|
517
584
|
description: `A GraphQL document is only valid if all defined directives have unique names.`,
|
518
585
|
requiresSchema: false,
|
519
586
|
}), validationToRule('unique-directive-names-per-location', 'UniqueDirectivesPerLocation', {
|
587
|
+
category: ['Schema', 'Operations'],
|
520
588
|
description: `A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.`,
|
521
589
|
}), validationToRule('unique-enum-value-names', 'UniqueEnumValueNames', {
|
590
|
+
category: 'Schema',
|
522
591
|
description: `A GraphQL enum type is only valid if all its values are uniquely named.`,
|
523
592
|
requiresSchema: false,
|
524
593
|
}), validationToRule('unique-field-definition-names', 'UniqueFieldDefinitionNames', {
|
594
|
+
category: 'Schema',
|
525
595
|
description: `A GraphQL complex type is only valid if all its fields are uniquely named.`,
|
526
596
|
requiresSchema: false,
|
527
597
|
}), validationToRule('unique-input-field-names', 'UniqueInputFieldNames', {
|
598
|
+
category: 'Operations',
|
528
599
|
description: `A GraphQL input object value is only valid if all supplied fields are uniquely named.`,
|
529
600
|
requiresSchema: false,
|
530
601
|
}), validationToRule('unique-operation-types', 'UniqueOperationTypes', {
|
602
|
+
category: 'Schema',
|
531
603
|
description: `A GraphQL document is only valid if it has only one type per operation.`,
|
532
604
|
requiresSchema: false,
|
533
605
|
}), validationToRule('unique-type-names', 'UniqueTypeNames', {
|
606
|
+
category: 'Schema',
|
534
607
|
description: `A GraphQL document is only valid if all defined types have unique names.`,
|
535
608
|
requiresSchema: false,
|
536
609
|
}), validationToRule('unique-variable-names', 'UniqueVariableNames', {
|
610
|
+
category: 'Operations',
|
537
611
|
description: `A GraphQL operation is only valid if all its variables are uniquely named.`,
|
538
612
|
}), validationToRule('value-literals-of-correct-type', 'ValuesOfCorrectType', {
|
613
|
+
category: 'Operations',
|
539
614
|
description: `A GraphQL document is only valid if all value literals are of the type expected at their position.`,
|
540
615
|
}), validationToRule('variables-are-input-types', 'VariablesAreInputTypes', {
|
616
|
+
category: 'Operations',
|
541
617
|
description: `A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).`,
|
542
618
|
}), validationToRule('variables-in-allowed-position', 'VariablesInAllowedPosition', {
|
619
|
+
category: 'Operations',
|
543
620
|
description: `Variables passed to field arguments conform to type.`,
|
544
621
|
}));
|
545
622
|
|
@@ -565,7 +642,7 @@ const rule = {
|
|
565
642
|
meta: {
|
566
643
|
type: 'suggestion',
|
567
644
|
docs: {
|
568
|
-
category: '
|
645
|
+
category: ['Schema', 'Operations'],
|
569
646
|
description: 'Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.',
|
570
647
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/alphabetize.md',
|
571
648
|
examples: [
|
@@ -644,15 +721,22 @@ const rule = {
|
|
644
721
|
`,
|
645
722
|
},
|
646
723
|
],
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
724
|
+
configOptions: {
|
725
|
+
schema: [
|
726
|
+
{
|
727
|
+
fields: fieldsEnum,
|
728
|
+
values: valuesEnum,
|
729
|
+
arguments: argumentsEnum,
|
730
|
+
},
|
731
|
+
],
|
732
|
+
operations: [
|
733
|
+
{
|
734
|
+
selections: selectionsEnum,
|
735
|
+
variables: variablesEnum,
|
736
|
+
arguments: [graphql.Kind.FIELD, graphql.Kind.DIRECTIVE],
|
737
|
+
},
|
738
|
+
],
|
739
|
+
},
|
656
740
|
},
|
657
741
|
messages: {
|
658
742
|
[ALPHABETIZE]: '"{{ currName }}" should be before "{{ prevName }}"',
|
@@ -817,20 +901,20 @@ const rule$1 = {
|
|
817
901
|
},
|
818
902
|
],
|
819
903
|
description: 'Require all comments to follow the same style (either block or inline).',
|
820
|
-
category: '
|
904
|
+
category: 'Schema',
|
821
905
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/description-style.md',
|
906
|
+
recommended: true,
|
822
907
|
},
|
823
908
|
schema: [
|
824
909
|
{
|
825
910
|
type: 'object',
|
911
|
+
additionalProperties: false,
|
826
912
|
properties: {
|
827
913
|
style: {
|
828
|
-
type: 'string',
|
829
914
|
enum: ['block', 'inline'],
|
830
915
|
default: 'inline',
|
831
916
|
},
|
832
917
|
},
|
833
|
-
additionalProperties: false,
|
834
918
|
},
|
835
919
|
],
|
836
920
|
},
|
@@ -858,7 +942,7 @@ const rule$2 = {
|
|
858
942
|
type: 'suggestion',
|
859
943
|
docs: {
|
860
944
|
description: 'Require mutation argument to be always called "input" and input type to be called Mutation name + "Input".\nUsing the same name for all input parameters will make your schemas easier to consume and more predictable. Using the same name as mutation for InputType will make it easier to find mutations that InputType belongs to.',
|
861
|
-
category: '
|
945
|
+
category: 'Schema',
|
862
946
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/input-name.md',
|
863
947
|
examples: [
|
864
948
|
{
|
@@ -983,7 +1067,7 @@ const rule$3 = {
|
|
983
1067
|
meta: {
|
984
1068
|
type: 'suggestion',
|
985
1069
|
docs: {
|
986
|
-
category: '
|
1070
|
+
category: 'Operations',
|
987
1071
|
description: 'This rule allows you to enforce that the file name should match the operation name.',
|
988
1072
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/match-document-filename.md`,
|
989
1073
|
examples: [
|
@@ -1057,6 +1141,14 @@ const rule$3 = {
|
|
1057
1141
|
`,
|
1058
1142
|
},
|
1059
1143
|
],
|
1144
|
+
configOptions: [
|
1145
|
+
{
|
1146
|
+
query: CaseStyle.kebabCase,
|
1147
|
+
mutation: CaseStyle.kebabCase,
|
1148
|
+
subscription: CaseStyle.kebabCase,
|
1149
|
+
fragment: CaseStyle.kebabCase,
|
1150
|
+
},
|
1151
|
+
],
|
1060
1152
|
},
|
1061
1153
|
messages: {
|
1062
1154
|
[MATCH_EXTENSION]: `File extension "{{ fileExtension }}" don't match extension "{{ expectedFileExtension }}"`,
|
@@ -1065,27 +1157,29 @@ const rule$3 = {
|
|
1065
1157
|
schema: {
|
1066
1158
|
definitions: {
|
1067
1159
|
asString: {
|
1068
|
-
type: 'string',
|
1069
|
-
description: `One of: ${CASE_STYLES.map(t => `\`${t}\``).join(', ')}`,
|
1070
1160
|
enum: CASE_STYLES,
|
1161
|
+
description: `One of: ${CASE_STYLES.map(t => `\`${t}\``).join(', ')}`,
|
1071
1162
|
},
|
1072
1163
|
asObject: {
|
1073
1164
|
type: 'object',
|
1165
|
+
additionalProperties: false,
|
1074
1166
|
properties: {
|
1075
1167
|
style: {
|
1076
|
-
type: 'string',
|
1077
1168
|
enum: CASE_STYLES,
|
1078
1169
|
},
|
1170
|
+
suffix: {
|
1171
|
+
type: 'string',
|
1172
|
+
},
|
1079
1173
|
},
|
1080
1174
|
},
|
1081
1175
|
},
|
1082
|
-
$schema: 'http://json-schema.org/draft-04/schema#',
|
1083
1176
|
type: 'array',
|
1177
|
+
maxItems: 1,
|
1084
1178
|
items: {
|
1085
1179
|
type: 'object',
|
1180
|
+
additionalProperties: false,
|
1086
1181
|
properties: {
|
1087
1182
|
fileExtension: {
|
1088
|
-
type: 'string',
|
1089
1183
|
enum: ACCEPTED_EXTENSIONS,
|
1090
1184
|
},
|
1091
1185
|
query: schemaOption,
|
@@ -1160,13 +1254,7 @@ const rule$3 = {
|
|
1160
1254
|
},
|
1161
1255
|
};
|
1162
1256
|
|
1163
|
-
const FIELDS_KINDS = [
|
1164
|
-
graphql.Kind.FIELD_DEFINITION,
|
1165
|
-
graphql.Kind.INPUT_VALUE_DEFINITION,
|
1166
|
-
graphql.Kind.VARIABLE_DEFINITION,
|
1167
|
-
graphql.Kind.ARGUMENT,
|
1168
|
-
graphql.Kind.DIRECTIVE_DEFINITION,
|
1169
|
-
];
|
1257
|
+
const FIELDS_KINDS = [graphql.Kind.FIELD_DEFINITION, graphql.Kind.INPUT_VALUE_DEFINITION, graphql.Kind.ARGUMENT, graphql.Kind.DIRECTIVE_DEFINITION];
|
1170
1258
|
const KindToDisplayName = {
|
1171
1259
|
// types
|
1172
1260
|
[graphql.Kind.OBJECT_TYPE_DEFINITION]: 'Type',
|
@@ -1178,13 +1266,13 @@ const KindToDisplayName = {
|
|
1178
1266
|
// fields
|
1179
1267
|
[graphql.Kind.FIELD_DEFINITION]: 'Field',
|
1180
1268
|
[graphql.Kind.INPUT_VALUE_DEFINITION]: 'Input property',
|
1181
|
-
[graphql.Kind.VARIABLE_DEFINITION]: 'Variable',
|
1182
1269
|
[graphql.Kind.ARGUMENT]: 'Argument',
|
1183
1270
|
[graphql.Kind.DIRECTIVE_DEFINITION]: 'Directive',
|
1184
1271
|
// rest
|
1185
1272
|
[graphql.Kind.ENUM_VALUE_DEFINITION]: 'Enumeration value',
|
1186
1273
|
[graphql.Kind.OPERATION_DEFINITION]: 'Operation',
|
1187
1274
|
[graphql.Kind.FRAGMENT_DEFINITION]: 'Fragment',
|
1275
|
+
[graphql.Kind.VARIABLE_DEFINITION]: 'Variable',
|
1188
1276
|
};
|
1189
1277
|
const StyleToRegex = {
|
1190
1278
|
camelCase: /^[a-z][\dA-Za-z]*$/,
|
@@ -1202,7 +1290,7 @@ const rule$4 = {
|
|
1202
1290
|
type: 'suggestion',
|
1203
1291
|
docs: {
|
1204
1292
|
description: 'Require names to follow specified conventions.',
|
1205
|
-
category: '
|
1293
|
+
category: ['Schema', 'Operations'],
|
1206
1294
|
recommended: true,
|
1207
1295
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/naming-convention.md',
|
1208
1296
|
examples: [
|
@@ -1225,37 +1313,47 @@ const rule$4 = {
|
|
1225
1313
|
`,
|
1226
1314
|
},
|
1227
1315
|
],
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
},
|
1248
|
-
'FieldDefinition[parent.name.value=Mutation]': {
|
1249
|
-
forbiddenPrefixes: ['mutation'],
|
1250
|
-
forbiddenSuffixes: ['Mutation'],
|
1316
|
+
configOptions: {
|
1317
|
+
schema: [
|
1318
|
+
{
|
1319
|
+
types: 'PascalCase',
|
1320
|
+
fields: 'camelCase',
|
1321
|
+
overrides: {
|
1322
|
+
EnumValueDefinition: 'UPPER_CASE',
|
1323
|
+
'FieldDefinition[parent.name.value=Query]': {
|
1324
|
+
forbiddenPrefixes: ['query', 'get'],
|
1325
|
+
forbiddenSuffixes: ['Query'],
|
1326
|
+
},
|
1327
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
1328
|
+
forbiddenPrefixes: ['mutation'],
|
1329
|
+
forbiddenSuffixes: ['Mutation'],
|
1330
|
+
},
|
1331
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
1332
|
+
forbiddenPrefixes: ['subscription'],
|
1333
|
+
forbiddenSuffixes: ['Subscription'],
|
1334
|
+
},
|
1251
1335
|
},
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1336
|
+
},
|
1337
|
+
],
|
1338
|
+
operations: [
|
1339
|
+
{
|
1340
|
+
overrides: {
|
1341
|
+
Argument: 'camelCase',
|
1342
|
+
VariableDefinition: 'camelCase',
|
1343
|
+
OperationDefinition: {
|
1344
|
+
style: 'PascalCase',
|
1345
|
+
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
|
1346
|
+
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'],
|
1347
|
+
},
|
1348
|
+
FragmentDefinition: {
|
1349
|
+
style: 'PascalCase',
|
1350
|
+
forbiddenPrefixes: ['Fragment'],
|
1351
|
+
forbiddenSuffixes: ['Fragment'],
|
1352
|
+
},
|
1255
1353
|
},
|
1256
1354
|
},
|
1257
|
-
|
1258
|
-
|
1355
|
+
],
|
1356
|
+
},
|
1259
1357
|
},
|
1260
1358
|
schema: {
|
1261
1359
|
definitions: {
|
@@ -1414,7 +1512,7 @@ const rule$5 = {
|
|
1414
1512
|
meta: {
|
1415
1513
|
type: 'suggestion',
|
1416
1514
|
docs: {
|
1417
|
-
category: '
|
1515
|
+
category: 'Operations',
|
1418
1516
|
description: 'Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes.',
|
1419
1517
|
recommended: true,
|
1420
1518
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-anonymous-operations.md',
|
@@ -1463,7 +1561,7 @@ const rule$6 = {
|
|
1463
1561
|
type: 'suggestion',
|
1464
1562
|
docs: {
|
1465
1563
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-case-insensitive-enum-values-duplicates.md',
|
1466
|
-
category: '
|
1564
|
+
category: 'Schema',
|
1467
1565
|
recommended: true,
|
1468
1566
|
description: 'Disallow case-insensitive enum values duplicates.',
|
1469
1567
|
examples: [
|
@@ -1518,7 +1616,7 @@ const rule$7 = {
|
|
1518
1616
|
meta: {
|
1519
1617
|
type: 'suggestion',
|
1520
1618
|
docs: {
|
1521
|
-
category: '
|
1619
|
+
category: 'Operations',
|
1522
1620
|
description: `Enforce that deprecated fields or enum values are not in use by operations.`,
|
1523
1621
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-deprecated.md`,
|
1524
1622
|
requiresSchema: true,
|
@@ -1584,6 +1682,7 @@ const rule$7 = {
|
|
1584
1682
|
`,
|
1585
1683
|
},
|
1586
1684
|
],
|
1685
|
+
recommended: true,
|
1587
1686
|
},
|
1588
1687
|
messages: {
|
1589
1688
|
[NO_DEPRECATED]: `This {{ type }} is marked as deprecated in your GraphQL schema {{ reason }}`,
|
@@ -1636,8 +1735,9 @@ const rule$8 = {
|
|
1636
1735
|
type: 'suggestion',
|
1637
1736
|
docs: {
|
1638
1737
|
description: `Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.`,
|
1639
|
-
category: '
|
1738
|
+
category: 'Operations',
|
1640
1739
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-duplicate-fields.md',
|
1740
|
+
recommended: true,
|
1641
1741
|
examples: [
|
1642
1742
|
{
|
1643
1743
|
title: 'Incorrect',
|
@@ -1738,7 +1838,7 @@ const rule$9 = {
|
|
1738
1838
|
},
|
1739
1839
|
docs: {
|
1740
1840
|
description: 'Requires to use `"""` or `"` for adding a GraphQL description instead of `#`.\nAllows to use hashtag for comments, as long as it\'s not attached to an AST definition.',
|
1741
|
-
category: '
|
1841
|
+
category: 'Schema',
|
1742
1842
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-hashtag-description.md',
|
1743
1843
|
examples: [
|
1744
1844
|
{
|
@@ -1775,6 +1875,7 @@ const rule$9 = {
|
|
1775
1875
|
`,
|
1776
1876
|
},
|
1777
1877
|
],
|
1878
|
+
recommended: true,
|
1778
1879
|
},
|
1779
1880
|
type: 'suggestion',
|
1780
1881
|
schema: [],
|
@@ -1808,7 +1909,7 @@ const rule$a = {
|
|
1808
1909
|
meta: {
|
1809
1910
|
type: 'suggestion',
|
1810
1911
|
docs: {
|
1811
|
-
category: '
|
1912
|
+
category: 'Schema',
|
1812
1913
|
description: 'Disallow using root types for `read-only` or `write-only` schemas.',
|
1813
1914
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-root-type.md',
|
1814
1915
|
requiresSchema: true,
|
@@ -1841,7 +1942,6 @@ const rule$a = {
|
|
1841
1942
|
`,
|
1842
1943
|
},
|
1843
1944
|
],
|
1844
|
-
optionsForConfig: [{ disallow: ['subscription'] }],
|
1845
1945
|
},
|
1846
1946
|
schema: {
|
1847
1947
|
type: 'array',
|
@@ -1898,7 +1998,7 @@ const rule$b = {
|
|
1898
1998
|
meta: {
|
1899
1999
|
type: 'suggestion',
|
1900
2000
|
docs: {
|
1901
|
-
category: '
|
2001
|
+
category: 'Schema',
|
1902
2002
|
description: 'Avoid scalar result type on mutation type to make sure to return a valid state.',
|
1903
2003
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-scalar-result-type-on-mutation.md',
|
1904
2004
|
requiresSchema: true,
|
@@ -1955,7 +2055,7 @@ const rule$c = {
|
|
1955
2055
|
meta: {
|
1956
2056
|
type: 'suggestion',
|
1957
2057
|
docs: {
|
1958
|
-
category: '
|
2058
|
+
category: 'Schema',
|
1959
2059
|
description: 'Enforces users to avoid using the type name in a field name while defining your schema.',
|
1960
2060
|
recommended: true,
|
1961
2061
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-typename-prefix.md',
|
@@ -2011,11 +2111,11 @@ const RULE_NAME = 'no-unreachable-types';
|
|
2011
2111
|
const rule$d = {
|
2012
2112
|
meta: {
|
2013
2113
|
messages: {
|
2014
|
-
[UNREACHABLE_TYPE]:
|
2114
|
+
[UNREACHABLE_TYPE]: 'Type "{{ typeName }}" is unreachable',
|
2015
2115
|
},
|
2016
2116
|
docs: {
|
2017
2117
|
description: `Requires all types to be reachable at some level by root level fields.`,
|
2018
|
-
category: '
|
2118
|
+
category: 'Schema',
|
2019
2119
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${RULE_NAME}.md`,
|
2020
2120
|
requiresSchema: true,
|
2021
2121
|
examples: [
|
@@ -2046,6 +2146,7 @@ const rule$d = {
|
|
2046
2146
|
`,
|
2047
2147
|
},
|
2048
2148
|
],
|
2149
|
+
recommended: true,
|
2049
2150
|
},
|
2050
2151
|
fixable: 'code',
|
2051
2152
|
type: 'suggestion',
|
@@ -2091,7 +2192,7 @@ const rule$e = {
|
|
2091
2192
|
},
|
2092
2193
|
docs: {
|
2093
2194
|
description: `Requires all fields to be used at some level by siblings operations.`,
|
2094
|
-
category: '
|
2195
|
+
category: 'Schema',
|
2095
2196
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${RULE_NAME$1}.md`,
|
2096
2197
|
requiresSiblings: true,
|
2097
2198
|
requiresSchema: true,
|
@@ -2277,7 +2378,7 @@ const rule$f = {
|
|
2277
2378
|
meta: {
|
2278
2379
|
type: 'suggestion',
|
2279
2380
|
docs: {
|
2280
|
-
category: '
|
2381
|
+
category: 'Schema',
|
2281
2382
|
description: 'Require deletion date on `@deprecated` directive. Suggest removing deprecated things after deprecated date.',
|
2282
2383
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-deprecation-date.md',
|
2283
2384
|
examples: [
|
@@ -2380,7 +2481,7 @@ const rule$g = {
|
|
2380
2481
|
meta: {
|
2381
2482
|
docs: {
|
2382
2483
|
description: `Require all deprecation directives to specify a reason.`,
|
2383
|
-
category: '
|
2484
|
+
category: 'Schema',
|
2384
2485
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-deprecation-reason.md`,
|
2385
2486
|
recommended: true,
|
2386
2487
|
examples: [
|
@@ -2441,7 +2542,7 @@ const ALLOWED_KINDS$1 = [
|
|
2441
2542
|
const rule$h = {
|
2442
2543
|
meta: {
|
2443
2544
|
docs: {
|
2444
|
-
category: '
|
2545
|
+
category: 'Schema',
|
2445
2546
|
description: 'Enforce descriptions in your type definitions.',
|
2446
2547
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-description.md',
|
2447
2548
|
examples: [
|
@@ -2470,7 +2571,7 @@ const rule$h = {
|
|
2470
2571
|
`,
|
2471
2572
|
},
|
2472
2573
|
],
|
2473
|
-
|
2574
|
+
configOptions: [
|
2474
2575
|
{
|
2475
2576
|
types: true,
|
2476
2577
|
overrides: {
|
@@ -2541,7 +2642,7 @@ const rule$i = {
|
|
2541
2642
|
meta: {
|
2542
2643
|
type: 'suggestion',
|
2543
2644
|
docs: {
|
2544
|
-
category: '
|
2645
|
+
category: 'Schema',
|
2545
2646
|
description: 'Allow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application.\n> Currently, no errors are reported for result type `union`, `interface` and `scalar`.',
|
2546
2647
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${RULE_NAME$2}.md`,
|
2547
2648
|
requiresSchema: true,
|
@@ -2709,9 +2810,9 @@ const rule$j = {
|
|
2709
2810
|
meta: {
|
2710
2811
|
type: 'suggestion',
|
2711
2812
|
docs: {
|
2712
|
-
category: '
|
2713
|
-
description:
|
2714
|
-
url:
|
2813
|
+
category: 'Operations',
|
2814
|
+
description: 'Enforce selecting specific fields when they are available on the GraphQL type.',
|
2815
|
+
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-id-when-available.md',
|
2715
2816
|
requiresSchema: true,
|
2716
2817
|
requiresSiblings: true,
|
2717
2818
|
examples: [
|
@@ -2751,17 +2852,17 @@ const rule$j = {
|
|
2751
2852
|
`,
|
2752
2853
|
},
|
2753
2854
|
],
|
2855
|
+
recommended: true,
|
2754
2856
|
},
|
2755
2857
|
messages: {
|
2756
|
-
[REQUIRE_ID_WHEN_AVAILABLE]: `Field "{{ fieldName }}" must be selected when it's available on a type. Please make sure to include it in your selection set!\nIf you are using fragments, make sure that all used fragments {{checkedFragments}} specifies the field "{{ fieldName }}".`,
|
2858
|
+
[REQUIRE_ID_WHEN_AVAILABLE]: `Field "{{ fieldName }}" must be selected when it's available on a type. Please make sure to include it in your selection set!\nIf you are using fragments, make sure that all used fragments {{ checkedFragments }} specifies the field "{{ fieldName }}".`,
|
2757
2859
|
},
|
2758
2860
|
schema: {
|
2759
2861
|
type: 'array',
|
2760
|
-
additionalItems: false,
|
2761
|
-
minItems: 0,
|
2762
2862
|
maxItems: 1,
|
2763
2863
|
items: {
|
2764
2864
|
type: 'object',
|
2865
|
+
additionalProperties: false,
|
2765
2866
|
properties: {
|
2766
2867
|
fieldName: {
|
2767
2868
|
type: 'string',
|
@@ -2844,9 +2945,9 @@ const rule$j = {
|
|
2844
2945
|
const rule$k = {
|
2845
2946
|
meta: {
|
2846
2947
|
docs: {
|
2847
|
-
category: '
|
2948
|
+
category: 'Operations',
|
2848
2949
|
description: `Limit the complexity of the GraphQL operations solely by their depth. Based on [graphql-depth-limit](https://github.com/stems/graphql-depth-limit).`,
|
2849
|
-
url:
|
2950
|
+
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/selection-set-depth.md',
|
2850
2951
|
requiresSiblings: true,
|
2851
2952
|
examples: [
|
2852
2953
|
{
|
@@ -2889,22 +2990,26 @@ const rule$k = {
|
|
2889
2990
|
`,
|
2890
2991
|
},
|
2891
2992
|
],
|
2993
|
+
recommended: true,
|
2994
|
+
configOptions: [{ maxDepth: 7 }],
|
2892
2995
|
},
|
2893
2996
|
type: 'suggestion',
|
2894
2997
|
schema: {
|
2895
2998
|
type: 'array',
|
2896
|
-
additionalItems: false,
|
2897
2999
|
minItems: 1,
|
2898
3000
|
maxItems: 1,
|
2899
3001
|
items: {
|
2900
3002
|
type: 'object',
|
2901
|
-
|
3003
|
+
additionalProperties: false,
|
3004
|
+
required: ['maxDepth'],
|
2902
3005
|
properties: {
|
2903
3006
|
maxDepth: {
|
2904
3007
|
type: 'number',
|
2905
3008
|
},
|
2906
3009
|
ignore: {
|
2907
3010
|
type: 'array',
|
3011
|
+
uniqueItems: true,
|
3012
|
+
minItems: 1,
|
2908
3013
|
items: {
|
2909
3014
|
type: 'string',
|
2910
3015
|
},
|
@@ -2968,7 +3073,7 @@ const rule$l = {
|
|
2968
3073
|
type: 'suggestion',
|
2969
3074
|
docs: {
|
2970
3075
|
description: '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.',
|
2971
|
-
category: '
|
3076
|
+
category: 'Schema',
|
2972
3077
|
recommended: true,
|
2973
3078
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/strict-id-in-types.md',
|
2974
3079
|
examples: [
|
@@ -3028,13 +3133,15 @@ const rule$l = {
|
|
3028
3133
|
],
|
3029
3134
|
},
|
3030
3135
|
schema: {
|
3031
|
-
$schema: 'http://json-schema.org/draft-04/schema#',
|
3032
3136
|
type: 'array',
|
3137
|
+
maxItems: 1,
|
3033
3138
|
items: {
|
3034
3139
|
type: 'object',
|
3140
|
+
additionalProperties: false,
|
3035
3141
|
properties: {
|
3036
3142
|
acceptedIdNames: {
|
3037
3143
|
type: 'array',
|
3144
|
+
uniqueItems: true,
|
3038
3145
|
items: {
|
3039
3146
|
type: 'string',
|
3040
3147
|
},
|
@@ -3042,6 +3149,7 @@ const rule$l = {
|
|
3042
3149
|
},
|
3043
3150
|
acceptedIdTypes: {
|
3044
3151
|
type: 'array',
|
3152
|
+
uniqueItems: true,
|
3045
3153
|
items: {
|
3046
3154
|
type: 'string',
|
3047
3155
|
},
|
@@ -3052,19 +3160,21 @@ const rule$l = {
|
|
3052
3160
|
properties: {
|
3053
3161
|
types: {
|
3054
3162
|
type: 'array',
|
3163
|
+
uniqueItems: true,
|
3164
|
+
minItems: 1,
|
3055
3165
|
description: 'This is used to exclude types with names that match one of the specified values.',
|
3056
3166
|
items: {
|
3057
3167
|
type: 'string',
|
3058
3168
|
},
|
3059
|
-
default: [],
|
3060
3169
|
},
|
3061
3170
|
suffixes: {
|
3062
3171
|
type: 'array',
|
3172
|
+
uniqueItems: true,
|
3173
|
+
minItems: 1,
|
3063
3174
|
description: 'This is used to exclude types with names with suffixes that match one of the specified values.',
|
3064
3175
|
items: {
|
3065
3176
|
type: 'string',
|
3066
3177
|
},
|
3067
|
-
default: [],
|
3068
3178
|
},
|
3069
3179
|
},
|
3070
3180
|
},
|
@@ -3144,7 +3254,7 @@ const rule$m = {
|
|
3144
3254
|
meta: {
|
3145
3255
|
type: 'suggestion',
|
3146
3256
|
docs: {
|
3147
|
-
category: '
|
3257
|
+
category: 'Operations',
|
3148
3258
|
description: `Enforce unique fragment names across your project.`,
|
3149
3259
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${RULE_NAME$3}.md`,
|
3150
3260
|
requiresSiblings: true,
|
@@ -3203,7 +3313,7 @@ const rule$n = {
|
|
3203
3313
|
meta: {
|
3204
3314
|
type: 'suggestion',
|
3205
3315
|
docs: {
|
3206
|
-
category: '
|
3316
|
+
category: 'Operations',
|
3207
3317
|
description: `Enforce unique operation names across your project.`,
|
3208
3318
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${RULE_NAME$4}.md`,
|
3209
3319
|
requiresSiblings: true,
|