Skip to content

Commit 5fcbf33

Browse files
renovate[bot]renovate-botdotansimha
authored
chore(deps): update dependency typescript to v4.2.4 (#332)
* chore(deps): update dependency typescript to v4.2.4 * fix ts issues * types fixes * fixes Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Dotan Simha <[email protected]>
1 parent 3ba4866 commit 5fcbf33

File tree

9 files changed

+47
-42
lines changed

9 files changed

+47
-42
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"@types/jest": "26.0.23",
4747
"ts-jest": "26.5.6",
4848
"rimraf": "3.0.2",
49-
"typescript": "4.1.5",
49+
"typescript": "4.2.4",
5050
"jest": "26.6.3"
5151
},
5252
"resolutions": {

packages/plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"bob-the-bundler": "1.2.0",
3333
"graphql-config": "3.2.0",
3434
"graphql": "15.5.0",
35-
"typescript": "4.1.5"
35+
"typescript": "4.2.4"
3636
},
3737
"peerDependencies": {
3838
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0"

packages/plugin/src/rules/graphql-js-validation.ts

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -56,160 +56,161 @@ const validationToRule = (
5656
};
5757
};
5858

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', {
6162
docs: {
6263
description: `A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.`,
6364
},
6465
}),
65-
...validationToRule('fields-on-correct-type', 'FieldsOnCorrectType', {
66+
validationToRule('fields-on-correct-type', 'FieldsOnCorrectType', {
6667
docs: {
6768
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.`,
6869
},
6970
}),
70-
...validationToRule('fragments-on-composite-type', 'FragmentsOnCompositeTypes', {
71+
validationToRule('fragments-on-composite-type', 'FragmentsOnCompositeTypes', {
7172
docs: {
7273
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.`,
7374
},
7475
}),
75-
...validationToRule('known-argument-names', 'KnownArgumentNames', {
76+
validationToRule('known-argument-names', 'KnownArgumentNames', {
7677
docs: {
7778
description: `A GraphQL field is only valid if all supplied arguments are defined by that field.`,
7879
},
7980
}),
80-
...validationToRule('known-directives', 'KnownDirectives', {
81+
validationToRule('known-directives', 'KnownDirectives', {
8182
docs: {
8283
description: `A GraphQL document is only valid if all \`@directives\` are known by the schema and legally positioned.`,
8384
},
8485
}),
85-
...validationToRule('known-fragment-names', 'KnownFragmentNames', {
86+
validationToRule('known-fragment-names', 'KnownFragmentNames', {
8687
docs: {
8788
description: `A GraphQL document is only valid if all \`...Fragment\` fragment spreads refer to fragments defined in the same document.`,
8889
},
8990
}),
90-
...validationToRule('known-type-names', 'KnownTypeNames', {
91+
validationToRule('known-type-names', 'KnownTypeNames', {
9192
docs: {
9293
description: `A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.`,
9394
},
9495
}),
95-
...validationToRule('lone-anonymous-operation', 'LoneAnonymousOperation', {
96+
validationToRule('lone-anonymous-operation', 'LoneAnonymousOperation', {
9697
docs: {
9798
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.`,
9899
},
99100
}),
100-
...validationToRule('lone-schema-definition', 'LoneSchemaDefinition', {
101+
validationToRule('lone-schema-definition', 'LoneSchemaDefinition', {
101102
docs: {
102103
description: `A GraphQL document is only valid if it contains only one schema definition.`,
103104
},
104105
}),
105-
...validationToRule('no-fragment-cycles', 'NoFragmentCycles', {
106+
validationToRule('no-fragment-cycles', 'NoFragmentCycles', {
106107
docs: {
107108
description: `A GraphQL fragment is only valid when it does not have cycles in fragments usage.`,
108109
},
109110
}),
110-
...validationToRule('no-undefined-variables', 'NoUndefinedVariables', {
111+
validationToRule('no-undefined-variables', 'NoUndefinedVariables', {
111112
docs: {
112113
description: `A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.`,
113114
},
114115
}),
115-
...validationToRule('no-unused-fragments', 'NoUnusedFragments', {
116+
validationToRule('no-unused-fragments', 'NoUnusedFragments', {
116117
docs: {
117118
description: `A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.`,
118119
},
119120
}),
120-
...validationToRule('no-unused-variables', 'NoUnusedVariables', {
121+
validationToRule('no-unused-variables', 'NoUnusedVariables', {
121122
docs: {
122123
description: `A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.`,
123124
},
124125
}),
125-
...validationToRule('overlapping-fields-can-be-merged', 'OverlappingFieldsCanBeMerged', {
126+
validationToRule('overlapping-fields-can-be-merged', 'OverlappingFieldsCanBeMerged', {
126127
docs: {
127128
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.`,
128129
},
129130
}),
130-
...validationToRule('possible-fragment-spread', 'PossibleFragmentSpreads', {
131+
validationToRule('possible-fragment-spread', 'PossibleFragmentSpreads', {
131132
docs: {
132133
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.`,
133134
},
134135
}),
135-
...validationToRule('possible-type-extension', 'PossibleTypeExtensions', {
136+
validationToRule('possible-type-extension', 'PossibleTypeExtensions', {
136137
docs: {
137138
description: `A type extension is only valid if the type is defined and has the same kind.`,
138139
},
139140
}),
140-
...validationToRule('provided-required-arguments', 'ProvidedRequiredArguments', {
141+
validationToRule('provided-required-arguments', 'ProvidedRequiredArguments', {
141142
docs: {
142143
description: `A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.`,
143144
},
144145
}),
145-
...validationToRule('scalar-leafs', 'ScalarLeafs', {
146+
validationToRule('scalar-leafs', 'ScalarLeafs', {
146147
docs: {
147148
description: `A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.`,
148149
},
149150
}),
150-
...validationToRule('one-field-subscriptions', 'SingleFieldSubscriptions', {
151+
validationToRule('one-field-subscriptions', 'SingleFieldSubscriptions', {
151152
docs: {
152153
description: `A GraphQL subscription is valid only if it contains a single root field.`,
153154
},
154155
}),
155-
...validationToRule('unique-argument-names', 'UniqueArgumentNames', {
156+
validationToRule('unique-argument-names', 'UniqueArgumentNames', {
156157
docs: {
157158
description: `A GraphQL field or directive is only valid if all supplied arguments are uniquely named.`,
158159
},
159160
}),
160-
...validationToRule('unique-directive-names', 'UniqueDirectiveNames', {
161+
validationToRule('unique-directive-names', 'UniqueDirectiveNames', {
161162
docs: {
162163
description: `A GraphQL document is only valid if all defined directives have unique names.`,
163164
},
164165
}),
165-
...validationToRule('unique-directive-names-per-location', 'UniqueDirectivesPerLocation', {
166+
validationToRule('unique-directive-names-per-location', 'UniqueDirectivesPerLocation', {
166167
docs: {
167168
description: `A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.`,
168169
},
169170
}),
170-
...validationToRule('unique-enum-value-names', 'UniqueEnumValueNames', {
171+
validationToRule('unique-enum-value-names', 'UniqueEnumValueNames', {
171172
docs: {
172173
description: `A GraphQL enum type is only valid if all its values are uniquely named.`,
173174
},
174175
}),
175-
...validationToRule('unique-field-definition-names', 'UniqueFieldDefinitionNames', {
176+
validationToRule('unique-field-definition-names', 'UniqueFieldDefinitionNames', {
176177
docs: {
177178
description: `A GraphQL complex type is only valid if all its fields are uniquely named.`,
178179
},
179180
}),
180-
...validationToRule('unique-input-field-names', 'UniqueInputFieldNames', {
181+
validationToRule('unique-input-field-names', 'UniqueInputFieldNames', {
181182
docs: {
182183
description: `A GraphQL input object value is only valid if all supplied fields are uniquely named.`,
183184
},
184185
}),
185-
...validationToRule('unique-operation-types', 'UniqueOperationTypes', {
186+
validationToRule('unique-operation-types', 'UniqueOperationTypes', {
186187
docs: {
187188
description: `A GraphQL document is only valid if it has only one type per operation.`,
188189
},
189190
}),
190-
...validationToRule('unique-type-names', 'UniqueTypeNames', {
191+
validationToRule('unique-type-names', 'UniqueTypeNames', {
191192
docs: {
192193
description: `A GraphQL document is only valid if all defined types have unique names.`,
193194
},
194195
}),
195-
...validationToRule('unique-variable-names', 'UniqueVariableNames', {
196+
validationToRule('unique-variable-names', 'UniqueVariableNames', {
196197
docs: {
197198
description: `A GraphQL operation is only valid if all its variables are uniquely named.`,
198199
},
199200
}),
200-
...validationToRule('value-literals-of-correct-type', 'ValuesOfCorrectType', {
201+
validationToRule('value-literals-of-correct-type', 'ValuesOfCorrectType', {
201202
docs: {
202203
description: `A GraphQL document is only valid if all value literals are of the type expected at their position.`,
203204
},
204205
}),
205-
...validationToRule('variables-are-input-types', 'VariablesAreInputTypes', {
206+
validationToRule('variables-are-input-types', 'VariablesAreInputTypes', {
206207
docs: {
207208
description: `A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).`,
208209
},
209210
}),
210-
...validationToRule('variables-in-allowed-position', 'VariablesInAllowedPosition', {
211+
validationToRule('variables-in-allowed-position', 'VariablesInAllowedPosition', {
211212
docs: {
212213
description: `Variables passed to field arguments conform to type.`,
213214
},
214-
}),
215-
};
215+
})
216+
) as Record<string, GraphQLESLintRule>;

packages/plugin/src/rules/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ import noHashtagDescription from './no-hashtag-description';
1717
import selectionSetDepth from './selection-set-depth';
1818
import avoidDuplicateFields from './avoid-duplicate-fields';
1919
import strictIdInTypes from './strict-id-in-types';
20-
import { GraphQLESLintRule } from '../types';
2120
import { GRAPHQL_JS_VALIDATIONS } from './graphql-js-validation';
2221

23-
export const rules: Record<string, GraphQLESLintRule> = {
22+
export const rules = {
2423
'no-unreachable-types': noUnreachableTypes,
2524
'no-deprecated': noDeprecated,
2625
'unique-fragment-name': uniqueFragmentName,

packages/plugin/src/rules/naming-convention.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const schemaOption = {
8787
oneOf: [{ $ref: '#/definitions/asString' }, { $ref: '#/definitions/asObject' }],
8888
};
8989

90-
interface PropertySchema {
90+
export interface PropertySchema {
9191
style?: ValidNaming;
9292
suffix?: string;
9393
prefix?: string;

packages/plugin/src/rules/strict-id-in-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Kind, ObjectTypeDefinitionNode } from 'graphql';
22
import { GraphQLESTreeNode } from '../estree-parser';
33
import { GraphQLESLintRule } from '../types';
44

5-
interface ExceptionRule {
5+
export interface ExceptionRule {
66
types?: string[];
77
suffixes?: string[];
88
}

packages/plugin/src/testkit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class GraphQLRuleTester extends require('eslint').RuleTester {
3737

3838
runGraphQLTests<Config>(
3939
name: string,
40-
rule: GraphQLESLintRule<Config>,
40+
rule: any,
4141
tests: {
4242
valid?: Array<string | GraphQLValidTestCase<Config>>;
4343
invalid?: Array<string | GraphQLInvalidTestCase<Config>>;

packages/plugin/tests/executable-definitions.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const WITH_SCHEMA = {
2525

2626
const ruleTester = new GraphQLRuleTester();
2727

28-
ruleTester.runGraphQLTests('executable-definitions', GRAPHQL_JS_VALIDATIONS['executable-definitions'], {
28+
ruleTester.runGraphQLTests('executable-definitions', GRAPHQL_JS_VALIDATIONS['executable-definitions'] as any, {
2929
valid: [
3030
{
3131
...WITH_SCHEMA,

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6590,6 +6590,11 @@ [email protected]:
65906590
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72"
65916591
integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==
65926592

6593+
6594+
version "4.2.4"
6595+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961"
6596+
integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==
6597+
65936598
unbox-primitive@^1.0.0:
65946599
version "1.0.1"
65956600
resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471"

0 commit comments

Comments
 (0)