diff --git a/.eslintrc.yml b/.eslintrc.yml index f19ddd4055b..17f9c63f266 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -457,22 +457,21 @@ overrides: '@typescript-eslint/await-thenable': error '@typescript-eslint/ban-ts-comment': [error, { 'ts-expect-error': false }] '@typescript-eslint/ban-tslint-comment': error - '@typescript-eslint/ban-types': error + '@typescript-eslint/ban-types': off # TODO temporarily disabled '@typescript-eslint/class-literal-property-style': off # TODO enable after TS conversion '@typescript-eslint/consistent-indexed-object-style': off # TODO enable after TS conversion - '@typescript-eslint/consistent-type-assertions': - [error, { assertionStyle: as, objectLiteralTypeAssertions: never }] - '@typescript-eslint/consistent-type-definitions': off # TODO consider - '@typescript-eslint/consistent-type-imports': off # TODO enable after TS conversion + '@typescript-eslint/consistent-type-assertions': off # TODO temporarily disable + '@typescript-eslint/consistent-type-definitions': error + '@typescript-eslint/consistent-type-imports': error '@typescript-eslint/explicit-function-return-type': off # TODO consider '@typescript-eslint/explicit-member-accessibility': off # TODO consider '@typescript-eslint/explicit-module-boundary-types': off # TODO consider - '@typescript-eslint/member-ordering': off # TODO consider + '@typescript-eslint/member-ordering': error '@typescript-eslint/method-signature-style': error '@typescript-eslint/naming-convention': off # TODO consider '@typescript-eslint/no-base-to-string': error '@typescript-eslint/no-confusing-non-null-assertion': error - '@typescript-eslint/no-confusing-void-expression': error + '@typescript-eslint/no-confusing-void-expression': off # TODO enable with ignoreArrowShorthand '@typescript-eslint/no-dynamic-delete': off '@typescript-eslint/no-empty-interface': error '@typescript-eslint/no-explicit-any': off # TODO error @@ -494,21 +493,21 @@ overrides: '@typescript-eslint/no-require-imports': error '@typescript-eslint/no-this-alias': error '@typescript-eslint/no-type-alias': off # TODO consider - '@typescript-eslint/no-unnecessary-boolean-literal-compare': error - '@typescript-eslint/no-unnecessary-condition': error + '@typescript-eslint/no-unnecessary-boolean-literal-compare': off # FIXME requires on strictNullChecks + '@typescript-eslint/no-unnecessary-condition': off # TODO temporary disable '@typescript-eslint/no-unnecessary-qualifier': error '@typescript-eslint/no-unnecessary-type-arguments': error '@typescript-eslint/no-unnecessary-type-assertion': error - '@typescript-eslint/no-unnecessary-type-constraint': off # TODO consider + '@typescript-eslint/no-unnecessary-type-constraint': error '@typescript-eslint/no-unsafe-argument': off # TODO consider '@typescript-eslint/no-unsafe-assignment': off # TODO consider '@typescript-eslint/no-unsafe-call': off # TODO consider '@typescript-eslint/no-unsafe-member-access': off # TODO consider '@typescript-eslint/no-unsafe-return': off # TODO consider '@typescript-eslint/no-var-requires': error - '@typescript-eslint/non-nullable-type-assertion-style': error - '@typescript-eslint/prefer-as-const': off # TODO consider - '@typescript-eslint/prefer-enum-initializers': off # TODO consider + '@typescript-eslint/non-nullable-type-assertion-style': off #TODO temporarily disabled + '@typescript-eslint/prefer-as-const': error + '@typescript-eslint/prefer-enum-initializers': error '@typescript-eslint/prefer-for-of': off # TODO switch to error after TS migration '@typescript-eslint/prefer-function-type': error '@typescript-eslint/prefer-includes': off # TODO switch to error after IE11 drop @@ -524,12 +523,11 @@ overrides: '@typescript-eslint/prefer-string-starts-ends-with': off # TODO switch to error after IE11 drop '@typescript-eslint/promise-function-async': off '@typescript-eslint/require-array-sort-compare': error - '@typescript-eslint/restrict-plus-operands': - [error, { checkCompoundAssignments: true }] - '@typescript-eslint/restrict-template-expressions': error + '@typescript-eslint/restrict-plus-operands': off #TODO temporarily disabled + '@typescript-eslint/restrict-template-expressions': off #TODO temporarily disabled '@typescript-eslint/sort-type-union-intersection-members': off # TODO consider '@typescript-eslint/strict-boolean-expressions': off # TODO consider - '@typescript-eslint/switch-exhaustiveness-check': error + '@typescript-eslint/switch-exhaustiveness-check': off #TODO temporarily disabled '@typescript-eslint/triple-slash-reference': error '@typescript-eslint/typedef': off '@typescript-eslint/unbound-method': off # TODO consider diff --git a/src/error/__tests__/formatError-test.ts b/src/error/__tests__/formatError-test.ts index 49f79d05d68..d618f8d2d03 100644 --- a/src/error/__tests__/formatError-test.ts +++ b/src/error/__tests__/formatError-test.ts @@ -45,12 +45,10 @@ describe('formatError: default error formatter', () => { }); it('rejects null and undefined errors', () => { - // @ts-expect-error expect(() => formatError(undefined)).to.throw( 'Received null or undefined error.', ); - // @ts-expect-error expect(() => formatError(null)).to.throw( 'Received null or undefined error.', ); diff --git a/src/error/locatedError.ts b/src/error/locatedError.ts index c081f464e06..286408f792f 100644 --- a/src/error/locatedError.ts +++ b/src/error/locatedError.ts @@ -22,6 +22,7 @@ export function locatedError( : new Error('Unexpected error value: ' + inspect(rawOriginalError)); // Note: this uses a brand-check to support GraphQL errors originating from other contexts. + // @ts-expect-error FIXME: TS Conversion if (Array.isArray(originalError.path)) { // @ts-expect-error return originalError; diff --git a/src/execution/execute.ts b/src/execution/execute.ts index 6eb261c7f20..923d018d1ad 100644 --- a/src/execution/execute.ts +++ b/src/execution/execute.ts @@ -191,7 +191,9 @@ export function execute(args: ExecutionArgs): PromiseOrValue { // field and its descendants will be omitted, and sibling fields will still // be executed. An execution which encounters errors will still result in a // resolved Promise. + // @ts-expect-error FIXME: TS Conversion const data = executeOperation(exeContext, exeContext.operation, rootValue); + // @ts-expect-error FIXME: TS Conversion return buildResponse(exeContext, data); } diff --git a/src/jsutils/__tests__/identityFunc-test.ts b/src/jsutils/__tests__/identityFunc-test.ts index 82a6c914d87..625e20c4572 100644 --- a/src/jsutils/__tests__/identityFunc-test.ts +++ b/src/jsutils/__tests__/identityFunc-test.ts @@ -5,6 +5,7 @@ import { identityFunc } from '../identityFunc'; describe('identityFunc', () => { it('returns the first argument it receives', () => { + // @ts-expect-error FIXME: TS Conversion expect(identityFunc()).to.equal(undefined); expect(identityFunc(undefined)).to.equal(undefined); expect(identityFunc(null)).to.equal(null); diff --git a/src/jsutils/inspect.ts b/src/jsutils/inspect.ts index f204bbeaf56..4616edc316e 100644 --- a/src/jsutils/inspect.ts +++ b/src/jsutils/inspect.ts @@ -35,7 +35,9 @@ function formatObjectValue( const seenValues = [...previouslySeenValues, value]; + // @ts-expect-error FIXME: TS Conversion if (typeof value.toJSON === 'function') { + // @ts-expect-error FIXME: TS Conversion const jsonValue = (value.toJSON as () => unknown)(); // check for infinite recursion diff --git a/src/language/__tests__/visitor-test.ts b/src/language/__tests__/visitor-test.ts index ae23b16278e..7b6820d6761 100644 --- a/src/language/__tests__/visitor-test.ts +++ b/src/language/__tests__/visitor-test.ts @@ -51,6 +51,7 @@ function checkVisitorFnArgs(ast: any, args: any, isEdited: boolean = false) { } function getValue(node: ASTNode) { + // @ts-expect-error FIXME: TS Conversion return node.value != null ? node.value : undefined; } @@ -264,6 +265,7 @@ describe('Visitor', () => { if (node.kind === 'Field' && node.name.value === 'a') { return { kind: 'Field', + // @ts-expect-error FIXME: TS Conversion selectionSet: [addedField].concat(node.selectionSet), }; } diff --git a/src/language/parser.ts b/src/language/parser.ts index 9fdf337ce07..0477bf9d499 100644 --- a/src/language/parser.ts +++ b/src/language/parser.ts @@ -187,9 +187,10 @@ export class Parser { */ parseName(): NameNode { const token = this.expectToken(TokenKind.NAME); + // @ts-expect-error FIXME: TS Conversion return this.node(token, { - kind: Kind.NAME, // @ts-expect-error FIXME + kind: Kind.NAME, value: token.value, }); } @@ -200,7 +201,9 @@ export class Parser { * Document : Definition+ */ parseDocument(): DocumentNode { + // @ts-expect-error FIXME: TS Conversion return this.node(this._lexer.token, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.DOCUMENT, definitions: this.many( TokenKind.SOF, @@ -260,7 +263,9 @@ export class Parser { parseOperationDefinition(): OperationDefinitionNode { const start = this._lexer.token; if (this.peek(TokenKind.BRACE_L)) { + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.OPERATION_DEFINITION, operation: 'query', name: undefined, @@ -274,7 +279,9 @@ export class Parser { if (this.peek(TokenKind.NAME)) { name = this.parseName(); } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.OPERATION_DEFINITION, operation, name, @@ -316,7 +323,9 @@ export class Parser { * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? */ parseVariableDefinition(): VariableDefinitionNode { + // @ts-expect-error FIXME: TS Conversion return this.node(this._lexer.token, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.VARIABLE_DEFINITION, variable: this.parseVariable(), type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()), @@ -333,7 +342,9 @@ export class Parser { parseVariable(): VariableNode { const start = this._lexer.token; this.expectToken(TokenKind.DOLLAR); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.VARIABLE, name: this.parseName(), }); @@ -343,7 +354,9 @@ export class Parser { * SelectionSet : { Selection+ } */ parseSelectionSet(): SelectionSetNode { + // @ts-expect-error FIXME: TS Conversion return this.node(this._lexer.token, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.SELECTION_SET, selections: this.many( TokenKind.BRACE_L, @@ -383,7 +396,9 @@ export class Parser { name = nameOrAlias; } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.FIELD, alias, name, @@ -415,7 +430,9 @@ export class Parser { const name = this.parseName(); this.expectToken(TokenKind.COLON); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.ARGUMENT, name, value: this.parseValueLiteral(isConst), @@ -441,13 +458,17 @@ export class Parser { const hasTypeCondition = this.expectOptionalKeyword('on'); if (!hasTypeCondition && this.peek(TokenKind.NAME)) { + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.FRAGMENT_SPREAD, name: this.parseFragmentName(), directives: this.parseDirectives(false), }); } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.INLINE_FRAGMENT, typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, directives: this.parseDirectives(false), @@ -468,7 +489,9 @@ export class Parser { // the grammar of FragmentDefinition: // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet if (this._options?.allowLegacyFragmentVariables === true) { + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.FRAGMENT_DEFINITION, name: this.parseFragmentName(), variableDefinitions: this.parseVariableDefinitions(), @@ -477,7 +500,9 @@ export class Parser { selectionSet: this.parseSelectionSet(), }); } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.FRAGMENT_DEFINITION, name: this.parseFragmentName(), typeCondition: (this.expectKeyword('on'), this.parseNamedType()), @@ -527,16 +552,18 @@ export class Parser { return this.parseObject(isConst); case TokenKind.INT: this._lexer.advance(); + // @ts-expect-error FIXME: TS Conversion return this.node(token, { - kind: Kind.INT, // @ts-expect-error FIXME + kind: Kind.INT, value: token.value, }); case TokenKind.FLOAT: this._lexer.advance(); + // @ts-expect-error FIXME: TS Conversion return this.node(token, { - kind: Kind.FLOAT, // @ts-expect-error FIXME + kind: Kind.FLOAT, value: token.value, }); case TokenKind.STRING: @@ -546,15 +573,19 @@ export class Parser { this._lexer.advance(); switch (token.value) { case 'true': + // @ts-expect-error FIXME: TS Conversion return this.node(token, { kind: Kind.BOOLEAN, value: true }); case 'false': + // @ts-expect-error FIXME: TS Conversion return this.node(token, { kind: Kind.BOOLEAN, value: false }); case 'null': + // @ts-expect-error FIXME: TS Conversion return this.node(token, { kind: Kind.NULL }); default: + // @ts-expect-error FIXME: TS Conversion return this.node(token, { - kind: Kind.ENUM, // @ts-expect-error FIXME + kind: Kind.ENUM, value: token.value, }); } @@ -578,16 +609,16 @@ export class Parser { } parseConstValueLiteral(): ConstValueNode { - // @ts-expect-error FIXME during TS conversion return this.parseValueLiteral(true); } parseStringLiteral(): StringValueNode { const token = this._lexer.token; this._lexer.advance(); + // @ts-expect-error FIXME: TS Conversion return this.node(token, { - kind: Kind.STRING, // @ts-expect-error FIXME + kind: Kind.STRING, value: token.value, block: token.kind === TokenKind.BLOCK_STRING, }); @@ -602,7 +633,9 @@ export class Parser { parseList(isConst: boolean): ListValueNode; parseList(isConst: boolean): ListValueNode { const item = () => this.parseValueLiteral(isConst); + // @ts-expect-error FIXME: TS Conversion return this.node(this._lexer.token, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.LIST, values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R), }); @@ -617,7 +650,9 @@ export class Parser { parseObject(isConst: boolean): ObjectValueNode; parseObject(isConst: boolean): ObjectValueNode { const item = () => this.parseObjectField(isConst); + // @ts-expect-error FIXME: TS Conversion return this.node(this._lexer.token, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.OBJECT, fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R), }); @@ -633,7 +668,9 @@ export class Parser { const name = this.parseName(); this.expectToken(TokenKind.COLON); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.OBJECT_FIELD, name, value: this.parseValueLiteral(isConst), @@ -667,7 +704,9 @@ export class Parser { parseDirective(isConst: boolean): DirectiveNode { const start = this._lexer.token; this.expectToken(TokenKind.AT); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.DIRECTIVE, name: this.parseName(), arguments: this.parseArguments(isConst), @@ -689,6 +728,7 @@ export class Parser { const innerType = this.parseTypeReference(); this.expectToken(TokenKind.BRACKET_R); type = this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.LIST_TYPE, type: innerType, }); @@ -697,7 +737,9 @@ export class Parser { } if (this.expectOptionalToken(TokenKind.BANG)) { + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.NON_NULL_TYPE, type, }); @@ -709,7 +751,9 @@ export class Parser { * NamedType : Name */ parseNamedType(): NamedTypeNode { + // @ts-expect-error FIXME: TS Conversion return this.node(this._lexer.token, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.NAMED_TYPE, name: this.parseName(), }); @@ -787,7 +831,9 @@ export class Parser { this.parseOperationTypeDefinition, TokenKind.BRACE_R, ); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.SCHEMA_DEFINITION, description, directives, @@ -803,7 +849,9 @@ export class Parser { const operation = this.parseOperationType(); this.expectToken(TokenKind.COLON); const type = this.parseNamedType(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.OPERATION_TYPE_DEFINITION, operation, type, @@ -819,7 +867,9 @@ export class Parser { this.expectKeyword('scalar'); const name = this.parseName(); const directives = this.parseConstDirectives(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.SCALAR_TYPE_DEFINITION, description, name, @@ -840,7 +890,9 @@ export class Parser { const interfaces = this.parseImplementsInterfaces(); const directives = this.parseConstDirectives(); const fields = this.parseFieldsDefinition(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.OBJECT_TYPE_DEFINITION, description, name, @@ -884,7 +936,9 @@ export class Parser { this.expectToken(TokenKind.COLON); const type = this.parseTypeReference(); const directives = this.parseConstDirectives(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.FIELD_DEFINITION, description, name, @@ -920,7 +974,9 @@ export class Parser { defaultValue = this.parseConstValueLiteral(); } const directives = this.parseConstDirectives(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.INPUT_VALUE_DEFINITION, description, name, @@ -942,7 +998,9 @@ export class Parser { const interfaces = this.parseImplementsInterfaces(); const directives = this.parseConstDirectives(); const fields = this.parseFieldsDefinition(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.INTERFACE_TYPE_DEFINITION, description, name, @@ -963,7 +1021,9 @@ export class Parser { const name = this.parseName(); const directives = this.parseConstDirectives(); const types = this.parseUnionMemberTypes(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.UNION_TYPE_DEFINITION, description, name, @@ -994,7 +1054,9 @@ export class Parser { const name = this.parseName(); const directives = this.parseConstDirectives(); const values = this.parseEnumValuesDefinition(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.ENUM_TYPE_DEFINITION, description, name, @@ -1024,7 +1086,9 @@ export class Parser { const description = this.parseDescription(); const name = this.parseName(); const directives = this.parseConstDirectives(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.ENUM_VALUE_DEFINITION, description, name, @@ -1043,7 +1107,9 @@ export class Parser { const name = this.parseName(); const directives = this.parseConstDirectives(); const fields = this.parseInputFieldsDefinition(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.INPUT_OBJECT_TYPE_DEFINITION, description, name, @@ -1119,7 +1185,9 @@ export class Parser { if (directives.length === 0 && operationTypes.length === 0) { throw this.unexpected(); } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.SCHEMA_EXTENSION, directives, operationTypes, @@ -1139,7 +1207,9 @@ export class Parser { if (directives.length === 0) { throw this.unexpected(); } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.SCALAR_TYPE_EXTENSION, name, directives, @@ -1167,7 +1237,9 @@ export class Parser { ) { throw this.unexpected(); } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.OBJECT_TYPE_EXTENSION, name, interfaces, @@ -1197,7 +1269,9 @@ export class Parser { ) { throw this.unexpected(); } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.INTERFACE_TYPE_EXTENSION, name, interfaces, @@ -1221,7 +1295,9 @@ export class Parser { if (directives.length === 0 && types.length === 0) { throw this.unexpected(); } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.UNION_TYPE_EXTENSION, name, directives, @@ -1244,7 +1320,9 @@ export class Parser { if (directives.length === 0 && values.length === 0) { throw this.unexpected(); } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.ENUM_TYPE_EXTENSION, name, directives, @@ -1267,7 +1345,9 @@ export class Parser { if (directives.length === 0 && fields.length === 0) { throw this.unexpected(); } + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.INPUT_OBJECT_TYPE_EXTENSION, name, directives, @@ -1289,7 +1369,9 @@ export class Parser { const repeatable = this.expectOptionalKeyword('repeatable'); this.expectKeyword('on'); const locations = this.parseDirectiveLocations(); + // @ts-expect-error FIXME: TS Conversion return this.node(start, { + // @ts-expect-error FIXME: TS Conversion kind: Kind.DIRECTIVE_DEFINITION, description, name, diff --git a/src/language/printLocation.ts b/src/language/printLocation.ts index 4550464d561..4e1c926447d 100644 --- a/src/language/printLocation.ts +++ b/src/language/printLocation.ts @@ -47,8 +47,11 @@ export function printSourceLocation( locationStr + printPrefixedLines([ [`${lineNum} |`, subLines[0]], + // @ts-expect-error FIXME: TS Conversion ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]), + // @ts-expect-error FIXME: TS Conversion ['|', '^'.padStart(subLineColumnNum)], + // @ts-expect-error FIXME: TS Conversion ['|', subLines[subLineIndex + 1]], ]) ); diff --git a/src/subscription/__tests__/mapAsyncIterator-test.ts b/src/subscription/__tests__/mapAsyncIterator-test.ts index f02ae57d806..e5e374e2567 100644 --- a/src/subscription/__tests__/mapAsyncIterator-test.ts +++ b/src/subscription/__tests__/mapAsyncIterator-test.ts @@ -105,6 +105,7 @@ describe('mapAsyncIterator', () => { expect(await doubles.next()).to.deep.equal({ value: 4, done: false }); // Early return + // @ts-expect-error FIXME: TS Conversion expect(await doubles.return()).to.deep.equal({ value: 'The End', done: true, @@ -142,6 +143,7 @@ describe('mapAsyncIterator', () => { expect(await doubles.next()).to.deep.equal({ value: 4, done: false }); // Early return + // @ts-expect-error FIXME: TS Conversion expect(await doubles.return()).to.deep.equal({ value: undefined, done: true, diff --git a/src/subscription/mapAsyncIterator.ts b/src/subscription/mapAsyncIterator.ts index 2419505fb03..4e9563c7526 100644 --- a/src/subscription/mapAsyncIterator.ts +++ b/src/subscription/mapAsyncIterator.ts @@ -19,6 +19,7 @@ export function mapAsyncIterator( } try { + // @ts-expect-error FIXME: TS Conversion return { value: await callback(result.value), done: false }; } catch (error) { // istanbul ignore else (FIXME: add test case) diff --git a/src/subscription/subscribe.ts b/src/subscription/subscribe.ts index b2de096e728..4d194d894cc 100644 --- a/src/subscription/subscribe.ts +++ b/src/subscription/subscribe.ts @@ -165,6 +165,7 @@ export async function createSourceEventStream( return { errors: exeContext }; } + // @ts-expect-error FIXME: TS Conversion const eventStream = await executeSubscription(exeContext); // Assert field returned an event stream, otherwise yield an error. diff --git a/src/type/__tests__/definition-test.ts b/src/type/__tests__/definition-test.ts index 10efce381fb..12ef0aebf49 100644 --- a/src/type/__tests__/definition-test.ts +++ b/src/type/__tests__/definition-test.ts @@ -83,9 +83,11 @@ describe('Type System: Scalars', () => { }, }); + // @ts-expect-error FIXME: TS Conversion expect(scalar.parseLiteral(parseValue('null'))).to.equal( 'parseValue: null', ); + // @ts-expect-error FIXME: TS Conversion expect(scalar.parseLiteral(parseValue('{ foo: "bar" }'))).to.equal( 'parseValue: { foo: "bar" }', ); @@ -333,7 +335,6 @@ describe('Type System: Objects', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', fields: { - // @ts-expect-error f: undefined, }, }); @@ -356,8 +357,8 @@ describe('Type System: Objects', () => { it('rejects an Object type with a field function that returns incorrect type', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', + // @ts-expect-error FIXME: TS Conversion fields() { - // @ts-expect-error return [{ field: ScalarType }]; }, }); @@ -396,8 +397,8 @@ describe('Type System: Objects', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', fields: {}, + // @ts-expect-error FIXME: TS Conversion interfaces() { - // @ts-expect-error return {}; }, }); @@ -409,8 +410,8 @@ describe('Type System: Objects', () => { it('rejects an empty Object field resolver', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', - // @ts-expect-error fields: { + // @ts-expect-error FIXME: TS Conversion field: { type: ScalarType, resolve: {} }, }, }); @@ -423,8 +424,8 @@ describe('Type System: Objects', () => { it('rejects a constant scalar value resolver', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', - // @ts-expect-error fields: { + // @ts-expect-error FIXME: TS Conversion field: { type: ScalarType, resolve: 0 }, }, }); @@ -499,8 +500,8 @@ describe('Type System: Interfaces', () => { const objType = new GraphQLInterfaceType({ name: 'AnotherInterface', fields: {}, + // @ts-expect-error FIXME: TS Conversion interfaces() { - // @ts-expect-error return {}; }, }); @@ -697,7 +698,6 @@ describe('Type System: Enums', () => { () => new GraphQLEnumType({ name: 'SomeEnum', - // @ts-expect-error values: { FOO: null }, }), ).to.throw( @@ -795,8 +795,8 @@ describe('Type System: Input Objects', () => { it('rejects an Input Object type with resolvers', () => { const inputObjType = new GraphQLInputObjectType({ name: 'SomeInputObject', - // @ts-expect-error fields: { + // @ts-expect-error FIXME: TS Conversion f: { type: ScalarType, resolve: dummyFunc }, }, }); @@ -808,8 +808,8 @@ describe('Type System: Input Objects', () => { it('rejects an Input Object type with resolver constant', () => { const inputObjType = new GraphQLInputObjectType({ name: 'SomeInputObject', - // @ts-expect-error fields: { + // @ts-expect-error FIXME: TS Conversion f: { type: ScalarType, resolve: {} }, }, }); @@ -843,9 +843,7 @@ describe('Type System: List', () => { expectList(String).to.throw( 'Expected [function String] to be a GraphQL type.', ); - // @ts-expect-error expectList(null).to.throw('Expected null to be a GraphQL type.'); - // @ts-expect-error expectList(undefined).to.throw('Expected undefined to be a GraphQL type.'); }); }); @@ -867,7 +865,6 @@ describe('Type System: Non-Null', () => { }); it('rejects a non-type as nullable type of non-null', () => { - // @ts-expect-error expectNonNull(NonNullScalarType).to.throw( 'Expected Scalar! to be a GraphQL nullable type.', ); @@ -877,11 +874,9 @@ describe('Type System: Non-Null', () => { expectNonNull(String).to.throw( 'Expected [function String] to be a GraphQL nullable type.', ); - // @ts-expect-error expectNonNull(null).to.throw( 'Expected null to be a GraphQL nullable type.', ); - // @ts-expect-error expectNonNull(undefined).to.throw( 'Expected undefined to be a GraphQL nullable type.', ); diff --git a/src/type/__tests__/validation-test.ts b/src/type/__tests__/validation-test.ts index 97d839a95a8..1e2548c047b 100644 --- a/src/type/__tests__/validation-test.ts +++ b/src/type/__tests__/validation-test.ts @@ -1036,7 +1036,6 @@ describe('Type System: Object fields must have output types', () => { } it('rejects an empty Object field type', () => { - // @ts-expect-error const schema = schemaWithObjectField({ type: undefined }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1098,7 +1097,6 @@ describe('Type System: Objects can only implement unique interfaces', () => { const schema = new GraphQLSchema({ query: new GraphQLObjectType({ name: 'BadObject', - // @ts-expect-error interfaces: [undefined], fields: { f: { type: GraphQLString } }, }), @@ -1357,7 +1355,6 @@ describe('Type System: Interface fields must have output types', () => { } it('rejects an empty Interface field type', () => { - // @ts-expect-error const schema = schemaWithInterfaceField({ type: undefined }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1493,7 +1490,6 @@ describe('Type System: Arguments must have input types', () => { } it('rejects an empty field arg type', () => { - // @ts-expect-error const schema = schemaWithArg({ type: undefined }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1631,7 +1627,6 @@ describe('Type System: Input Object fields must have input types', () => { } it('rejects an empty input field type', () => { - // @ts-expect-error const schema = schemaWithInputField({ type: undefined }); expect(validateSchema(schema)).to.deep.equal([ { diff --git a/src/type/definition.ts b/src/type/definition.ts index 55ca691656c..3d38a43d5a2 100644 --- a/src/type/definition.ts +++ b/src/type/definition.ts @@ -828,6 +828,7 @@ function defineFieldMap( `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, ); + // @ts-expect-error FIXME: TS Conversion return mapValue(fieldMap, (fieldConfig, fieldName) => { devAssert( isPlainObj(fieldConfig), diff --git a/src/type/introspection.ts b/src/type/introspection.ts index 3560c8f8124..1a9a655b919 100644 --- a/src/type/introspection.ts +++ b/src/type/introspection.ts @@ -234,16 +234,19 @@ export const __Type: GraphQLObjectType = new GraphQLObjectType({ }, name: { type: GraphQLString, + // @ts-expect-error FIXME: TS Conversion resolve: (type) => (type.name !== undefined ? type.name : undefined), }, description: { type: GraphQLString, resolve: (type) => + // @ts-expect-error FIXME: TS Conversion type.description !== undefined ? type.description : undefined, }, specifiedByURL: { type: GraphQLString, resolve: (obj) => + // @ts-expect-error FIXME: TS Conversion obj.specifiedByURL !== undefined ? obj.specifiedByURL : undefined, }, fields: { @@ -310,6 +313,7 @@ export const __Type: GraphQLObjectType = new GraphQLObjectType({ ofType: { type: __Type, resolve: (type) => + // @ts-expect-error FIXME: TS Conversion type.ofType !== undefined ? type.ofType : undefined, }, } as GraphQLFieldConfigMap), diff --git a/src/type/validate.ts b/src/type/validate.ts index a8c58e899b4..65062401c79 100644 --- a/src/type/validate.ts +++ b/src/type/validate.ts @@ -117,6 +117,7 @@ function validateRootTypes(context: SchemaValidationContext): void { `Query root type must be Object type, it cannot be ${inspect( queryType, )}.`, + // @ts-expect-error FIXME: TS Conversion getOperationTypeNode(schema, 'query') ?? queryType.astNode, ); } @@ -126,6 +127,7 @@ function validateRootTypes(context: SchemaValidationContext): void { context.reportError( 'Mutation root type must be Object type if provided, it cannot be ' + `${inspect(mutationType)}.`, + // @ts-expect-error FIXME: TS Conversion getOperationTypeNode(schema, 'mutation') ?? mutationType.astNode, ); } @@ -135,6 +137,7 @@ function validateRootTypes(context: SchemaValidationContext): void { context.reportError( 'Subscription root type must be Object type if provided, it cannot be ' + `${inspect(subscriptionType)}.`, + // @ts-expect-error FIXME: TS Conversion getOperationTypeNode(schema, 'subscription') ?? subscriptionType.astNode, ); } @@ -145,10 +148,13 @@ function getOperationTypeNode( operation: OperationTypeNode, ): Maybe { // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - return [schema.astNode] - .concat(schema.extensionASTNodes) - .flatMap((schemaNode) => schemaNode?.operationTypes ?? []) - .find((operationNode) => operationNode.operation === operation)?.type; + return ( + [schema.astNode] + // @ts-expect-error FIXME: TS Conversion + .concat(schema.extensionASTNodes) + .flatMap((schemaNode) => schemaNode?.operationTypes ?? []) + .find((operationNode) => operationNode.operation === operation)?.type + ); } function validateDirectives(context: SchemaValidationContext): void { @@ -157,6 +163,7 @@ function validateDirectives(context: SchemaValidationContext): void { if (!isDirective(directive)) { context.reportError( `Expected directive but got: ${inspect(directive)}.`, + // @ts-expect-error FIXME: TS Conversion directive?.astNode, ); continue; @@ -211,6 +218,7 @@ function validateTypes(context: SchemaValidationContext): void { if (!isNamedType(type)) { context.reportError( `Expected GraphQL named type but got: ${inspect(type)}.`, + // @ts-expect-error FIXME: TS Conversion type.astNode, ); continue; diff --git a/src/utilities/__tests__/buildASTSchema-test.ts b/src/utilities/__tests__/buildASTSchema-test.ts index c19f2cf1efa..6503f6a02e6 100644 --- a/src/utilities/__tests__/buildASTSchema-test.ts +++ b/src/utilities/__tests__/buildASTSchema-test.ts @@ -1095,7 +1095,6 @@ describe('Schema Builder', () => { }); it('Rejects invalid AST', () => { - // @ts-expect-error expect(() => buildASTSchema(null)).to.throw( 'Must provide valid Document AST', ); diff --git a/src/utilities/__tests__/buildClientSchema-test.ts b/src/utilities/__tests__/buildClientSchema-test.ts index 8bfc8c59949..49c4253b532 100644 --- a/src/utilities/__tests__/buildClientSchema-test.ts +++ b/src/utilities/__tests__/buildClientSchema-test.ts @@ -629,7 +629,6 @@ describe('Type System: build schema from introspection', () => { `); it('throws when introspection is missing __schema property', () => { - // @ts-expect-error expect(() => buildClientSchema(null)).to.throw( 'Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: null.', ); diff --git a/src/utilities/__tests__/extendSchema-test.ts b/src/utilities/__tests__/extendSchema-test.ts index 48df80aa22c..085752dcc45 100644 --- a/src/utilities/__tests__/extendSchema-test.ts +++ b/src/utilities/__tests__/extendSchema-test.ts @@ -1143,7 +1143,6 @@ describe('extendSchema', () => { it('Rejects invalid AST', () => { const schema = new GraphQLSchema({}); - // @ts-expect-error expect(() => extendSchema(schema, null)).to.throw( 'Must provide valid Document AST', ); diff --git a/src/utilities/extendSchema.ts b/src/utilities/extendSchema.ts index 9896ac097f2..98eb8a20836 100644 --- a/src/utilities/extendSchema.ts +++ b/src/utilities/extendSchema.ts @@ -656,6 +656,7 @@ export function extendSchemaImpl( } const stdTypeMap = keyMap( + // @ts-expect-error FIXME: TS Conversion specifiedScalarTypes.concat(introspectionTypes), (type) => type.name, ); diff --git a/src/utilities/lexicographicSortSchema.ts b/src/utilities/lexicographicSortSchema.ts index e87106a229c..7b015f20a40 100644 --- a/src/utilities/lexicographicSortSchema.ts +++ b/src/utilities/lexicographicSortSchema.ts @@ -63,7 +63,8 @@ export function lexicographicSortSchema(schema: GraphQLSchema): GraphQLSchema { // @ts-expect-error return new GraphQLNonNull(replaceType(type.ofType)); } - return replaceNamedType(type); + // @ts-expect-error FIXME: TS Conversion + return replaceNamedType(type); } function replaceNamedType(type: T): T { diff --git a/src/validation/ValidationContext.ts b/src/validation/ValidationContext.ts index fdfd7efd653..0479318b2a2 100644 --- a/src/validation/ValidationContext.ts +++ b/src/validation/ValidationContext.ts @@ -94,6 +94,7 @@ export class ASTValidationContext { const set = setsToVisit.pop(); for (const selection of set.selections) { if (selection.kind === Kind.FRAGMENT_SPREAD) { + // @ts-expect-error FIXME: TS Conversion spreads.push(selection); } else if (selection.selectionSet) { setsToVisit.push(selection.selectionSet); @@ -121,6 +122,7 @@ export class ASTValidationContext { collectedNames[fragName] = true; const fragment = this.getFragment(fragName); if (fragment) { + // @ts-expect-error FIXME: TS Conversion fragments.push(fragment); nodesToVisit.push(fragment.selectionSet); } diff --git a/src/validation/__tests__/validation-test.ts b/src/validation/__tests__/validation-test.ts index e0322f518a2..a015bb9bd44 100644 --- a/src/validation/__tests__/validation-test.ts +++ b/src/validation/__tests__/validation-test.ts @@ -15,7 +15,6 @@ import { testSchema } from './harness'; describe('Validate: Supports full validation', () => { it('rejects invalid documents', () => { - // @ts-expect-error expect(() => validate(testSchema, null)).to.throw('Must provide document.'); }); diff --git a/src/validation/rules/KnownDirectivesRule.ts b/src/validation/rules/KnownDirectivesRule.ts index 04b98566caf..7418e570e1d 100644 --- a/src/validation/rules/KnownDirectivesRule.ts +++ b/src/validation/rules/KnownDirectivesRule.ts @@ -73,8 +73,10 @@ function getDirectiveLocationForASTPath( const appliedTo = ancestors[ancestors.length - 1]; invariant(!Array.isArray(appliedTo)); + // @ts-expect-error FIXME: TS Conversion switch (appliedTo.kind) { case Kind.OPERATION_DEFINITION: + // @ts-expect-error FIXME: TS Conversion return getDirectiveLocationForOperation(appliedTo.operation); case Kind.FIELD: return DirectiveLocation.FIELD; @@ -113,6 +115,7 @@ function getDirectiveLocationForASTPath( return DirectiveLocation.INPUT_OBJECT; case Kind.INPUT_VALUE_DEFINITION: { const parentNode = ancestors[ancestors.length - 3]; + // @ts-expect-error FIXME: TS Conversion return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ? DirectiveLocation.INPUT_FIELD_DEFINITION : DirectiveLocation.ARGUMENT_DEFINITION; diff --git a/src/validation/rules/KnownTypeNamesRule.ts b/src/validation/rules/KnownTypeNamesRule.ts index 6d2ec6985b3..8593e9a5a24 100644 --- a/src/validation/rules/KnownTypeNamesRule.ts +++ b/src/validation/rules/KnownTypeNamesRule.ts @@ -75,6 +75,7 @@ const standardTypeNames = [...specifiedScalarTypes, ...introspectionTypes].map( function isSDLNode(value: ASTNode | ReadonlyArray): boolean { return ( !Array.isArray(value) && + // @ts-expect-error FIXME: TS Conversion (isTypeSystemDefinitionNode(value) || isTypeSystemExtensionNode(value)) ); } diff --git a/src/validation/rules/UniqueDirectivesPerLocationRule.ts b/src/validation/rules/UniqueDirectivesPerLocationRule.ts index a21c0817903..8bdff5de240 100644 --- a/src/validation/rules/UniqueDirectivesPerLocationRule.ts +++ b/src/validation/rules/UniqueDirectivesPerLocationRule.ts @@ -48,6 +48,7 @@ export function UniqueDirectivesPerLocationRule( // them all, just listen for entering any node, and check to see if it // defines any directives. enter(node) { + // @ts-expect-error FIXME: TS Conversion if (node.directives == null) { return; } @@ -68,6 +69,7 @@ export function UniqueDirectivesPerLocationRule( seenDirectives = Object.create(null); } + // @ts-expect-error FIXME: TS Conversion for (const directive of node.directives) { const directiveName = directive.name.value; diff --git a/tsconfig.json b/tsconfig.json index ab3e800e211..d160d317efa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,9 +4,9 @@ "module": "commonjs", "lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"], "target": "es2019", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false, "strictFunctionTypes": true, "noEmit": true, "forceConsistentCasingInFileNames": true