@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.mjs
CHANGED
@@ -12,21 +12,21 @@ import { CodeFileLoader } from '@graphql-tools/code-file-loader';
|
|
12
12
|
import { RuleTester, Linter } from 'eslint';
|
13
13
|
import { codeFrameColumns } from '@babel/code-frame';
|
14
14
|
|
15
|
+
const base = {
|
16
|
+
parser: '@graphql-eslint/eslint-plugin',
|
17
|
+
plugins: ['@graphql-eslint'],
|
18
|
+
};
|
19
|
+
|
15
20
|
/*
|
16
21
|
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
|
17
22
|
*/
|
18
|
-
const
|
19
|
-
|
20
|
-
plugins: ['@graphql-eslint'],
|
23
|
+
const schemaRecommendedConfig = {
|
24
|
+
extends: ['plugin:@graphql-eslint/base'],
|
21
25
|
rules: {
|
22
|
-
'@graphql-eslint/
|
23
|
-
'@graphql-eslint/fields-on-correct-type': 'error',
|
24
|
-
'@graphql-eslint/fragments-on-composite-type': 'error',
|
26
|
+
'@graphql-eslint/description-style': 'error',
|
25
27
|
'@graphql-eslint/known-argument-names': 'error',
|
26
28
|
'@graphql-eslint/known-directives': 'error',
|
27
|
-
'@graphql-eslint/known-fragment-names': 'error',
|
28
29
|
'@graphql-eslint/known-type-names': 'error',
|
29
|
-
'@graphql-eslint/lone-anonymous-operation': 'error',
|
30
30
|
'@graphql-eslint/lone-schema-definition': 'error',
|
31
31
|
'@graphql-eslint/naming-convention': [
|
32
32
|
'error',
|
@@ -35,12 +35,6 @@ const recommendedConfig = {
|
|
35
35
|
fields: 'camelCase',
|
36
36
|
overrides: {
|
37
37
|
EnumValueDefinition: 'UPPER_CASE',
|
38
|
-
OperationDefinition: {
|
39
|
-
style: 'PascalCase',
|
40
|
-
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
|
41
|
-
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'],
|
42
|
-
},
|
43
|
-
FragmentDefinition: { style: 'PascalCase', forbiddenPrefixes: ['Fragment'], forbiddenSuffixes: ['Fragment'] },
|
44
38
|
'FieldDefinition[parent.name.value=Query]': {
|
45
39
|
forbiddenPrefixes: ['query', 'get'],
|
46
40
|
forbiddenSuffixes: ['Query'],
|
@@ -56,76 +50,129 @@ const recommendedConfig = {
|
|
56
50
|
},
|
57
51
|
},
|
58
52
|
],
|
59
|
-
'@graphql-eslint/no-anonymous-operations': 'error',
|
60
53
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': 'error',
|
61
|
-
'@graphql-eslint/no-
|
54
|
+
'@graphql-eslint/no-hashtag-description': 'error',
|
62
55
|
'@graphql-eslint/no-typename-prefix': 'error',
|
63
|
-
'@graphql-eslint/no-
|
64
|
-
'@graphql-eslint/no-unused-fragments': 'error',
|
65
|
-
'@graphql-eslint/no-unused-variables': 'error',
|
66
|
-
'@graphql-eslint/one-field-subscriptions': 'error',
|
67
|
-
'@graphql-eslint/overlapping-fields-can-be-merged': 'error',
|
68
|
-
'@graphql-eslint/possible-fragment-spread': 'error',
|
56
|
+
'@graphql-eslint/no-unreachable-types': 'error',
|
69
57
|
'@graphql-eslint/possible-type-extension': 'error',
|
70
58
|
'@graphql-eslint/provided-required-arguments': 'error',
|
71
59
|
'@graphql-eslint/require-deprecation-reason': 'error',
|
72
|
-
'@graphql-eslint/scalar-leafs': 'error',
|
73
60
|
'@graphql-eslint/strict-id-in-types': 'error',
|
74
|
-
'@graphql-eslint/unique-argument-names': 'error',
|
75
61
|
'@graphql-eslint/unique-directive-names': 'error',
|
76
62
|
'@graphql-eslint/unique-directive-names-per-location': 'error',
|
77
63
|
'@graphql-eslint/unique-enum-value-names': 'error',
|
78
64
|
'@graphql-eslint/unique-field-definition-names': 'error',
|
79
|
-
'@graphql-eslint/unique-input-field-names': 'error',
|
80
65
|
'@graphql-eslint/unique-operation-types': 'error',
|
81
66
|
'@graphql-eslint/unique-type-names': 'error',
|
82
|
-
'@graphql-eslint/unique-variable-names': 'error',
|
83
|
-
'@graphql-eslint/value-literals-of-correct-type': 'error',
|
84
|
-
'@graphql-eslint/variables-are-input-types': 'error',
|
85
|
-
'@graphql-eslint/variables-in-allowed-position': 'error',
|
86
67
|
},
|
87
68
|
};
|
88
69
|
|
89
70
|
/*
|
90
71
|
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
|
91
72
|
*/
|
92
|
-
const
|
93
|
-
|
73
|
+
const schemaAllConfig = {
|
74
|
+
extends: ['plugin:@graphql-eslint/base', 'plugin:@graphql-eslint/schema-recommended'],
|
94
75
|
rules: {
|
95
|
-
...recommendedConfig.rules,
|
96
76
|
'@graphql-eslint/alphabetize': [
|
97
77
|
'error',
|
98
78
|
{
|
99
79
|
fields: ['ObjectTypeDefinition', 'InterfaceTypeDefinition', 'InputObjectTypeDefinition'],
|
100
80
|
values: ['EnumTypeDefinition'],
|
101
|
-
selections: ['OperationDefinition', 'FragmentDefinition'],
|
102
|
-
variables: ['OperationDefinition'],
|
103
81
|
arguments: ['FieldDefinition', 'Field', 'DirectiveDefinition', 'Directive'],
|
104
82
|
},
|
105
83
|
],
|
106
|
-
'@graphql-eslint/description-style': 'error',
|
107
84
|
'@graphql-eslint/input-name': 'error',
|
108
|
-
'@graphql-eslint/
|
109
|
-
'@graphql-eslint/no-deprecated': 'error',
|
110
|
-
'@graphql-eslint/no-duplicate-fields': 'error',
|
111
|
-
'@graphql-eslint/no-hashtag-description': 'error',
|
112
|
-
'@graphql-eslint/no-root-type': ['error', { disallow: ['subscription'] }],
|
85
|
+
'@graphql-eslint/no-root-type': 'off',
|
113
86
|
'@graphql-eslint/no-scalar-result-type-on-mutation': 'error',
|
114
|
-
'@graphql-eslint/no-
|
115
|
-
'@graphql-eslint/no-unused-fields': 'error',
|
87
|
+
'@graphql-eslint/no-unused-fields': 'off',
|
116
88
|
'@graphql-eslint/require-deprecation-date': 'error',
|
117
89
|
'@graphql-eslint/require-description': ['error', { types: true, overrides: { DirectiveDefinition: true } }],
|
118
90
|
'@graphql-eslint/require-field-of-type-query-in-mutation-result': 'error',
|
91
|
+
},
|
92
|
+
};
|
93
|
+
|
94
|
+
/*
|
95
|
+
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
|
96
|
+
*/
|
97
|
+
const operationsRecommendedConfig = {
|
98
|
+
extends: ['plugin:@graphql-eslint/base'],
|
99
|
+
rules: {
|
100
|
+
'@graphql-eslint/executable-definitions': 'error',
|
101
|
+
'@graphql-eslint/fields-on-correct-type': 'error',
|
102
|
+
'@graphql-eslint/fragments-on-composite-type': 'error',
|
103
|
+
'@graphql-eslint/known-argument-names': 'error',
|
104
|
+
'@graphql-eslint/known-directives': 'error',
|
105
|
+
'@graphql-eslint/known-fragment-names': 'error',
|
106
|
+
'@graphql-eslint/known-type-names': 'error',
|
107
|
+
'@graphql-eslint/lone-anonymous-operation': 'error',
|
108
|
+
'@graphql-eslint/naming-convention': [
|
109
|
+
'error',
|
110
|
+
{
|
111
|
+
overrides: {
|
112
|
+
Argument: 'camelCase',
|
113
|
+
VariableDefinition: 'camelCase',
|
114
|
+
OperationDefinition: {
|
115
|
+
style: 'PascalCase',
|
116
|
+
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
|
117
|
+
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'],
|
118
|
+
},
|
119
|
+
FragmentDefinition: { style: 'PascalCase', forbiddenPrefixes: ['Fragment'], forbiddenSuffixes: ['Fragment'] },
|
120
|
+
},
|
121
|
+
},
|
122
|
+
],
|
123
|
+
'@graphql-eslint/no-anonymous-operations': 'error',
|
124
|
+
'@graphql-eslint/no-deprecated': 'error',
|
125
|
+
'@graphql-eslint/no-duplicate-fields': 'error',
|
126
|
+
'@graphql-eslint/no-fragment-cycles': 'error',
|
127
|
+
'@graphql-eslint/no-undefined-variables': 'error',
|
128
|
+
'@graphql-eslint/no-unused-fragments': 'error',
|
129
|
+
'@graphql-eslint/no-unused-variables': 'error',
|
130
|
+
'@graphql-eslint/one-field-subscriptions': 'error',
|
131
|
+
'@graphql-eslint/overlapping-fields-can-be-merged': 'error',
|
132
|
+
'@graphql-eslint/possible-fragment-spread': 'error',
|
133
|
+
'@graphql-eslint/provided-required-arguments': 'error',
|
119
134
|
'@graphql-eslint/require-id-when-available': 'error',
|
120
|
-
'@graphql-eslint/
|
135
|
+
'@graphql-eslint/scalar-leafs': 'error',
|
136
|
+
'@graphql-eslint/selection-set-depth': ['error', { maxDepth: 7 }],
|
137
|
+
'@graphql-eslint/unique-argument-names': 'error',
|
138
|
+
'@graphql-eslint/unique-directive-names-per-location': 'error',
|
139
|
+
'@graphql-eslint/unique-input-field-names': 'error',
|
140
|
+
'@graphql-eslint/unique-variable-names': 'error',
|
141
|
+
'@graphql-eslint/value-literals-of-correct-type': 'error',
|
142
|
+
'@graphql-eslint/variables-are-input-types': 'error',
|
143
|
+
'@graphql-eslint/variables-in-allowed-position': 'error',
|
144
|
+
},
|
145
|
+
};
|
146
|
+
|
147
|
+
/*
|
148
|
+
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
|
149
|
+
*/
|
150
|
+
const operationsAllConfig = {
|
151
|
+
extends: ['plugin:@graphql-eslint/base', 'plugin:@graphql-eslint/operations-recommended'],
|
152
|
+
rules: {
|
153
|
+
'@graphql-eslint/alphabetize': [
|
154
|
+
'error',
|
155
|
+
{
|
156
|
+
selections: ['OperationDefinition', 'FragmentDefinition'],
|
157
|
+
variables: ['OperationDefinition'],
|
158
|
+
arguments: ['Field', 'Directive'],
|
159
|
+
},
|
160
|
+
],
|
161
|
+
'@graphql-eslint/match-document-filename': [
|
162
|
+
'error',
|
163
|
+
{ query: 'kebab-case', mutation: 'kebab-case', subscription: 'kebab-case', fragment: 'kebab-case' },
|
164
|
+
],
|
121
165
|
'@graphql-eslint/unique-fragment-name': 'error',
|
122
166
|
'@graphql-eslint/unique-operation-name': 'error',
|
123
167
|
},
|
124
168
|
};
|
125
169
|
|
126
170
|
const configs = {
|
127
|
-
|
128
|
-
recommended:
|
171
|
+
base,
|
172
|
+
'schema-recommended': schemaRecommendedConfig,
|
173
|
+
'schema-all': schemaAllConfig,
|
174
|
+
'operations-recommended': operationsRecommendedConfig,
|
175
|
+
'operations-all': operationsAllConfig,
|
129
176
|
};
|
130
177
|
|
131
178
|
function requireSiblingsOperations(ruleName, context) {
|
@@ -338,7 +385,6 @@ const validationToRule = (name, ruleName, docs, getDocumentNode) => {
|
|
338
385
|
docs: {
|
339
386
|
...docs,
|
340
387
|
graphQLJSRuleName: ruleName,
|
341
|
-
category: 'Validation',
|
342
388
|
recommended: true,
|
343
389
|
requiresSchema,
|
344
390
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${name}.md`,
|
@@ -375,16 +421,22 @@ const importFiles = (context) => {
|
|
375
421
|
return processImport(context.getFilename());
|
376
422
|
};
|
377
423
|
const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-definitions', 'ExecutableDefinitions', {
|
424
|
+
category: 'Operations',
|
378
425
|
description: `A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.`,
|
379
426
|
}), validationToRule('fields-on-correct-type', 'FieldsOnCorrectType', {
|
427
|
+
category: 'Operations',
|
380
428
|
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`.',
|
381
429
|
}), validationToRule('fragments-on-composite-type', 'FragmentsOnCompositeTypes', {
|
430
|
+
category: 'Operations',
|
382
431
|
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.`,
|
383
432
|
}), validationToRule('known-argument-names', 'KnownArgumentNames', {
|
433
|
+
category: ['Schema', 'Operations'],
|
384
434
|
description: `A GraphQL field is only valid if all supplied arguments are defined by that field.`,
|
385
435
|
}), validationToRule('known-directives', 'KnownDirectives', {
|
436
|
+
category: ['Schema', 'Operations'],
|
386
437
|
description: `A GraphQL document is only valid if all \`@directives\` are known by the schema and legally positioned.`,
|
387
438
|
}), validationToRule('known-fragment-names', 'KnownFragmentNames', {
|
439
|
+
category: 'Operations',
|
388
440
|
description: `A GraphQL document is only valid if all \`...Fragment\` fragment spreads refer to fragments defined in the same document.`,
|
389
441
|
examples: [
|
390
442
|
{
|
@@ -451,17 +503,23 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
451
503
|
},
|
452
504
|
],
|
453
505
|
}, importFiles), validationToRule('known-type-names', 'KnownTypeNames', {
|
506
|
+
category: ['Schema', 'Operations'],
|
454
507
|
description: `A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.`,
|
455
508
|
}), validationToRule('lone-anonymous-operation', 'LoneAnonymousOperation', {
|
509
|
+
category: 'Operations',
|
456
510
|
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.`,
|
457
511
|
}), validationToRule('lone-schema-definition', 'LoneSchemaDefinition', {
|
512
|
+
category: 'Schema',
|
458
513
|
description: `A GraphQL document is only valid if it contains only one schema definition.`,
|
459
514
|
requiresSchema: false,
|
460
515
|
}), validationToRule('no-fragment-cycles', 'NoFragmentCycles', {
|
516
|
+
category: 'Operations',
|
461
517
|
description: `A GraphQL fragment is only valid when it does not have cycles in fragments usage.`,
|
462
518
|
}), validationToRule('no-undefined-variables', 'NoUndefinedVariables', {
|
519
|
+
category: 'Operations',
|
463
520
|
description: `A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.`,
|
464
521
|
}, importFiles), validationToRule('no-unused-fragments', 'NoUnusedFragments', {
|
522
|
+
category: 'Operations',
|
465
523
|
description: `A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.`,
|
466
524
|
requiresSiblings: true,
|
467
525
|
}, context => {
|
@@ -491,49 +549,68 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
491
549
|
};
|
492
550
|
return getParentNode(context.getFilename());
|
493
551
|
}), validationToRule('no-unused-variables', 'NoUnusedVariables', {
|
552
|
+
category: 'Operations',
|
494
553
|
description: `A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.`,
|
495
554
|
}, importFiles), validationToRule('overlapping-fields-can-be-merged', 'OverlappingFieldsCanBeMerged', {
|
555
|
+
category: 'Operations',
|
496
556
|
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.`,
|
497
557
|
}), validationToRule('possible-fragment-spread', 'PossibleFragmentSpreads', {
|
558
|
+
category: 'Operations',
|
498
559
|
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.`,
|
499
560
|
}), validationToRule('possible-type-extension', 'PossibleTypeExtensions', {
|
561
|
+
category: 'Schema',
|
500
562
|
description: `A type extension is only valid if the type is defined and has the same kind.`,
|
501
563
|
requiresSchema: false,
|
502
564
|
}), validationToRule('provided-required-arguments', 'ProvidedRequiredArguments', {
|
565
|
+
category: ['Schema', 'Operations'],
|
503
566
|
description: `A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.`,
|
504
567
|
}), validationToRule('scalar-leafs', 'ScalarLeafs', {
|
568
|
+
category: 'Operations',
|
505
569
|
description: `A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.`,
|
506
570
|
}), validationToRule('one-field-subscriptions', 'SingleFieldSubscriptions', {
|
571
|
+
category: 'Operations',
|
507
572
|
description: `A GraphQL subscription is valid only if it contains a single root field.`,
|
508
573
|
}), validationToRule('unique-argument-names', 'UniqueArgumentNames', {
|
574
|
+
category: 'Operations',
|
509
575
|
description: `A GraphQL field or directive is only valid if all supplied arguments are uniquely named.`,
|
510
576
|
}), validationToRule('unique-directive-names', 'UniqueDirectiveNames', {
|
577
|
+
category: 'Schema',
|
511
578
|
description: `A GraphQL document is only valid if all defined directives have unique names.`,
|
512
579
|
requiresSchema: false,
|
513
580
|
}), validationToRule('unique-directive-names-per-location', 'UniqueDirectivesPerLocation', {
|
581
|
+
category: ['Schema', 'Operations'],
|
514
582
|
description: `A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.`,
|
515
583
|
}), validationToRule('unique-enum-value-names', 'UniqueEnumValueNames', {
|
584
|
+
category: 'Schema',
|
516
585
|
description: `A GraphQL enum type is only valid if all its values are uniquely named.`,
|
517
586
|
requiresSchema: false,
|
518
587
|
}), validationToRule('unique-field-definition-names', 'UniqueFieldDefinitionNames', {
|
588
|
+
category: 'Schema',
|
519
589
|
description: `A GraphQL complex type is only valid if all its fields are uniquely named.`,
|
520
590
|
requiresSchema: false,
|
521
591
|
}), validationToRule('unique-input-field-names', 'UniqueInputFieldNames', {
|
592
|
+
category: 'Operations',
|
522
593
|
description: `A GraphQL input object value is only valid if all supplied fields are uniquely named.`,
|
523
594
|
requiresSchema: false,
|
524
595
|
}), validationToRule('unique-operation-types', 'UniqueOperationTypes', {
|
596
|
+
category: 'Schema',
|
525
597
|
description: `A GraphQL document is only valid if it has only one type per operation.`,
|
526
598
|
requiresSchema: false,
|
527
599
|
}), validationToRule('unique-type-names', 'UniqueTypeNames', {
|
600
|
+
category: 'Schema',
|
528
601
|
description: `A GraphQL document is only valid if all defined types have unique names.`,
|
529
602
|
requiresSchema: false,
|
530
603
|
}), validationToRule('unique-variable-names', 'UniqueVariableNames', {
|
604
|
+
category: 'Operations',
|
531
605
|
description: `A GraphQL operation is only valid if all its variables are uniquely named.`,
|
532
606
|
}), validationToRule('value-literals-of-correct-type', 'ValuesOfCorrectType', {
|
607
|
+
category: 'Operations',
|
533
608
|
description: `A GraphQL document is only valid if all value literals are of the type expected at their position.`,
|
534
609
|
}), validationToRule('variables-are-input-types', 'VariablesAreInputTypes', {
|
610
|
+
category: 'Operations',
|
535
611
|
description: `A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).`,
|
536
612
|
}), validationToRule('variables-in-allowed-position', 'VariablesInAllowedPosition', {
|
613
|
+
category: 'Operations',
|
537
614
|
description: `Variables passed to field arguments conform to type.`,
|
538
615
|
}));
|
539
616
|
|
@@ -559,7 +636,7 @@ const rule = {
|
|
559
636
|
meta: {
|
560
637
|
type: 'suggestion',
|
561
638
|
docs: {
|
562
|
-
category: '
|
639
|
+
category: ['Schema', 'Operations'],
|
563
640
|
description: 'Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.',
|
564
641
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/alphabetize.md',
|
565
642
|
examples: [
|
@@ -638,15 +715,22 @@ const rule = {
|
|
638
715
|
`,
|
639
716
|
},
|
640
717
|
],
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
718
|
+
configOptions: {
|
719
|
+
schema: [
|
720
|
+
{
|
721
|
+
fields: fieldsEnum,
|
722
|
+
values: valuesEnum,
|
723
|
+
arguments: argumentsEnum,
|
724
|
+
},
|
725
|
+
],
|
726
|
+
operations: [
|
727
|
+
{
|
728
|
+
selections: selectionsEnum,
|
729
|
+
variables: variablesEnum,
|
730
|
+
arguments: [Kind.FIELD, Kind.DIRECTIVE],
|
731
|
+
},
|
732
|
+
],
|
733
|
+
},
|
650
734
|
},
|
651
735
|
messages: {
|
652
736
|
[ALPHABETIZE]: '"{{ currName }}" should be before "{{ prevName }}"',
|
@@ -811,20 +895,20 @@ const rule$1 = {
|
|
811
895
|
},
|
812
896
|
],
|
813
897
|
description: 'Require all comments to follow the same style (either block or inline).',
|
814
|
-
category: '
|
898
|
+
category: 'Schema',
|
815
899
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/description-style.md',
|
900
|
+
recommended: true,
|
816
901
|
},
|
817
902
|
schema: [
|
818
903
|
{
|
819
904
|
type: 'object',
|
905
|
+
additionalProperties: false,
|
820
906
|
properties: {
|
821
907
|
style: {
|
822
|
-
type: 'string',
|
823
908
|
enum: ['block', 'inline'],
|
824
909
|
default: 'inline',
|
825
910
|
},
|
826
911
|
},
|
827
|
-
additionalProperties: false,
|
828
912
|
},
|
829
913
|
],
|
830
914
|
},
|
@@ -852,7 +936,7 @@ const rule$2 = {
|
|
852
936
|
type: 'suggestion',
|
853
937
|
docs: {
|
854
938
|
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.',
|
855
|
-
category: '
|
939
|
+
category: 'Schema',
|
856
940
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/input-name.md',
|
857
941
|
examples: [
|
858
942
|
{
|
@@ -977,7 +1061,7 @@ const rule$3 = {
|
|
977
1061
|
meta: {
|
978
1062
|
type: 'suggestion',
|
979
1063
|
docs: {
|
980
|
-
category: '
|
1064
|
+
category: 'Operations',
|
981
1065
|
description: 'This rule allows you to enforce that the file name should match the operation name.',
|
982
1066
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/match-document-filename.md`,
|
983
1067
|
examples: [
|
@@ -1051,6 +1135,14 @@ const rule$3 = {
|
|
1051
1135
|
`,
|
1052
1136
|
},
|
1053
1137
|
],
|
1138
|
+
configOptions: [
|
1139
|
+
{
|
1140
|
+
query: CaseStyle.kebabCase,
|
1141
|
+
mutation: CaseStyle.kebabCase,
|
1142
|
+
subscription: CaseStyle.kebabCase,
|
1143
|
+
fragment: CaseStyle.kebabCase,
|
1144
|
+
},
|
1145
|
+
],
|
1054
1146
|
},
|
1055
1147
|
messages: {
|
1056
1148
|
[MATCH_EXTENSION]: `File extension "{{ fileExtension }}" don't match extension "{{ expectedFileExtension }}"`,
|
@@ -1059,27 +1151,29 @@ const rule$3 = {
|
|
1059
1151
|
schema: {
|
1060
1152
|
definitions: {
|
1061
1153
|
asString: {
|
1062
|
-
type: 'string',
|
1063
|
-
description: `One of: ${CASE_STYLES.map(t => `\`${t}\``).join(', ')}`,
|
1064
1154
|
enum: CASE_STYLES,
|
1155
|
+
description: `One of: ${CASE_STYLES.map(t => `\`${t}\``).join(', ')}`,
|
1065
1156
|
},
|
1066
1157
|
asObject: {
|
1067
1158
|
type: 'object',
|
1159
|
+
additionalProperties: false,
|
1068
1160
|
properties: {
|
1069
1161
|
style: {
|
1070
|
-
type: 'string',
|
1071
1162
|
enum: CASE_STYLES,
|
1072
1163
|
},
|
1164
|
+
suffix: {
|
1165
|
+
type: 'string',
|
1166
|
+
},
|
1073
1167
|
},
|
1074
1168
|
},
|
1075
1169
|
},
|
1076
|
-
$schema: 'http://json-schema.org/draft-04/schema#',
|
1077
1170
|
type: 'array',
|
1171
|
+
maxItems: 1,
|
1078
1172
|
items: {
|
1079
1173
|
type: 'object',
|
1174
|
+
additionalProperties: false,
|
1080
1175
|
properties: {
|
1081
1176
|
fileExtension: {
|
1082
|
-
type: 'string',
|
1083
1177
|
enum: ACCEPTED_EXTENSIONS,
|
1084
1178
|
},
|
1085
1179
|
query: schemaOption,
|
@@ -1154,13 +1248,7 @@ const rule$3 = {
|
|
1154
1248
|
},
|
1155
1249
|
};
|
1156
1250
|
|
1157
|
-
const FIELDS_KINDS = [
|
1158
|
-
Kind.FIELD_DEFINITION,
|
1159
|
-
Kind.INPUT_VALUE_DEFINITION,
|
1160
|
-
Kind.VARIABLE_DEFINITION,
|
1161
|
-
Kind.ARGUMENT,
|
1162
|
-
Kind.DIRECTIVE_DEFINITION,
|
1163
|
-
];
|
1251
|
+
const FIELDS_KINDS = [Kind.FIELD_DEFINITION, Kind.INPUT_VALUE_DEFINITION, Kind.ARGUMENT, Kind.DIRECTIVE_DEFINITION];
|
1164
1252
|
const KindToDisplayName = {
|
1165
1253
|
// types
|
1166
1254
|
[Kind.OBJECT_TYPE_DEFINITION]: 'Type',
|
@@ -1172,13 +1260,13 @@ const KindToDisplayName = {
|
|
1172
1260
|
// fields
|
1173
1261
|
[Kind.FIELD_DEFINITION]: 'Field',
|
1174
1262
|
[Kind.INPUT_VALUE_DEFINITION]: 'Input property',
|
1175
|
-
[Kind.VARIABLE_DEFINITION]: 'Variable',
|
1176
1263
|
[Kind.ARGUMENT]: 'Argument',
|
1177
1264
|
[Kind.DIRECTIVE_DEFINITION]: 'Directive',
|
1178
1265
|
// rest
|
1179
1266
|
[Kind.ENUM_VALUE_DEFINITION]: 'Enumeration value',
|
1180
1267
|
[Kind.OPERATION_DEFINITION]: 'Operation',
|
1181
1268
|
[Kind.FRAGMENT_DEFINITION]: 'Fragment',
|
1269
|
+
[Kind.VARIABLE_DEFINITION]: 'Variable',
|
1182
1270
|
};
|
1183
1271
|
const StyleToRegex = {
|
1184
1272
|
camelCase: /^[a-z][\dA-Za-z]*$/,
|
@@ -1196,7 +1284,7 @@ const rule$4 = {
|
|
1196
1284
|
type: 'suggestion',
|
1197
1285
|
docs: {
|
1198
1286
|
description: 'Require names to follow specified conventions.',
|
1199
|
-
category: '
|
1287
|
+
category: ['Schema', 'Operations'],
|
1200
1288
|
recommended: true,
|
1201
1289
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/naming-convention.md',
|
1202
1290
|
examples: [
|
@@ -1219,37 +1307,47 @@ const rule$4 = {
|
|
1219
1307
|
`,
|
1220
1308
|
},
|
1221
1309
|
],
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
},
|
1242
|
-
'FieldDefinition[parent.name.value=Mutation]': {
|
1243
|
-
forbiddenPrefixes: ['mutation'],
|
1244
|
-
forbiddenSuffixes: ['Mutation'],
|
1310
|
+
configOptions: {
|
1311
|
+
schema: [
|
1312
|
+
{
|
1313
|
+
types: 'PascalCase',
|
1314
|
+
fields: 'camelCase',
|
1315
|
+
overrides: {
|
1316
|
+
EnumValueDefinition: 'UPPER_CASE',
|
1317
|
+
'FieldDefinition[parent.name.value=Query]': {
|
1318
|
+
forbiddenPrefixes: ['query', 'get'],
|
1319
|
+
forbiddenSuffixes: ['Query'],
|
1320
|
+
},
|
1321
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
1322
|
+
forbiddenPrefixes: ['mutation'],
|
1323
|
+
forbiddenSuffixes: ['Mutation'],
|
1324
|
+
},
|
1325
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
1326
|
+
forbiddenPrefixes: ['subscription'],
|
1327
|
+
forbiddenSuffixes: ['Subscription'],
|
1328
|
+
},
|
1245
1329
|
},
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1330
|
+
},
|
1331
|
+
],
|
1332
|
+
operations: [
|
1333
|
+
{
|
1334
|
+
overrides: {
|
1335
|
+
Argument: 'camelCase',
|
1336
|
+
VariableDefinition: 'camelCase',
|
1337
|
+
OperationDefinition: {
|
1338
|
+
style: 'PascalCase',
|
1339
|
+
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
|
1340
|
+
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'],
|
1341
|
+
},
|
1342
|
+
FragmentDefinition: {
|
1343
|
+
style: 'PascalCase',
|
1344
|
+
forbiddenPrefixes: ['Fragment'],
|
1345
|
+
forbiddenSuffixes: ['Fragment'],
|
1346
|
+
},
|
1249
1347
|
},
|
1250
1348
|
},
|
1251
|
-
|
1252
|
-
|
1349
|
+
],
|
1350
|
+
},
|
1253
1351
|
},
|
1254
1352
|
schema: {
|
1255
1353
|
definitions: {
|
@@ -1408,7 +1506,7 @@ const rule$5 = {
|
|
1408
1506
|
meta: {
|
1409
1507
|
type: 'suggestion',
|
1410
1508
|
docs: {
|
1411
|
-
category: '
|
1509
|
+
category: 'Operations',
|
1412
1510
|
description: 'Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes.',
|
1413
1511
|
recommended: true,
|
1414
1512
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-anonymous-operations.md',
|
@@ -1457,7 +1555,7 @@ const rule$6 = {
|
|
1457
1555
|
type: 'suggestion',
|
1458
1556
|
docs: {
|
1459
1557
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-case-insensitive-enum-values-duplicates.md',
|
1460
|
-
category: '
|
1558
|
+
category: 'Schema',
|
1461
1559
|
recommended: true,
|
1462
1560
|
description: 'Disallow case-insensitive enum values duplicates.',
|
1463
1561
|
examples: [
|
@@ -1512,7 +1610,7 @@ const rule$7 = {
|
|
1512
1610
|
meta: {
|
1513
1611
|
type: 'suggestion',
|
1514
1612
|
docs: {
|
1515
|
-
category: '
|
1613
|
+
category: 'Operations',
|
1516
1614
|
description: `Enforce that deprecated fields or enum values are not in use by operations.`,
|
1517
1615
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-deprecated.md`,
|
1518
1616
|
requiresSchema: true,
|
@@ -1578,6 +1676,7 @@ const rule$7 = {
|
|
1578
1676
|
`,
|
1579
1677
|
},
|
1580
1678
|
],
|
1679
|
+
recommended: true,
|
1581
1680
|
},
|
1582
1681
|
messages: {
|
1583
1682
|
[NO_DEPRECATED]: `This {{ type }} is marked as deprecated in your GraphQL schema {{ reason }}`,
|
@@ -1630,8 +1729,9 @@ const rule$8 = {
|
|
1630
1729
|
type: 'suggestion',
|
1631
1730
|
docs: {
|
1632
1731
|
description: `Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.`,
|
1633
|
-
category: '
|
1732
|
+
category: 'Operations',
|
1634
1733
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-duplicate-fields.md',
|
1734
|
+
recommended: true,
|
1635
1735
|
examples: [
|
1636
1736
|
{
|
1637
1737
|
title: 'Incorrect',
|
@@ -1732,7 +1832,7 @@ const rule$9 = {
|
|
1732
1832
|
},
|
1733
1833
|
docs: {
|
1734
1834
|
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.',
|
1735
|
-
category: '
|
1835
|
+
category: 'Schema',
|
1736
1836
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-hashtag-description.md',
|
1737
1837
|
examples: [
|
1738
1838
|
{
|
@@ -1769,6 +1869,7 @@ const rule$9 = {
|
|
1769
1869
|
`,
|
1770
1870
|
},
|
1771
1871
|
],
|
1872
|
+
recommended: true,
|
1772
1873
|
},
|
1773
1874
|
type: 'suggestion',
|
1774
1875
|
schema: [],
|
@@ -1802,7 +1903,7 @@ const rule$a = {
|
|
1802
1903
|
meta: {
|
1803
1904
|
type: 'suggestion',
|
1804
1905
|
docs: {
|
1805
|
-
category: '
|
1906
|
+
category: 'Schema',
|
1806
1907
|
description: 'Disallow using root types for `read-only` or `write-only` schemas.',
|
1807
1908
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-root-type.md',
|
1808
1909
|
requiresSchema: true,
|
@@ -1835,7 +1936,6 @@ const rule$a = {
|
|
1835
1936
|
`,
|
1836
1937
|
},
|
1837
1938
|
],
|
1838
|
-
optionsForConfig: [{ disallow: ['subscription'] }],
|
1839
1939
|
},
|
1840
1940
|
schema: {
|
1841
1941
|
type: 'array',
|
@@ -1892,7 +1992,7 @@ const rule$b = {
|
|
1892
1992
|
meta: {
|
1893
1993
|
type: 'suggestion',
|
1894
1994
|
docs: {
|
1895
|
-
category: '
|
1995
|
+
category: 'Schema',
|
1896
1996
|
description: 'Avoid scalar result type on mutation type to make sure to return a valid state.',
|
1897
1997
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-scalar-result-type-on-mutation.md',
|
1898
1998
|
requiresSchema: true,
|
@@ -1949,7 +2049,7 @@ const rule$c = {
|
|
1949
2049
|
meta: {
|
1950
2050
|
type: 'suggestion',
|
1951
2051
|
docs: {
|
1952
|
-
category: '
|
2052
|
+
category: 'Schema',
|
1953
2053
|
description: 'Enforces users to avoid using the type name in a field name while defining your schema.',
|
1954
2054
|
recommended: true,
|
1955
2055
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-typename-prefix.md',
|
@@ -2005,11 +2105,11 @@ const RULE_NAME = 'no-unreachable-types';
|
|
2005
2105
|
const rule$d = {
|
2006
2106
|
meta: {
|
2007
2107
|
messages: {
|
2008
|
-
[UNREACHABLE_TYPE]:
|
2108
|
+
[UNREACHABLE_TYPE]: 'Type "{{ typeName }}" is unreachable',
|
2009
2109
|
},
|
2010
2110
|
docs: {
|
2011
2111
|
description: `Requires all types to be reachable at some level by root level fields.`,
|
2012
|
-
category: '
|
2112
|
+
category: 'Schema',
|
2013
2113
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${RULE_NAME}.md`,
|
2014
2114
|
requiresSchema: true,
|
2015
2115
|
examples: [
|
@@ -2040,6 +2140,7 @@ const rule$d = {
|
|
2040
2140
|
`,
|
2041
2141
|
},
|
2042
2142
|
],
|
2143
|
+
recommended: true,
|
2043
2144
|
},
|
2044
2145
|
fixable: 'code',
|
2045
2146
|
type: 'suggestion',
|
@@ -2085,7 +2186,7 @@ const rule$e = {
|
|
2085
2186
|
},
|
2086
2187
|
docs: {
|
2087
2188
|
description: `Requires all fields to be used at some level by siblings operations.`,
|
2088
|
-
category: '
|
2189
|
+
category: 'Schema',
|
2089
2190
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${RULE_NAME$1}.md`,
|
2090
2191
|
requiresSiblings: true,
|
2091
2192
|
requiresSchema: true,
|
@@ -2271,7 +2372,7 @@ const rule$f = {
|
|
2271
2372
|
meta: {
|
2272
2373
|
type: 'suggestion',
|
2273
2374
|
docs: {
|
2274
|
-
category: '
|
2375
|
+
category: 'Schema',
|
2275
2376
|
description: 'Require deletion date on `@deprecated` directive. Suggest removing deprecated things after deprecated date.',
|
2276
2377
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-deprecation-date.md',
|
2277
2378
|
examples: [
|
@@ -2374,7 +2475,7 @@ const rule$g = {
|
|
2374
2475
|
meta: {
|
2375
2476
|
docs: {
|
2376
2477
|
description: `Require all deprecation directives to specify a reason.`,
|
2377
|
-
category: '
|
2478
|
+
category: 'Schema',
|
2378
2479
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-deprecation-reason.md`,
|
2379
2480
|
recommended: true,
|
2380
2481
|
examples: [
|
@@ -2435,7 +2536,7 @@ const ALLOWED_KINDS$1 = [
|
|
2435
2536
|
const rule$h = {
|
2436
2537
|
meta: {
|
2437
2538
|
docs: {
|
2438
|
-
category: '
|
2539
|
+
category: 'Schema',
|
2439
2540
|
description: 'Enforce descriptions in your type definitions.',
|
2440
2541
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-description.md',
|
2441
2542
|
examples: [
|
@@ -2464,7 +2565,7 @@ const rule$h = {
|
|
2464
2565
|
`,
|
2465
2566
|
},
|
2466
2567
|
],
|
2467
|
-
|
2568
|
+
configOptions: [
|
2468
2569
|
{
|
2469
2570
|
types: true,
|
2470
2571
|
overrides: {
|
@@ -2535,7 +2636,7 @@ const rule$i = {
|
|
2535
2636
|
meta: {
|
2536
2637
|
type: 'suggestion',
|
2537
2638
|
docs: {
|
2538
|
-
category: '
|
2639
|
+
category: 'Schema',
|
2539
2640
|
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`.',
|
2540
2641
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${RULE_NAME$2}.md`,
|
2541
2642
|
requiresSchema: true,
|
@@ -2703,9 +2804,9 @@ const rule$j = {
|
|
2703
2804
|
meta: {
|
2704
2805
|
type: 'suggestion',
|
2705
2806
|
docs: {
|
2706
|
-
category: '
|
2707
|
-
description:
|
2708
|
-
url:
|
2807
|
+
category: 'Operations',
|
2808
|
+
description: 'Enforce selecting specific fields when they are available on the GraphQL type.',
|
2809
|
+
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-id-when-available.md',
|
2709
2810
|
requiresSchema: true,
|
2710
2811
|
requiresSiblings: true,
|
2711
2812
|
examples: [
|
@@ -2745,17 +2846,17 @@ const rule$j = {
|
|
2745
2846
|
`,
|
2746
2847
|
},
|
2747
2848
|
],
|
2849
|
+
recommended: true,
|
2748
2850
|
},
|
2749
2851
|
messages: {
|
2750
|
-
[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 }}".`,
|
2852
|
+
[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 }}".`,
|
2751
2853
|
},
|
2752
2854
|
schema: {
|
2753
2855
|
type: 'array',
|
2754
|
-
additionalItems: false,
|
2755
|
-
minItems: 0,
|
2756
2856
|
maxItems: 1,
|
2757
2857
|
items: {
|
2758
2858
|
type: 'object',
|
2859
|
+
additionalProperties: false,
|
2759
2860
|
properties: {
|
2760
2861
|
fieldName: {
|
2761
2862
|
type: 'string',
|
@@ -2838,9 +2939,9 @@ const rule$j = {
|
|
2838
2939
|
const rule$k = {
|
2839
2940
|
meta: {
|
2840
2941
|
docs: {
|
2841
|
-
category: '
|
2942
|
+
category: 'Operations',
|
2842
2943
|
description: `Limit the complexity of the GraphQL operations solely by their depth. Based on [graphql-depth-limit](https://github.com/stems/graphql-depth-limit).`,
|
2843
|
-
url:
|
2944
|
+
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/selection-set-depth.md',
|
2844
2945
|
requiresSiblings: true,
|
2845
2946
|
examples: [
|
2846
2947
|
{
|
@@ -2883,22 +2984,26 @@ const rule$k = {
|
|
2883
2984
|
`,
|
2884
2985
|
},
|
2885
2986
|
],
|
2987
|
+
recommended: true,
|
2988
|
+
configOptions: [{ maxDepth: 7 }],
|
2886
2989
|
},
|
2887
2990
|
type: 'suggestion',
|
2888
2991
|
schema: {
|
2889
2992
|
type: 'array',
|
2890
|
-
additionalItems: false,
|
2891
2993
|
minItems: 1,
|
2892
2994
|
maxItems: 1,
|
2893
2995
|
items: {
|
2894
2996
|
type: 'object',
|
2895
|
-
|
2997
|
+
additionalProperties: false,
|
2998
|
+
required: ['maxDepth'],
|
2896
2999
|
properties: {
|
2897
3000
|
maxDepth: {
|
2898
3001
|
type: 'number',
|
2899
3002
|
},
|
2900
3003
|
ignore: {
|
2901
3004
|
type: 'array',
|
3005
|
+
uniqueItems: true,
|
3006
|
+
minItems: 1,
|
2902
3007
|
items: {
|
2903
3008
|
type: 'string',
|
2904
3009
|
},
|
@@ -2962,7 +3067,7 @@ const rule$l = {
|
|
2962
3067
|
type: 'suggestion',
|
2963
3068
|
docs: {
|
2964
3069
|
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.',
|
2965
|
-
category: '
|
3070
|
+
category: 'Schema',
|
2966
3071
|
recommended: true,
|
2967
3072
|
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/strict-id-in-types.md',
|
2968
3073
|
examples: [
|
@@ -3022,13 +3127,15 @@ const rule$l = {
|
|
3022
3127
|
],
|
3023
3128
|
},
|
3024
3129
|
schema: {
|
3025
|
-
$schema: 'http://json-schema.org/draft-04/schema#',
|
3026
3130
|
type: 'array',
|
3131
|
+
maxItems: 1,
|
3027
3132
|
items: {
|
3028
3133
|
type: 'object',
|
3134
|
+
additionalProperties: false,
|
3029
3135
|
properties: {
|
3030
3136
|
acceptedIdNames: {
|
3031
3137
|
type: 'array',
|
3138
|
+
uniqueItems: true,
|
3032
3139
|
items: {
|
3033
3140
|
type: 'string',
|
3034
3141
|
},
|
@@ -3036,6 +3143,7 @@ const rule$l = {
|
|
3036
3143
|
},
|
3037
3144
|
acceptedIdTypes: {
|
3038
3145
|
type: 'array',
|
3146
|
+
uniqueItems: true,
|
3039
3147
|
items: {
|
3040
3148
|
type: 'string',
|
3041
3149
|
},
|
@@ -3046,19 +3154,21 @@ const rule$l = {
|
|
3046
3154
|
properties: {
|
3047
3155
|
types: {
|
3048
3156
|
type: 'array',
|
3157
|
+
uniqueItems: true,
|
3158
|
+
minItems: 1,
|
3049
3159
|
description: 'This is used to exclude types with names that match one of the specified values.',
|
3050
3160
|
items: {
|
3051
3161
|
type: 'string',
|
3052
3162
|
},
|
3053
|
-
default: [],
|
3054
3163
|
},
|
3055
3164
|
suffixes: {
|
3056
3165
|
type: 'array',
|
3166
|
+
uniqueItems: true,
|
3167
|
+
minItems: 1,
|
3057
3168
|
description: 'This is used to exclude types with names with suffixes that match one of the specified values.',
|
3058
3169
|
items: {
|
3059
3170
|
type: 'string',
|
3060
3171
|
},
|
3061
|
-
default: [],
|
3062
3172
|
},
|
3063
3173
|
},
|
3064
3174
|
},
|
@@ -3138,7 +3248,7 @@ const rule$m = {
|
|
3138
3248
|
meta: {
|
3139
3249
|
type: 'suggestion',
|
3140
3250
|
docs: {
|
3141
|
-
category: '
|
3251
|
+
category: 'Operations',
|
3142
3252
|
description: `Enforce unique fragment names across your project.`,
|
3143
3253
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${RULE_NAME$3}.md`,
|
3144
3254
|
requiresSiblings: true,
|
@@ -3197,7 +3307,7 @@ const rule$n = {
|
|
3197
3307
|
meta: {
|
3198
3308
|
type: 'suggestion',
|
3199
3309
|
docs: {
|
3200
|
-
category: '
|
3310
|
+
category: 'Operations',
|
3201
3311
|
description: `Enforce unique operation names across your project.`,
|
3202
3312
|
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/${RULE_NAME$4}.md`,
|
3203
3313
|
requiresSiblings: true,
|