Skip to content

Commit acbbc08

Browse files
saihajIvanGoncharov
authored andcommitted
temp
1 parent 6b51feb commit acbbc08

File tree

10 files changed

+33
-32
lines changed

10 files changed

+33
-32
lines changed

.eslintrc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ overrides:
450450
'@typescript-eslint/ban-ts-comment': [error, { 'ts-expect-error': false }]
451451
'@typescript-eslint/ban-tslint-comment': error
452452
'@typescript-eslint/ban-types': error
453-
'@typescript-eslint/class-literal-property-style': off # TODO enable after TS conversion
453+
'@typescript-eslint/class-literal-property-style': error
454454
'@typescript-eslint/consistent-indexed-object-style': off # TODO enable after TS conversion
455455
'@typescript-eslint/consistent-type-assertions':
456456
[error, { assertionStyle: as, objectLiteralTypeAssertions: never }]
@@ -472,7 +472,7 @@ overrides:
472472
'@typescript-eslint/no-extraneous-class': off # TODO consider
473473
'@typescript-eslint/no-floating-promises': error
474474
'@typescript-eslint/no-for-in-array': error
475-
'@typescript-eslint/no-implicit-any-catch': off # TODO: Enable after TS convertion
475+
'@typescript-eslint/no-implicit-any-catch': error
476476
'@typescript-eslint/no-implied-eval': error
477477
'@typescript-eslint/no-inferrable-types':
478478
[error, { ignoreParameters: true, ignoreProperties: true }]
@@ -500,7 +500,7 @@ overrides:
500500
'@typescript-eslint/non-nullable-type-assertion-style': error
501501
'@typescript-eslint/prefer-as-const': off # TODO consider
502502
'@typescript-eslint/prefer-enum-initializers': off # TODO consider
503-
'@typescript-eslint/prefer-for-of': off # TODO switch to error after TS migration
503+
'@typescript-eslint/prefer-for-of': error
504504
'@typescript-eslint/prefer-function-type': error
505505
'@typescript-eslint/prefer-includes': off # TODO switch to error after IE11 drop
506506
'@typescript-eslint/prefer-literal-enum-member': error

src/__tests__/starWarsSchema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ const { nodeInterface, nodeField } = nodeDefinitions(
128128
* name: String
129129
* }
130130
*/
131-
const shipType = new GraphQLObjectType({
131+
const shipType: GraphQLObjectType = new GraphQLObjectType({
132132
name: 'Ship',
133133
description: 'A ship in the Star Wars saga',
134134
interfaces: [nodeInterface],
@@ -171,7 +171,7 @@ const { connectionType: shipConnection } = connectionDefinitions({
171171
* ships: ShipConnection
172172
* }
173173
*/
174-
const factionType = new GraphQLObjectType({
174+
const factionType: GraphQLObjectType = new GraphQLObjectType({
175175
name: 'Faction',
176176
description: 'A faction in the Star Wars saga',
177177
interfaces: [nodeInterface],

src/connection/connection.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ interface GraphQLConnectionDefinitions {
9090

9191
function resolveMaybeThunk<T>(thingOrThunk: Thunk<T>): T {
9292
return typeof thingOrThunk === 'function'
93-
? // $FlowFixMe[incompatible-use] - if it's a function, we assume a thunk without arguments
93+
? // @ts-expect-error - if it's a function, we assume a thunk without arguments
9494
thingOrThunk()
9595
: thingOrThunk;
9696
}
@@ -107,19 +107,21 @@ export function connectionDefinitions(
107107
const edgeType = new GraphQLObjectType({
108108
name: name + 'Edge',
109109
description: 'An edge in a connection.',
110-
fields: () => ({
111-
node: {
112-
type: nodeType,
113-
resolve: config.resolveNode,
114-
description: 'The item at the end of the edge',
115-
},
116-
cursor: {
117-
type: new GraphQLNonNull(GraphQLString),
118-
resolve: config.resolveCursor,
119-
description: 'A cursor for use in pagination',
120-
},
121-
...resolveMaybeThunk(config.edgeFields ?? {}),
122-
}),
110+
fields(): GraphQLFieldConfigMap<unknown, unknown> {
111+
return {
112+
node: {
113+
type: nodeType,
114+
resolve: config.resolveNode,
115+
description: 'The item at the end of the edge',
116+
},
117+
cursor: {
118+
type: new GraphQLNonNull(GraphQLString),
119+
resolve: config.resolveCursor,
120+
description: 'A cursor for use in pagination',
121+
},
122+
...resolveMaybeThunk(config.edgeFields ?? {}),
123+
};
124+
},
123125
});
124126

125127
const connectionType = new GraphQLObjectType({

src/mutation/mutation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type MutationFn = (object: any, ctx: any, info: GraphQLResolveInfo) => unknown;
1717

1818
function resolveMaybeThunk<T>(thingOrThunk: Thunk<T>): T {
1919
return typeof thingOrThunk === 'function'
20-
? // $FlowFixMe[incompatible-use] - if it's a function, we assume a thunk without arguments
20+
? // @ts-expect-error - if it's a function, we assume a thunk without arguments
2121
thingOrThunk()
2222
: thingOrThunk;
2323
}
@@ -95,7 +95,7 @@ export function mutationWithClientMutationId(
9595

9696
function injectClientMutationId(data: unknown) {
9797
if (typeof data === 'object' && data !== null) {
98-
// $FlowFixMe[cannot-write] It's bad idea to mutate data but we need to pass clientMutationId somehow. Maybe in future we figure out better solution satisfying all our test cases.
98+
// @ts-expect-error FIXME It's bad idea to mutate data but we need to pass clientMutationId somehow. Maybe in future we figure out better solution satisfying all our test cases.
9999
data.clientMutationId = clientMutationId;
100100
}
101101

src/mutation/type.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module 'graphql/jsutils/isPromise';

src/node/__tests__/global-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const { nodeField, nodeInterface } = nodeDefinitions(
7272
},
7373
);
7474

75-
const userType = new GraphQLObjectType({
75+
const userType: GraphQLObjectType = new GraphQLObjectType({
7676
name: 'User',
7777
interfaces: [nodeInterface],
7878
fields: () => ({
@@ -83,7 +83,7 @@ const userType = new GraphQLObjectType({
8383
}),
8484
});
8585

86-
const photoType = new GraphQLObjectType({
86+
const photoType: GraphQLObjectType = new GraphQLObjectType({
8787
name: 'Photo',
8888
interfaces: [nodeInterface],
8989
fields: () => ({
@@ -94,7 +94,7 @@ const photoType = new GraphQLObjectType({
9494
}),
9595
});
9696

97-
const postType = new GraphQLObjectType({
97+
const postType: GraphQLObjectType = new GraphQLObjectType({
9898
name: 'Post',
9999
interfaces: [nodeInterface],
100100
fields: () => ({

src/node/__tests__/node-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const { nodeField, nodesField, nodeInterface } = nodeDefinitions(
5757
},
5858
);
5959

60-
const userType = new GraphQLObjectType({
60+
const userType: GraphQLObjectType = new GraphQLObjectType({
6161
name: 'User',
6262
interfaces: [nodeInterface],
6363
fields: () => ({
@@ -70,7 +70,7 @@ const userType = new GraphQLObjectType({
7070
}),
7171
});
7272

73-
const photoType = new GraphQLObjectType({
73+
const photoType: GraphQLObjectType = new GraphQLObjectType({
7474
name: 'Photo',
7575
interfaces: [nodeInterface],
7676
fields: () => ({

src/node/__tests__/nodeAsync-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const { nodeField, nodeInterface } = nodeDefinitions(
2828
() => userType,
2929
);
3030

31-
const userType = new GraphQLObjectType({
31+
const userType: GraphQLObjectType = new GraphQLObjectType({
3232
name: 'User',
3333
interfaces: [nodeInterface],
3434
fields: () => ({

src/utils/base64.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ function fromBase64Char(base64Char: string | undefined): number {
100100
function stringToUTF8Array(input: string): Array<number> {
101101
const result = [];
102102
for (const utfChar of input) {
103-
const code = utfChar.codePointAt(0);
103+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
104+
const code = utfChar.codePointAt(0)!;
104105
if (code < 0x80) {
105106
result.push(code);
106107
} else if (code < 0x800) {

tsconfig.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
"module": "commonjs",
55
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"],
66
"target": "es2019",
7-
"noImplicitAny": false,
8-
"noImplicitThis": false,
9-
"strictNullChecks": false,
10-
"strictFunctionTypes": false,
7+
"strict": true,
118
"noEmit": true,
129
"isolatedModules": true,
1310
"forceConsistentCasingInFileNames": true

0 commit comments

Comments
 (0)