@@ -56,160 +56,161 @@ const validationToRule = (
56
56
} ;
57
57
} ;
58
58
59
- export const GRAPHQL_JS_VALIDATIONS : Record < string , GraphQLESLintRule > = {
60
- ...validationToRule ( 'executable-definitions' , 'ExecutableDefinitions' , {
59
+ export const GRAPHQL_JS_VALIDATIONS = Object . assign (
60
+ { } ,
61
+ validationToRule ( 'executable-definitions' , 'ExecutableDefinitions' , {
61
62
docs : {
62
63
description : `A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.` ,
63
64
} ,
64
65
} ) ,
65
- ... validationToRule ( 'fields-on-correct-type' , 'FieldsOnCorrectType' , {
66
+ validationToRule ( 'fields-on-correct-type' , 'FieldsOnCorrectType' , {
66
67
docs : {
67
68
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.` ,
68
69
} ,
69
70
} ) ,
70
- ... validationToRule ( 'fragments-on-composite-type' , 'FragmentsOnCompositeTypes' , {
71
+ validationToRule ( 'fragments-on-composite-type' , 'FragmentsOnCompositeTypes' , {
71
72
docs : {
72
73
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.` ,
73
74
} ,
74
75
} ) ,
75
- ... validationToRule ( 'known-argument-names' , 'KnownArgumentNames' , {
76
+ validationToRule ( 'known-argument-names' , 'KnownArgumentNames' , {
76
77
docs : {
77
78
description : `A GraphQL field is only valid if all supplied arguments are defined by that field.` ,
78
79
} ,
79
80
} ) ,
80
- ... validationToRule ( 'known-directives' , 'KnownDirectives' , {
81
+ validationToRule ( 'known-directives' , 'KnownDirectives' , {
81
82
docs : {
82
83
description : `A GraphQL document is only valid if all \`@directives\` are known by the schema and legally positioned.` ,
83
84
} ,
84
85
} ) ,
85
- ... validationToRule ( 'known-fragment-names' , 'KnownFragmentNames' , {
86
+ validationToRule ( 'known-fragment-names' , 'KnownFragmentNames' , {
86
87
docs : {
87
88
description : `A GraphQL document is only valid if all \`...Fragment\` fragment spreads refer to fragments defined in the same document.` ,
88
89
} ,
89
90
} ) ,
90
- ... validationToRule ( 'known-type-names' , 'KnownTypeNames' , {
91
+ validationToRule ( 'known-type-names' , 'KnownTypeNames' , {
91
92
docs : {
92
93
description : `A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.` ,
93
94
} ,
94
95
} ) ,
95
- ... validationToRule ( 'lone-anonymous-operation' , 'LoneAnonymousOperation' , {
96
+ validationToRule ( 'lone-anonymous-operation' , 'LoneAnonymousOperation' , {
96
97
docs : {
97
98
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.` ,
98
99
} ,
99
100
} ) ,
100
- ... validationToRule ( 'lone-schema-definition' , 'LoneSchemaDefinition' , {
101
+ validationToRule ( 'lone-schema-definition' , 'LoneSchemaDefinition' , {
101
102
docs : {
102
103
description : `A GraphQL document is only valid if it contains only one schema definition.` ,
103
104
} ,
104
105
} ) ,
105
- ... validationToRule ( 'no-fragment-cycles' , 'NoFragmentCycles' , {
106
+ validationToRule ( 'no-fragment-cycles' , 'NoFragmentCycles' , {
106
107
docs : {
107
108
description : `A GraphQL fragment is only valid when it does not have cycles in fragments usage.` ,
108
109
} ,
109
110
} ) ,
110
- ... validationToRule ( 'no-undefined-variables' , 'NoUndefinedVariables' , {
111
+ validationToRule ( 'no-undefined-variables' , 'NoUndefinedVariables' , {
111
112
docs : {
112
113
description : `A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.` ,
113
114
} ,
114
115
} ) ,
115
- ... validationToRule ( 'no-unused-fragments' , 'NoUnusedFragments' , {
116
+ validationToRule ( 'no-unused-fragments' , 'NoUnusedFragments' , {
116
117
docs : {
117
118
description : `A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.` ,
118
119
} ,
119
120
} ) ,
120
- ... validationToRule ( 'no-unused-variables' , 'NoUnusedVariables' , {
121
+ validationToRule ( 'no-unused-variables' , 'NoUnusedVariables' , {
121
122
docs : {
122
123
description : `A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.` ,
123
124
} ,
124
125
} ) ,
125
- ... validationToRule ( 'overlapping-fields-can-be-merged' , 'OverlappingFieldsCanBeMerged' , {
126
+ validationToRule ( 'overlapping-fields-can-be-merged' , 'OverlappingFieldsCanBeMerged' , {
126
127
docs : {
127
128
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.` ,
128
129
} ,
129
130
} ) ,
130
- ... validationToRule ( 'possible-fragment-spread' , 'PossibleFragmentSpreads' , {
131
+ validationToRule ( 'possible-fragment-spread' , 'PossibleFragmentSpreads' , {
131
132
docs : {
132
133
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.` ,
133
134
} ,
134
135
} ) ,
135
- ... validationToRule ( 'possible-type-extension' , 'PossibleTypeExtensions' , {
136
+ validationToRule ( 'possible-type-extension' , 'PossibleTypeExtensions' , {
136
137
docs : {
137
138
description : `A type extension is only valid if the type is defined and has the same kind.` ,
138
139
} ,
139
140
} ) ,
140
- ... validationToRule ( 'provided-required-arguments' , 'ProvidedRequiredArguments' , {
141
+ validationToRule ( 'provided-required-arguments' , 'ProvidedRequiredArguments' , {
141
142
docs : {
142
143
description : `A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.` ,
143
144
} ,
144
145
} ) ,
145
- ... validationToRule ( 'scalar-leafs' , 'ScalarLeafs' , {
146
+ validationToRule ( 'scalar-leafs' , 'ScalarLeafs' , {
146
147
docs : {
147
148
description : `A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.` ,
148
149
} ,
149
150
} ) ,
150
- ... validationToRule ( 'one-field-subscriptions' , 'SingleFieldSubscriptions' , {
151
+ validationToRule ( 'one-field-subscriptions' , 'SingleFieldSubscriptions' , {
151
152
docs : {
152
153
description : `A GraphQL subscription is valid only if it contains a single root field.` ,
153
154
} ,
154
155
} ) ,
155
- ... validationToRule ( 'unique-argument-names' , 'UniqueArgumentNames' , {
156
+ validationToRule ( 'unique-argument-names' , 'UniqueArgumentNames' , {
156
157
docs : {
157
158
description : `A GraphQL field or directive is only valid if all supplied arguments are uniquely named.` ,
158
159
} ,
159
160
} ) ,
160
- ... validationToRule ( 'unique-directive-names' , 'UniqueDirectiveNames' , {
161
+ validationToRule ( 'unique-directive-names' , 'UniqueDirectiveNames' , {
161
162
docs : {
162
163
description : `A GraphQL document is only valid if all defined directives have unique names.` ,
163
164
} ,
164
165
} ) ,
165
- ... validationToRule ( 'unique-directive-names-per-location' , 'UniqueDirectivesPerLocation' , {
166
+ validationToRule ( 'unique-directive-names-per-location' , 'UniqueDirectivesPerLocation' , {
166
167
docs : {
167
168
description : `A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.` ,
168
169
} ,
169
170
} ) ,
170
- ... validationToRule ( 'unique-enum-value-names' , 'UniqueEnumValueNames' , {
171
+ validationToRule ( 'unique-enum-value-names' , 'UniqueEnumValueNames' , {
171
172
docs : {
172
173
description : `A GraphQL enum type is only valid if all its values are uniquely named.` ,
173
174
} ,
174
175
} ) ,
175
- ... validationToRule ( 'unique-field-definition-names' , 'UniqueFieldDefinitionNames' , {
176
+ validationToRule ( 'unique-field-definition-names' , 'UniqueFieldDefinitionNames' , {
176
177
docs : {
177
178
description : `A GraphQL complex type is only valid if all its fields are uniquely named.` ,
178
179
} ,
179
180
} ) ,
180
- ... validationToRule ( 'unique-input-field-names' , 'UniqueInputFieldNames' , {
181
+ validationToRule ( 'unique-input-field-names' , 'UniqueInputFieldNames' , {
181
182
docs : {
182
183
description : `A GraphQL input object value is only valid if all supplied fields are uniquely named.` ,
183
184
} ,
184
185
} ) ,
185
- ... validationToRule ( 'unique-operation-types' , 'UniqueOperationTypes' , {
186
+ validationToRule ( 'unique-operation-types' , 'UniqueOperationTypes' , {
186
187
docs : {
187
188
description : `A GraphQL document is only valid if it has only one type per operation.` ,
188
189
} ,
189
190
} ) ,
190
- ... validationToRule ( 'unique-type-names' , 'UniqueTypeNames' , {
191
+ validationToRule ( 'unique-type-names' , 'UniqueTypeNames' , {
191
192
docs : {
192
193
description : `A GraphQL document is only valid if all defined types have unique names.` ,
193
194
} ,
194
195
} ) ,
195
- ... validationToRule ( 'unique-variable-names' , 'UniqueVariableNames' , {
196
+ validationToRule ( 'unique-variable-names' , 'UniqueVariableNames' , {
196
197
docs : {
197
198
description : `A GraphQL operation is only valid if all its variables are uniquely named.` ,
198
199
} ,
199
200
} ) ,
200
- ... validationToRule ( 'value-literals-of-correct-type' , 'ValuesOfCorrectType' , {
201
+ validationToRule ( 'value-literals-of-correct-type' , 'ValuesOfCorrectType' , {
201
202
docs : {
202
203
description : `A GraphQL document is only valid if all value literals are of the type expected at their position.` ,
203
204
} ,
204
205
} ) ,
205
- ... validationToRule ( 'variables-are-input-types' , 'VariablesAreInputTypes' , {
206
+ validationToRule ( 'variables-are-input-types' , 'VariablesAreInputTypes' , {
206
207
docs : {
207
208
description : `A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).` ,
208
209
} ,
209
210
} ) ,
210
- ... validationToRule ( 'variables-in-allowed-position' , 'VariablesInAllowedPosition' , {
211
+ validationToRule ( 'variables-in-allowed-position' , 'VariablesInAllowedPosition' , {
211
212
docs : {
212
213
description : `Variables passed to field arguments conform to type.` ,
213
214
} ,
214
- } ) ,
215
- } ;
215
+ } )
216
+ ) as Record < string , GraphQLESLintRule > ;
0 commit comments