From 1745a1d35854cccc5bb254fdf8974e0c8108d497 Mon Sep 17 00:00:00 2001 From: rubiesonthesky <2591240+rubiesonthesky@users.noreply.github.com> Date: Fri, 6 Dec 2024 22:30:03 +0200 Subject: [PATCH] fix(tests): enable suppressTypeErrors on all integration tests --- .../builtin/suppressTypeErrors/index.ts | 10 +- src/shared/diagnostics.ts | 16 + src/tests/testSetup.ts | 53 +- test/__snapshots__/cleanups.test.ts.snap | 234 +- .../__snapshots__/customMutators.test.ts.snap | 360 +-- test/__snapshots__/files.test.ts.snap | 592 ++-- test/__snapshots__/filters.test.ts.snap | 460 +-- .../fixEnumAsArgument.test.ts.snap | 148 +- .../fixImportExtensions.test.ts.snap | 152 +- .../fixIncompleteTypes.test.ts.snap | 2600 +++++++++-------- .../fixMissingProperties.test.ts.snap | 148 +- .../fixNoImplicitAny.test.ts.snap | 450 +-- .../fixNoImplicitThis.test.ts.snap | 148 +- .../fixNoInferableTypes.test.ts.snap | 450 +-- .../fixStrictNonNullAssertions.test.ts.snap | 750 ++--- test/__snapshots__/include.test.ts.snap | 208 +- .../infiniteWaveDetection.test.ts.snap | 104 +- .../__snapshots__/postProcessing.test.ts.snap | 158 +- test/cases/cleanups/nonTypeErrors/expected.ts | 6 + test/cases/cleanups/nonTypeErrors/original.ts | 4 + .../cleanups/nonTypeErrors/tsconfig.json | 8 + .../cleanups/nonTypeErrors/typestat.json | 6 + .../cleanups/suppressTypeErrors/expected.ts | 5 + .../cleanups/suppressTypeErrors/original.ts | 3 + .../cases/custom mutators/empty/typestat.json | 3 + test/cases/custom mutators/one/typestat.json | 3 + test/cases/custom mutators/two/typestat.json | 3 + test/cases/files/empty/typestat.json | 3 + test/cases/filters/empty/typestat.json | 3 + test/cases/filters/one/expected.ts | 2 + test/cases/filters/one/original.ts | 1 + test/cases/filters/one/typestat.json | 3 + test/cases/filters/two/expected.ts | 4 + test/cases/filters/two/original.ts | 2 + test/cases/filters/two/typestat.json | 3 + test/cases/fixes/importExtensions/expected.ts | 6 + .../fixes/importExtensions/typestat.json | 3 + .../typestat.json | 3 + .../typestat.json | 3 + .../typestat.json | 3 + .../typestat.json | 3 + .../parameterTypes/typestat.json | 3 + .../propertyDeclarationTypes/typestat.json | 3 + .../reactTypes/notReactProps/typestat.json | 3 + .../reactPropFunctionsFromCalls/typestat.json | 3 + .../expected.tsx | 6 + .../tsconfig.json | 4 + .../typestat.json | 3 + .../reactPropsFromPropTypes/all/expected.tsx | 62 + .../reactPropsFromPropTypes/all/original.tsx | 30 + .../reactPropsFromPropTypes/all/tsconfig.json | 5 + .../reactPropsFromPropTypes/all/typestat.json | 3 + .../optionality/alwaysOptional/expected.tsx | 2 + .../optionality/alwaysOptional/tsconfig.json | 4 + .../optionality/alwaysOptional/typestat.json | 3 + .../optionality/alwaysRequired/expected.tsx | 2 + .../optionality/alwaysRequired/tsconfig.json | 4 + .../optionality/alwaysRequired/typestat.json | 3 + .../optionality/asWritten/expected.tsx | 2 + .../optionality/asWritten/tsconfig.json | 4 + .../optionality/asWritten/typestat.json | 3 + .../reactPropsFromUses/expected.tsx | 2 + .../reactPropsFromUses/typestat.json | 3 + .../reactTypes/reactPropsMissing/expected.tsx | 25 + .../reactPropsMissing/typestat.json | 3 + .../incompleteTypes/returnTypes/expected.ts | 6 +- .../incompleteTypes/returnTypes/original.ts | 2 +- .../incompleteTypes/returnTypes/tsconfig.json | 3 + .../incompleteTypes/returnTypes/typestat.json | 3 + .../{expected.tsx => expected.ts} | 18 +- .../{original.tsx => original.ts} | 12 - .../variableTypes/tsconfig.json | 2 +- .../variableTypes/typestat.json | 3 + .../missingPropertyAccesses/expected.ts | 1 + .../missingPropertyAccesses/typestat.json | 3 + .../noImplicitAny/parameters/expected.ts | 6 + .../noImplicitAny/parameters/typestat.json | 3 + .../propertyDeclarations/typestat.json | 3 + .../variableDeclarations/expected.ts | 8 + .../variableDeclarations/typestat.json | 3 + test/cases/fixes/noImplicitThis/typestat.json | 3 + .../noInferableTypes/parameters/typestat.json | 3 + .../propertyDeclarations/typestat.json | 3 + .../variableDeclarations/typestat.json | 3 + .../binaryExpressions/typestat.json | 3 + .../callExpressions/expected.ts | 1 + .../callExpressions/typestat.json | 3 + .../objectLiterals/typestat.json | 3 + .../propertyAccesses/expected.ts | 10 +- .../propertyAccesses/original.ts | 6 +- .../propertyAccesses/typestat.json | 3 + .../returnTypes/typestat.json | 3 + test/cases/include/asterisk/typestat.json | 3 + test/cases/include/directory/typestat.json | 3 + .../infinite wave detection/typestat.json | 3 + test/cases/post processing/postProcess.cjs | 2 +- test/cleanups.test.ts | 11 + test/files.test.ts | 8 +- test/fixStrictNonNullAssertions.test.ts | 2 +- 99 files changed, 4020 insertions(+), 3441 deletions(-) create mode 100644 test/cases/cleanups/nonTypeErrors/expected.ts create mode 100644 test/cases/cleanups/nonTypeErrors/original.ts create mode 100644 test/cases/cleanups/nonTypeErrors/tsconfig.json create mode 100644 test/cases/cleanups/nonTypeErrors/typestat.json rename test/cases/fixes/incompleteTypes/variableTypes/{expected.tsx => expected.ts} (90%) rename test/cases/fixes/incompleteTypes/variableTypes/{original.tsx => original.ts} (95%) diff --git a/src/cleanups/builtin/suppressTypeErrors/index.ts b/src/cleanups/builtin/suppressTypeErrors/index.ts index 928c11c78c..60bbeb051b 100644 --- a/src/cleanups/builtin/suppressTypeErrors/index.ts +++ b/src/cleanups/builtin/suppressTypeErrors/index.ts @@ -4,7 +4,7 @@ import { DiagnosticWithStart, getLineForDiagnostic, isDiagnosticWithStart, - stringifyDiagnosticMessageText, + userFriendlyDiagnosticMessageText, } from "../../../shared/diagnostics.js"; import { FileMutator } from "../../../shared/fileMutator.js"; @@ -33,8 +33,14 @@ export const suppressRemainingTypeIssues: FileMutator = (request) => { } } + const currentDir = request.services.program.getCurrentDirectory(); + return Array.from(diagnosticsPerLine).map(([line, diagnostics]) => { - const messages = diagnostics.map(stringifyDiagnosticMessageText).join(" "); + const messages = diagnostics + .map((diagnostic) => + userFriendlyDiagnosticMessageText(diagnostic, currentDir), + ) + .join(" "); return { insertion: `// @ts-expect-error -- TODO: ${messages}\n`, range: { diff --git a/src/shared/diagnostics.ts b/src/shared/diagnostics.ts index 4c6a59b925..ec8387908f 100644 --- a/src/shared/diagnostics.ts +++ b/src/shared/diagnostics.ts @@ -22,3 +22,19 @@ export const stringifyDiagnosticMessageText = (diagnostic: ts.Diagnostic) => { ? diagnostic.messageText : diagnostic.messageText.messageText; }; + +export const userFriendlyDiagnosticMessageText = ( + diagnostic: ts.Diagnostic, + currentDir: string, +) => { + const diagnosticMessage = stringifyDiagnosticMessageText(diagnostic); + if (diagnostic.code === 1192 || diagnostic.code === 1259) { + // = Module_0_can_only_be_default_imported_using_the_1_flag + return diagnosticMessage.replace( + /Module '"[^"]*"' (can only be default-imported|has no default export)/, + "This module $1", + ); + } else { + return diagnosticMessage.replace(currentDir, ""); + } +}; diff --git a/src/tests/testSetup.ts b/src/tests/testSetup.ts index 0514782bf4..ab3fdac33c 100644 --- a/src/tests/testSetup.ts +++ b/src/tests/testSetup.ts @@ -4,7 +4,10 @@ import path from "node:path"; import { fillOutRawOptions } from "../options/fillOutRawOptions.js"; import { parseRawCompilerOptions } from "../options/parseRawCompilerOptions.js"; -import { RawTypeStatOptions } from "../options/types.js"; +import { + PendingTypeStatOptions, + RawTypeStatOptions, +} from "../options/types.js"; import { createTypeStatProvider } from "../runtime/createTypeStatProvider.js"; export interface MutationTestResult { @@ -34,7 +37,10 @@ export const runMutationTest = async ( await fs.copyFile(originalFile, actualFile); const rawTypeStatOptions = await readFile("typestat.json"); - const rawOptions = JSON.parse(rawTypeStatOptions) as RawTypeStatOptions; + const rawOptions = JSON.parse(rawTypeStatOptions) as + | RawTypeStatOptions + | RawTypeStatOptions[]; + const rawOptionsList = Array.isArray(rawOptions) ? rawOptions : [rawOptions]; const projectPath = path.join(dirPath, "tsconfig.json"); @@ -48,31 +54,38 @@ export const runMutationTest = async ( stdout: () => {}, }; - const pendingOptions = fillOutRawOptions({ - compilerOptions, - cwd: dirPath, - output, - projectPath, - rawOptions, - }); + const pendingOptionsList: PendingTypeStatOptions[] = []; - const provider = createTypeStatProvider({ - ...pendingOptions, - fileNames: [actualFile], - }); + for (const mutationOption of rawOptionsList) { + const pendingOptions = fillOutRawOptions({ + compilerOptions, + cwd: dirPath, + output, + projectPath, + rawOptions: mutationOption, + }); - await runMutations({ - mutationsProvider: provider, - }); + pendingOptionsList.push(pendingOptions); + + const provider = createTypeStatProvider({ + ...pendingOptions, + fileNames: [actualFile], + }); + + await runMutations({ + mutationsProvider: provider, + }); + } const actualContent = await readFile(actualFileName); const expectFileName = `expected.ts${fileNameSuffix}`; const expectedFilePath = path.join(dirPath, expectFileName); - const optionsSnapshot = JSON.stringify(pendingOptions, null, 2).replaceAll( - dirPath, - "", - ); + const optionsSnapshot = JSON.stringify( + pendingOptionsList, + null, + 2, + ).replaceAll(dirPath, ""); return { actualContent, expectedFilePath, options: optionsSnapshot }; }; diff --git a/test/__snapshots__/cleanups.test.ts.snap b/test/__snapshots__/cleanups.test.ts.snap index 65cfd792dd..7e72bd1322 100644 --- a/test/__snapshots__/cleanups.test.ts.snap +++ b/test/__snapshots__/cleanups.test.ts.snap @@ -1,81 +1,167 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Cleanups > suppressTypeErrors > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": true - }, - "compilerOptions": { +exports[`Cleanups > non-TypeErrors > options 1`] = ` +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, "compilerOptions": { - "strictNullChecks": true + "compilerOptions": { + "esModuleInterop": true, + "strictNullChecks": true, + "resolveJsonModule": true + }, + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false }, - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - [ - "fixNoInferableTypes", - null + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" +`; + +exports[`Cleanups > suppressTypeErrors > options 1`] = ` +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "compilerOptions": { + "strictNullChecks": true + }, + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; diff --git a/test/__snapshots__/customMutators.test.ts.snap b/test/__snapshots__/customMutators.test.ts.snap index 52ba5b62e6..1f1947d8cb 100644 --- a/test/__snapshots__/customMutators.test.ts.snap +++ b/test/__snapshots__/customMutators.test.ts.snap @@ -1,192 +1,198 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Custom mutators > empty array > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Custom mutators > one mutator > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "include": [ + "actual.ts" + ], + "compileOnSave": false, + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, "include": [ "actual.ts" ], - "compileOnSave": false, - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "include": [ - "actual.ts" - ], - "mutators": [ - [ - "./sampleMutator.cjs", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "mutators": [ + [ + "./sampleMutator.cjs", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Custom mutators > two mutators > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "./mutator1.cjs", - null +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "./mutator1.cjs", + null + ], + [ + "./mutator2.cjs", + null + ] ], - [ - "./mutator2.cjs", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; diff --git a/test/__snapshots__/files.test.ts.snap b/test/__snapshots__/files.test.ts.snap index 28b353eae8..b2a5510e21 100644 --- a/test/__snapshots__/files.test.ts.snap +++ b/test/__snapshots__/files.test.ts.snap @@ -1,309 +1,317 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`files > addition above > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" +"[ + { + "cleanups": { + "suppressTypeErrors": false + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "/* Above file */", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "/* Above file */", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`files > addition below > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "/* Below file */", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null +"[ + { + "cleanups": { + "suppressTypeErrors": false + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "/* Below file */", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`files > both > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" +"[ + { + "cleanups": { + "suppressTypeErrors": false + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "/* Above file */", + "below": "/* Below file */", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "/* Above file */", - "below": "/* Below file */", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`files > empty addition > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; diff --git a/test/__snapshots__/filters.test.ts.snap b/test/__snapshots__/filters.test.ts.snap index 7ed294d1a1..8a679414a2 100644 --- a/test/__snapshots__/filters.test.ts.snap +++ b/test/__snapshots__/filters.test.ts.snap @@ -1,243 +1,249 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`filters > empty > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": true, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": true, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`filters > one > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [ - "FunctionDeclaration[name.text=one]" - ], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": true, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [ + "FunctionDeclaration[name.text=one]" + ], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": true, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`filters > two > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [ - "MethodDeclaration[name.text=dispose]", - "CallExpression[expression.text=teardown]" - ], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": true, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [ + "MethodDeclaration[name.text=dispose]", + "CallExpression[expression.text=teardown]" + ], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": true, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; diff --git a/test/__snapshots__/fixEnumAsArgument.test.ts.snap b/test/__snapshots__/fixEnumAsArgument.test.ts.snap index f7cd524607..205bc7fc7d 100644 --- a/test/__snapshots__/fixEnumAsArgument.test.ts.snap +++ b/test/__snapshots__/fixEnumAsArgument.test.ts.snap @@ -1,78 +1,80 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`enum as argument > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" +"[ + { + "cleanups": { + "suppressTypeErrors": false + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; diff --git a/test/__snapshots__/fixImportExtensions.test.ts.snap b/test/__snapshots__/fixImportExtensions.test.ts.snap index 32f2402116..5a66c30345 100644 --- a/test/__snapshots__/fixImportExtensions.test.ts.snap +++ b/test/__snapshots__/fixImportExtensions.test.ts.snap @@ -1,80 +1,82 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`import extensions > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts", - "foundDirect.ts", - "foundIndirect/index.ts" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts", + "foundDirect.ts", + "foundIndirect/index.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": true, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": true, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; diff --git a/test/__snapshots__/fixIncompleteTypes.test.ts.snap b/test/__snapshots__/fixIncompleteTypes.test.ts.snap index 8a1ec6ef02..bfbe382862 100644 --- a/test/__snapshots__/fixIncompleteTypes.test.ts.snap +++ b/test/__snapshots__/fixIncompleteTypes.test.ts.snap @@ -1,1335 +1,1393 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Incomplete types > Implicit generics > incomplete implicit class generics > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts", - "react-like.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts", + "react-like.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > Implicit generics > incomplete implicit variable generics > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > Interface or type literal generics > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > Non-generic Interface as Type argument > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > React types > React props from prop types > Optionality > always optional > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.tsx" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "alwaysOptional" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react" + }, + "files": [ + "actual.tsx" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "alwaysOptional" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > React types > React props from prop types > Optionality > always required > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.tsx" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "alwaysRequired" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react" + }, + "files": [ + "actual.tsx" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "alwaysRequired" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > React types > React props from prop types > Optionality > as written > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.tsx" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react" + }, + "files": [ + "actual.tsx" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > React types > React props from prop types > all > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.tsx" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react", + "target": "ES2022" + }, + "files": [ + "actual.tsx" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > React types > not react props > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, "compilerOptions": { - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "jsx": "react" + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "jsx": "react" + }, + "files": [ + "actual.tsx" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false }, - "files": [ - "actual.tsx" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > React types > react prop functions from calls > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, "compilerOptions": { - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "jsx": "react" + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "jsx": "react" + }, + "files": [ + "actual.tsx" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false }, - "files": [ - "actual.tsx" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > React types > react props from later assignments > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.tsx" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react" + }, + "files": [ + "actual.tsx" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > React types > react props from prop uses > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, "compilerOptions": { - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "jsx": "react" + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "jsx": "react" + }, + "files": [ + "actual.tsx" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false }, - "files": [ - "actual.tsx" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > React types > react props missing > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, "compilerOptions": { - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "jsx": "react" + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "jsx": "react" + }, + "files": [ + "actual.tsx" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false }, - "files": [ - "actual.tsx" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > parameter types > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > property declaration types > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`Incomplete types > return types > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "compilerOptions": { + "target": "ES2020" + }, + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`Incomplete types > variable types > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.tsx" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; diff --git a/test/__snapshots__/fixMissingProperties.test.ts.snap b/test/__snapshots__/fixMissingProperties.test.ts.snap index 37c6aee94e..4e60049278 100644 --- a/test/__snapshots__/fixMissingProperties.test.ts.snap +++ b/test/__snapshots__/fixMissingProperties.test.ts.snap @@ -1,80 +1,82 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Missing properties > missing property accesses > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": true, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": true, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; diff --git a/test/__snapshots__/fixNoImplicitAny.test.ts.snap b/test/__snapshots__/fixNoImplicitAny.test.ts.snap index 3bba4656e3..99badb2745 100644 --- a/test/__snapshots__/fixNoImplicitAny.test.ts.snap +++ b/test/__snapshots__/fixNoImplicitAny.test.ts.snap @@ -1,238 +1,244 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`noImplicitAny > parameters > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": true, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": true, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`noImplicitAny > property declarations > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`noImplicitAny > variable declarations > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; diff --git a/test/__snapshots__/fixNoImplicitThis.test.ts.snap b/test/__snapshots__/fixNoImplicitThis.test.ts.snap index 107c7fa4ed..5c843afd99 100644 --- a/test/__snapshots__/fixNoImplicitThis.test.ts.snap +++ b/test/__snapshots__/fixNoImplicitThis.test.ts.snap @@ -1,80 +1,82 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`noImplicitThis > noImplicitThis > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": true, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": true, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - "noImplicitAny": false, - "noImplicitThis": true, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": true, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; diff --git a/test/__snapshots__/fixNoInferableTypes.test.ts.snap b/test/__snapshots__/fixNoInferableTypes.test.ts.snap index 5935899464..336c083300 100644 --- a/test/__snapshots__/fixNoInferableTypes.test.ts.snap +++ b/test/__snapshots__/fixNoInferableTypes.test.ts.snap @@ -1,238 +1,244 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`No inferable types > parameters > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": true, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": true, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`No inferable types > property declarations > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": true, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": true, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`No inferable types > variable declarations > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": true, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": true, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; diff --git a/test/__snapshots__/fixStrictNonNullAssertions.test.ts.snap b/test/__snapshots__/fixStrictNonNullAssertions.test.ts.snap index 7ecbf4039d..9289306985 100644 --- a/test/__snapshots__/fixStrictNonNullAssertions.test.ts.snap +++ b/test/__snapshots__/fixStrictNonNullAssertions.test.ts.snap @@ -1,402 +1,412 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`strictNonNullAssertions > binaryExpressions > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, "compilerOptions": { + "compilerOptions": { + "strictNullChecks": true + }, + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": true }, - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": true - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": true + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`strictNonNullAssertions > callExpressions > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": true - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": true + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`strictNonNullAssertions > objectLiterals > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": true - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": true + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`strictNonNullAssertions > propertyAccesses > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": true - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": true + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": true + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; exports[`strictNonNullAssertions > returnTypes > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, "compilerOptions": { + "compilerOptions": { + "strictNullChecks": true + }, + "files": [ + "actual.ts" + ], + "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": true }, - "files": [ - "actual.ts" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": true - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": true - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": true + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": { + "strictNullChecks": true } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": { - "strictNullChecks": true } -}" +]" `; diff --git a/test/__snapshots__/include.test.ts.snap b/test/__snapshots__/include.test.ts.snap index 42c664ead6..a436f7302a 100644 --- a/test/__snapshots__/include.test.ts.snap +++ b/test/__snapshots__/include.test.ts.snap @@ -1,115 +1,119 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`include > asterisk > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "include": [ + "original.ts", + "expected.ts", + "actual.ts" + ], + "compileOnSave": false, + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, "include": [ "original.ts", "expected.ts", "actual.ts" ], - "compileOnSave": false, - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "include": [ - "original.ts", - "expected.ts", - "actual.ts" - ], - "mutators": [ - [ - "./sampleMutator.cjs", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "mutators": [ + [ + "./sampleMutator.cjs", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; exports[`include > directory > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "include": [], + "compileOnSave": false, + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, "include": [], - "compileOnSave": false, - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "include": [], - "mutators": [ - [ - "./sampleMutator.cjs", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "mutators": [ + [ + "./sampleMutator.cjs", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; diff --git a/test/__snapshots__/infiniteWaveDetection.test.ts.snap b/test/__snapshots__/infiniteWaveDetection.test.ts.snap index 7412469895..9ed228c2b4 100644 --- a/test/__snapshots__/infiniteWaveDetection.test.ts.snap +++ b/test/__snapshots__/infiniteWaveDetection.test.ts.snap @@ -1,58 +1,60 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Infinite wave detection > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "include": [ + "actual.ts" + ], + "compileOnSave": false, + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": false, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, "include": [ "actual.ts" ], - "compileOnSave": false, - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": false, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "include": [ - "actual.ts" - ], - "mutators": [ - [ - "./infiniteMutator.cjs", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + "mutators": [ + [ + "./infiniteMutator.cjs", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; diff --git a/test/__snapshots__/postProcessing.test.ts.snap b/test/__snapshots__/postProcessing.test.ts.snap index bf04506a15..d572962378 100644 --- a/test/__snapshots__/postProcessing.test.ts.snap +++ b/test/__snapshots__/postProcessing.test.ts.snap @@ -1,87 +1,89 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Post processing > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": false + }, + "compilerOptions": { + "include": [ + "actual.ts" + ], + "compileOnSave": false, + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false + }, + "files": { + "above": "", + "below": "", + "renameExtensions": false + }, + "filters": [], + "fixes": { + "importExtensions": false, + "incompleteTypes": true, + "missingProperties": false, + "noImplicitAny": false, + "noImplicitThis": false, + "noInferableTypes": false, + "strictNonNullAssertions": false + }, + "hints": { + "react": { + "propTypes": "whenRequired", + "propTypesOptionality": "asWritten" + } + }, "include": [ "actual.ts" ], - "compileOnSave": false, - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false - }, - "files": { - "above": "", - "below": "", - "renameExtensions": false - }, - "filters": [], - "fixes": { - "importExtensions": false, - "incompleteTypes": true, - "missingProperties": false, - "noImplicitAny": false, - "noImplicitThis": false, - "noInferableTypes": false, - "strictNonNullAssertions": false - }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "include": [ - "actual.ts" - ], - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null - ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null - ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" - }, - "postProcess": { - "shell": [ + "mutators": [ + [ + "fixImportExtensions", + null + ], [ - "node", - "./postProcess.cjs" + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [ + [ + "node", + "./postProcess.cjs" + ] ] - ] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + }, + "projectPath": "/tsconfig.json", + "types": {} + } +]" `; diff --git a/test/cases/cleanups/nonTypeErrors/expected.ts b/test/cases/cleanups/nonTypeErrors/expected.ts new file mode 100644 index 0000000000..db477cb1c0 --- /dev/null +++ b/test/cases/cleanups/nonTypeErrors/expected.ts @@ -0,0 +1,6 @@ +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag +import ts from "typescript"; +// @ts-expect-error -- TODO: Cannot find module './typestat.json'. Consider using '--resolveJsonModule' to import module with '.json' extension. +import config from "./typestat.json"; + +(function () {})(); diff --git a/test/cases/cleanups/nonTypeErrors/original.ts b/test/cases/cleanups/nonTypeErrors/original.ts new file mode 100644 index 0000000000..4792d6685a --- /dev/null +++ b/test/cases/cleanups/nonTypeErrors/original.ts @@ -0,0 +1,4 @@ +import ts from "typescript"; +import config from "./typestat.json"; + +(function () {})(); diff --git a/test/cases/cleanups/nonTypeErrors/tsconfig.json b/test/cases/cleanups/nonTypeErrors/tsconfig.json new file mode 100644 index 0000000000..2c5f1ded51 --- /dev/null +++ b/test/cases/cleanups/nonTypeErrors/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "esModuleInterop": true, + "strictNullChecks": true, + "resolveJsonModule": true + }, + "files": ["actual.ts"] +} diff --git a/test/cases/cleanups/nonTypeErrors/typestat.json b/test/cases/cleanups/nonTypeErrors/typestat.json new file mode 100644 index 0000000000..8a37358a9b --- /dev/null +++ b/test/cases/cleanups/nonTypeErrors/typestat.json @@ -0,0 +1,6 @@ +{ + "cleanups": { + "suppressTypeErrors": true + }, + "projectPath": "./tsconfig.json" +} diff --git a/test/cases/cleanups/suppressTypeErrors/expected.ts b/test/cases/cleanups/suppressTypeErrors/expected.ts index dd07e8f78d..29ab204918 100644 --- a/test/cases/cleanups/suppressTypeErrors/expected.ts +++ b/test/cases/cleanups/suppressTypeErrors/expected.ts @@ -1,3 +1,8 @@ +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag +import ts from "typescript"; +// @ts-expect-error -- TODO: Cannot find module './typestat.json'. Consider using '--resolveJsonModule' to import module with '.json' extension. +import config from "./typestat.json"; + (function () { // @ts-expect-error -- TODO: Type 'number' is not assignable to type 'string'. let incorrectSingle: string = 0; diff --git a/test/cases/cleanups/suppressTypeErrors/original.ts b/test/cases/cleanups/suppressTypeErrors/original.ts index c144374ede..0945363db0 100644 --- a/test/cases/cleanups/suppressTypeErrors/original.ts +++ b/test/cases/cleanups/suppressTypeErrors/original.ts @@ -1,3 +1,6 @@ +import ts from "typescript"; +import config from "./typestat.json"; + (function () { let incorrectSingle: string = 0; diff --git a/test/cases/custom mutators/empty/typestat.json b/test/cases/custom mutators/empty/typestat.json index d739833946..6baa52f77a 100644 --- a/test/cases/custom mutators/empty/typestat.json +++ b/test/cases/custom mutators/empty/typestat.json @@ -1,3 +1,6 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "mutators": [] } diff --git a/test/cases/custom mutators/one/typestat.json b/test/cases/custom mutators/one/typestat.json index b24b1ee59e..35cb8b2532 100644 --- a/test/cases/custom mutators/one/typestat.json +++ b/test/cases/custom mutators/one/typestat.json @@ -1,3 +1,6 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "mutators": ["./sampleMutator.cjs"] } diff --git a/test/cases/custom mutators/two/typestat.json b/test/cases/custom mutators/two/typestat.json index abbf7b2cdd..38215e64ac 100644 --- a/test/cases/custom mutators/two/typestat.json +++ b/test/cases/custom mutators/two/typestat.json @@ -1,3 +1,6 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "mutators": ["./mutator1.cjs", "./mutator2.cjs"] } diff --git a/test/cases/files/empty/typestat.json b/test/cases/files/empty/typestat.json index db23342b6d..786f69c75c 100644 --- a/test/cases/files/empty/typestat.json +++ b/test/cases/files/empty/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "files": { "above": "", "below": "" diff --git a/test/cases/filters/empty/typestat.json b/test/cases/filters/empty/typestat.json index 37854e3a6a..c72a33a837 100644 --- a/test/cases/filters/empty/typestat.json +++ b/test/cases/filters/empty/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "filters": [], "fixes": { "incompleteTypes": true, diff --git a/test/cases/filters/one/expected.ts b/test/cases/filters/one/expected.ts index 92fd4f60d7..6d9d165d59 100644 --- a/test/cases/filters/one/expected.ts +++ b/test/cases/filters/one/expected.ts @@ -1,5 +1,7 @@ (function () { + // the return type of this function should not be updated function one(): string { +// @ts-expect-error -- TODO: Type 'undefined' is not assignable to type 'string'. return undefined; } diff --git a/test/cases/filters/one/original.ts b/test/cases/filters/one/original.ts index 1c9e9d1f39..5ec2acf85a 100644 --- a/test/cases/filters/one/original.ts +++ b/test/cases/filters/one/original.ts @@ -1,4 +1,5 @@ (function () { + // the return type of this function should not be updated function one(): string { return undefined; } diff --git a/test/cases/filters/one/typestat.json b/test/cases/filters/one/typestat.json index 8f5b0bff87..e5d42e725f 100644 --- a/test/cases/filters/one/typestat.json +++ b/test/cases/filters/one/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "filters": ["FunctionDeclaration[name.text=one]"], "fixes": { "incompleteTypes": true, diff --git a/test/cases/filters/two/expected.ts b/test/cases/filters/two/expected.ts index 2adb4737a7..50db723e0b 100644 --- a/test/cases/filters/two/expected.ts +++ b/test/cases/filters/two/expected.ts @@ -2,7 +2,9 @@ class Foo { public value: number = 3; + // the return type of this function should not be updated dispose() { +// @ts-expect-error -- TODO: Type 'null' is not assignable to type 'number'. this.value = null; } } @@ -15,7 +17,9 @@ foo.value = 1; + // the return type of this function should not be updated teardown(() => { +// @ts-expect-error -- TODO: Type 'null' is not assignable to type 'Foo'. foo = null; }); })(); diff --git a/test/cases/filters/two/original.ts b/test/cases/filters/two/original.ts index 2adb4737a7..7d35a0f869 100644 --- a/test/cases/filters/two/original.ts +++ b/test/cases/filters/two/original.ts @@ -2,6 +2,7 @@ class Foo { public value: number = 3; + // the return type of this function should not be updated dispose() { this.value = null; } @@ -15,6 +16,7 @@ foo.value = 1; + // the return type of this function should not be updated teardown(() => { foo = null; }); diff --git a/test/cases/filters/two/typestat.json b/test/cases/filters/two/typestat.json index 391a1d4404..eb41e18e4e 100644 --- a/test/cases/filters/two/typestat.json +++ b/test/cases/filters/two/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "filters": [ "MethodDeclaration[name.text=dispose]", "CallExpression[expression.text=teardown]" diff --git a/test/cases/fixes/importExtensions/expected.ts b/test/cases/fixes/importExtensions/expected.ts index bcdd14321e..b471077159 100644 --- a/test/cases/fixes/importExtensions/expected.ts +++ b/test/cases/fixes/importExtensions/expected.ts @@ -1,7 +1,11 @@ +// @ts-expect-error -- TODO: Cannot find module './assets/direct.svg' or its corresponding type declarations. import direct from "./assets/direct.svg"; +// @ts-expect-error -- TODO: Cannot find module './assets/direct.svg' or its corresponding type declarations. export * as direct from "./assets/direct.svg"; +// @ts-expect-error -- TODO: Cannot find module './assets/withIndex.module.scss' or its corresponding type declarations. import * as withIndex from "./assets/withIndex.module.scss"; +// @ts-expect-error -- TODO: Cannot find module './assets/withIndex.module.scss' or its corresponding type declarations. export { withIndex } from "./assets/withIndex.module.scss"; import { foundDirect } from "./foundDirect"; @@ -10,5 +14,7 @@ export { foundDirect } from "./foundDirect"; import { foundIndirect } from "./foundIndirect"; export { foundIndirect } from "./foundIndirect"; +// @ts-expect-error -- TODO: Cannot find module './notfound' or its corresponding type declarations. import { notfound } from "./notfound"; +// @ts-expect-error -- TODO: Cannot find module './notfound' or its corresponding type declarations. export { notfound } from "./notfound"; diff --git a/test/cases/fixes/importExtensions/typestat.json b/test/cases/fixes/importExtensions/typestat.json index 04c1b9dc8c..15105ad28d 100644 --- a/test/cases/fixes/importExtensions/typestat.json +++ b/test/cases/fixes/importExtensions/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "importExtensions": true } diff --git a/test/cases/fixes/incompleteTypes/implicitGenerics/incompleteImplicitClassGenerics/typestat.json b/test/cases/fixes/incompleteTypes/implicitGenerics/incompleteImplicitClassGenerics/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/implicitGenerics/incompleteImplicitClassGenerics/typestat.json +++ b/test/cases/fixes/incompleteTypes/implicitGenerics/incompleteImplicitClassGenerics/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/implicitGenerics/incompleteImplicitVariableGenerics/typestat.json b/test/cases/fixes/incompleteTypes/implicitGenerics/incompleteImplicitVariableGenerics/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/implicitGenerics/incompleteImplicitVariableGenerics/typestat.json +++ b/test/cases/fixes/incompleteTypes/implicitGenerics/incompleteImplicitVariableGenerics/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/interfaceOrTypeLiteralGenerics/typestat.json b/test/cases/fixes/incompleteTypes/interfaceOrTypeLiteralGenerics/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/interfaceOrTypeLiteralGenerics/typestat.json +++ b/test/cases/fixes/incompleteTypes/interfaceOrTypeLiteralGenerics/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/nonGenericInterfaceAsTypeArgument/typestat.json b/test/cases/fixes/incompleteTypes/nonGenericInterfaceAsTypeArgument/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/nonGenericInterfaceAsTypeArgument/typestat.json +++ b/test/cases/fixes/incompleteTypes/nonGenericInterfaceAsTypeArgument/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/parameterTypes/typestat.json b/test/cases/fixes/incompleteTypes/parameterTypes/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/parameterTypes/typestat.json +++ b/test/cases/fixes/incompleteTypes/parameterTypes/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/propertyDeclarationTypes/typestat.json b/test/cases/fixes/incompleteTypes/propertyDeclarationTypes/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/propertyDeclarationTypes/typestat.json +++ b/test/cases/fixes/incompleteTypes/propertyDeclarationTypes/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/notReactProps/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/notReactProps/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/notReactProps/typestat.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/notReactProps/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropFunctionsFromCalls/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropFunctionsFromCalls/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropFunctionsFromCalls/typestat.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropFunctionsFromCalls/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/expected.tsx b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/expected.tsx index 443d5c755b..a4f17487db 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/expected.tsx +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/expected.tsx @@ -1,3 +1,4 @@ +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag import React from "react"; (function () { @@ -8,10 +9,12 @@ text?: string; class ClassComponent extends React.Component { render() { +// @ts-expect-error -- TODO: Property 'props' does not exist on type 'ClassComponent'. return this.props.text; } } +// @ts-expect-error -- TODO: JSX element class does not support attributes because it does not have a 'props' property. Cannot use JSX unless the '--jsx' flag is provided. 'ClassComponent' cannot be used as a JSX component. const renderClassComponent = (text: string) => ; type FunctionComponentProps = { @@ -21,11 +24,13 @@ texts?: string[]; class FunctionComponent extends React.Component { render() { +// @ts-expect-error -- TODO: Property 'props' does not exist on type 'FunctionComponent'. return this.props.texts.join(""); } } const renderFunctionComponent = (texts: string[]) => ( +// @ts-expect-error -- TODO: JSX element class does not support attributes because it does not have a 'props' property. Cannot use JSX unless the '--jsx' flag is provided. 'FunctionComponent' cannot be used as a JSX component. ); @@ -37,6 +42,7 @@ texts?: string[]; class WithFunctions extends React.Component {} const withFunctions = ( +// @ts-expect-error -- TODO: JSX element class does not support attributes because it does not have a 'props' property. Cannot use JSX unless the '--jsx' flag is provided. 'WithFunctions' cannot be used as a JSX component. false} returnsStringOrNumber={() => 0} diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/tsconfig.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/tsconfig.json index 8dd234eaf2..62f9fc0c60 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/tsconfig.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/tsconfig.json @@ -1,3 +1,7 @@ { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react" + }, "files": ["actual.tsx"] } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/typestat.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/expected.tsx b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/expected.tsx index 8bc657c8ff..57142fe4e6 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/expected.tsx +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/expected.tsx @@ -1,4 +1,6 @@ +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag import React from "react"; +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag import PropTypes from "prop-types"; (function () { @@ -129,8 +131,68 @@ interface LaterAssignedComponentProps { } } +// @ts-expect-error -- TODO: Property 'propTypes' does not exist on type 'typeof LaterAssignedComponent'. LaterAssignedComponent.propTypes = { string: PropTypes.string, stringRequired: PropTypes.string.isRequired, }; + +interface GreetingProps { + name?: string; +} + + + class Greeting extends React.Component { + render() { +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. Property 'props' does not exist on type 'Greeting'. + return

Hello, {this.props.name}

; + } + } + +// @ts-expect-error -- TODO: Property 'propTypes' does not exist on type 'typeof Greeting'. + Greeting.propTypes = { + name: PropTypes.string, + }; + +interface HelloWorldComponentProps { + name?: string; +} + +interface HelloWorldComponentProps { + name?: string; +} + + + + // TODO: The mutation for this is incorrect + function HelloWorldComponent({ name }: HelloWorldComponentProps: HelloWorldComponentProps) { +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. + return
Hello, {name}
; + } + + HelloWorldComponent.propTypes = { + name: PropTypes.string, + }; + +interface HeadingProps { + text?: string; +} + +interface HeadingProps { + text?: string; +} + + + + // TODO: The mutation for this is incorrect + function Heading({ text }: HeadingProps: HeadingProps) { +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. + return

{text}

; + } + Heading.propTypes = { + text: PropTypes.string, + }; + Heading.defaultProps = { + text: "Hello, world!", + }; })(); diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/original.tsx b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/original.tsx index f65c325b3c..08f37a0d1a 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/original.tsx +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/original.tsx @@ -75,4 +75,34 @@ import PropTypes from "prop-types"; string: PropTypes.string, stringRequired: PropTypes.string.isRequired, }; + + class Greeting extends React.Component { + render() { + return

Hello, {this.props.name}

; + } + } + + Greeting.propTypes = { + name: PropTypes.string, + }; + + // TODO: The mutation for this is incorrect + function HelloWorldComponent({ name }) { + return
Hello, {name}
; + } + + HelloWorldComponent.propTypes = { + name: PropTypes.string, + }; + + // TODO: The mutation for this is incorrect + function Heading({ text }) { + return

{text}

; + } + Heading.propTypes = { + text: PropTypes.string, + }; + Heading.defaultProps = { + text: "Hello, world!", + }; })(); diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/tsconfig.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/tsconfig.json index 8dd234eaf2..c01f2cb6be 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/tsconfig.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/tsconfig.json @@ -1,3 +1,8 @@ { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react", + "target": "ES2022" + }, "files": ["actual.tsx"] } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/typestat.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/expected.tsx b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/expected.tsx index ddf7087ba6..671293d365 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/expected.tsx +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/expected.tsx @@ -1,4 +1,6 @@ +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag import React from "react"; +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag import PropTypes from "prop-types"; (function () { diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/tsconfig.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/tsconfig.json index 8dd234eaf2..62f9fc0c60 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/tsconfig.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/tsconfig.json @@ -1,3 +1,7 @@ { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react" + }, "files": ["actual.tsx"] } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/typestat.json index a5a0aa30df..3313dc2027 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/typestat.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true }, diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/expected.tsx b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/expected.tsx index f347d10bc2..7ff7ad33f5 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/expected.tsx +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/expected.tsx @@ -1,4 +1,6 @@ +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag import React from "react"; +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag import PropTypes from "prop-types"; (function () { diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/tsconfig.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/tsconfig.json index 8dd234eaf2..62f9fc0c60 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/tsconfig.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/tsconfig.json @@ -1,3 +1,7 @@ { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react" + }, "files": ["actual.tsx"] } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/typestat.json index 9485eaf370..983a935416 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/typestat.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true }, diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/expected.tsx b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/expected.tsx index f347d10bc2..7ff7ad33f5 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/expected.tsx +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/expected.tsx @@ -1,4 +1,6 @@ +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag import React from "react"; +// @ts-expect-error -- TODO: This module can only be default-imported using the 'esModuleInterop' flag import PropTypes from "prop-types"; (function () { diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/tsconfig.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/tsconfig.json index 8dd234eaf2..62f9fc0c60 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/tsconfig.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/tsconfig.json @@ -1,3 +1,7 @@ { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react" + }, "files": ["actual.tsx"] } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/typestat.json index 91b1e297fe..42e8c56e13 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/typestat.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true }, diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromUses/expected.tsx b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromUses/expected.tsx index 9e8827098f..d3b38793b0 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromUses/expected.tsx +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromUses/expected.tsx @@ -30,11 +30,13 @@ import * as React from "react"; useTakesString(takesStringCall); const withReturnsString = ( +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. ); +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. return ; } } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromUses/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromUses/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromUses/typestat.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromUses/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsMissing/expected.tsx b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsMissing/expected.tsx index 8852fe65d5..7d36813218 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsMissing/expected.tsx +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsMissing/expected.tsx @@ -19,22 +19,37 @@ isNumberOrStringArray?: number[] | string[] | (string | number)[]; isObject?: SomeValue; } +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. const ManyProps = (props: ManyPropsProps) =>
; const renderManyProps = () => [ +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. , ]; @@ -44,10 +59,12 @@ prop: number[]; const SinglePropArrowFunction = ({ prop }: SinglePropArrowFunctionProps) => { console.log(prop); +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. return
; }; const renderSinglePropArrowFunction = () => ( +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. ); @@ -57,10 +74,12 @@ prop: number[]; const SinglePropFunctionExpressionAnonymous = function ({ prop }: SinglePropFunctionExpressionAnonymousProps) { console.log(prop); +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. return
; }; const renderSinglePropFunctionExpressionAnonymous = () => ( +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. ); @@ -72,10 +91,12 @@ prop: number[]; prop, }: FunctionExpressionNamedProps) { console.log(prop); +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. return
; }; const renderSinglePropFunctionExpressionNamed = () => ( +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. ); @@ -85,11 +106,13 @@ prop: number[]; const SinglePropClassExpression = class extends React.Component { render() { +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. return
; } }; const renderSinglePropClassExpression = () => ( +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. ); @@ -99,11 +122,13 @@ prop: number[]; class SinglePropClassDeclaration extends React.Component { render() { +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. return
; } } const renderSinglePropClassDeclaration = () => ( +// @ts-expect-error -- TODO: Cannot use JSX unless the '--jsx' flag is provided. ); })(); diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsMissing/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsMissing/typestat.json index 1406ae0fa5..7d43d990c7 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsMissing/typestat.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsMissing/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true } diff --git a/test/cases/fixes/incompleteTypes/returnTypes/expected.ts b/test/cases/fixes/incompleteTypes/returnTypes/expected.ts index 5bd71f1192..50b7b56d2c 100644 --- a/test/cases/fixes/incompleteTypes/returnTypes/expected.ts +++ b/test/cases/fixes/incompleteTypes/returnTypes/expected.ts @@ -85,16 +85,19 @@ return ""; }; +// @ts-expect-error -- TODO: Type 'boolean | Promise' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. async function navigateTo(): Promise | boolean { return await new Promise(() => ""); } function navigateByUrl(url: string): Promise; - async function navigateTo(): Promise | boolean { +// @ts-expect-error -- TODO: Function implementation name must be 'navigateByUrl'. Type 'boolean | Promise' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. + async function navigateTo3(): Promise | boolean { return await navigateByUrl(""); } +// @ts-expect-error -- TODO: Type 'boolean | Promise' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. async function navigateTo2(): Promise | boolean { const navigated = await navigateByUrl(""); return navigated; @@ -113,6 +116,7 @@ }; const returnsBigintOrNumber = (): number | bigint => { +// @ts-expect-error -- TODO: BigInt literals are not available when targeting lower than ES2020. return 123n; }; diff --git a/test/cases/fixes/incompleteTypes/returnTypes/original.ts b/test/cases/fixes/incompleteTypes/returnTypes/original.ts index 34ed834563..076d5c480e 100644 --- a/test/cases/fixes/incompleteTypes/returnTypes/original.ts +++ b/test/cases/fixes/incompleteTypes/returnTypes/original.ts @@ -91,7 +91,7 @@ function navigateByUrl(url: string): Promise; - async function navigateTo(): Promise { + async function navigateTo3(): Promise { return await navigateByUrl(""); } diff --git a/test/cases/fixes/incompleteTypes/returnTypes/tsconfig.json b/test/cases/fixes/incompleteTypes/returnTypes/tsconfig.json index 7de2b9de32..8ee171cbe0 100644 --- a/test/cases/fixes/incompleteTypes/returnTypes/tsconfig.json +++ b/test/cases/fixes/incompleteTypes/returnTypes/tsconfig.json @@ -1,3 +1,6 @@ { + "compilerOptions": { + "target": "ES2020" + }, "files": ["actual.ts"] } diff --git a/test/cases/fixes/incompleteTypes/returnTypes/typestat.json b/test/cases/fixes/incompleteTypes/returnTypes/typestat.json index e11c754dfe..7e86348177 100644 --- a/test/cases/fixes/incompleteTypes/returnTypes/typestat.json +++ b/test/cases/fixes/incompleteTypes/returnTypes/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true }, diff --git a/test/cases/fixes/incompleteTypes/variableTypes/expected.tsx b/test/cases/fixes/incompleteTypes/variableTypes/expected.ts similarity index 90% rename from test/cases/fixes/incompleteTypes/variableTypes/expected.tsx rename to test/cases/fixes/incompleteTypes/variableTypes/expected.ts index 353c9284a2..cd19f1c880 100644 --- a/test/cases/fixes/incompleteTypes/variableTypes/expected.tsx +++ b/test/cases/fixes/incompleteTypes/variableTypes/expected.ts @@ -1,9 +1,8 @@ -import * as React from "react"; - (function () { // Primitives let givenUndefined = ""; +// @ts-expect-error -- TODO: Type 'undefined' is not assignable to type 'string'. givenUndefined = undefined; let givenUndefinedAsString: string | undefined = ""; @@ -17,6 +16,7 @@ import * as React from "react"; givenNullAndUndefinedHasNull = undefined; let givenNull = ""; +// @ts-expect-error -- TODO: Type 'null' is not assignable to type 'string'. givenNull = null; let givenNullAsString: string | null = ""; @@ -107,12 +107,14 @@ import * as React from "react"; let onlyClassOneExplicitInterface: SampleInterface = new SampleClassOne(); let eitherClassImplicit = new SampleClassOne(); +// @ts-expect-error -- TODO: Type 'SampleClassTwo' is not assignable to type 'SampleClassOne'. eitherClassImplicit = new SampleClassTwo(); let eitherClassExplicit: SampleInterface = new SampleClassOne(); eitherClassExplicit = new SampleClassTwo(); let eitherClassNeedsUnionImplicit = new SampleClassOne(); +// @ts-expect-error -- TODO: Type 'SampleClassTwo' is not assignable to type 'SampleClassOne'. eitherClassNeedsUnionImplicit = new SampleClassTwo(); let eitherClassNeedsUnionExplicit: SampleClassOne | SampleClassTwo = new SampleClassOne(); @@ -123,7 +125,9 @@ import * as React from "react"; eitherClassNeedsUnionExplicitInterface = new SampleClassTwo(); let eitherClassNeedsNullImplicit = new SampleClassOne(); +// @ts-expect-error -- TODO: Type 'SampleClassTwo' is not assignable to type 'SampleClassOne'. eitherClassNeedsNullImplicit = new SampleClassTwo(); +// @ts-expect-error -- TODO: Type 'null' is not assignable to type 'SampleClassOne'. eitherClassNeedsNullImplicit = null; let eitherClassNeedsNullAndClassExplicit: SampleClassOne | null | SampleClassTwo = @@ -187,14 +191,4 @@ import * as React from "react"; let returnsStringOrNumber: (() => string) | (() => number); returnsStringOrNumber = () => ""; returnsStringOrNumber = () => 0; - - // Predeclared functions (React FCs) - - interface MyComponentProps { - text: string; - } - - const MyComponent: React.FC = ({ text }) => { - return {text}; - }; })(); diff --git a/test/cases/fixes/incompleteTypes/variableTypes/original.tsx b/test/cases/fixes/incompleteTypes/variableTypes/original.ts similarity index 95% rename from test/cases/fixes/incompleteTypes/variableTypes/original.tsx rename to test/cases/fixes/incompleteTypes/variableTypes/original.ts index 00532aca44..ff0963053a 100644 --- a/test/cases/fixes/incompleteTypes/variableTypes/original.tsx +++ b/test/cases/fixes/incompleteTypes/variableTypes/original.ts @@ -1,5 +1,3 @@ -import * as React from "react"; - (function () { // Primitives @@ -187,14 +185,4 @@ import * as React from "react"; let returnsStringOrNumber: Function; returnsStringOrNumber = () => ""; returnsStringOrNumber = () => 0; - - // Predeclared functions (React FCs) - - interface MyComponentProps { - text: string; - } - - const MyComponent: React.FC = ({ text }) => { - return {text}; - }; })(); diff --git a/test/cases/fixes/incompleteTypes/variableTypes/tsconfig.json b/test/cases/fixes/incompleteTypes/variableTypes/tsconfig.json index 8dd234eaf2..7de2b9de32 100644 --- a/test/cases/fixes/incompleteTypes/variableTypes/tsconfig.json +++ b/test/cases/fixes/incompleteTypes/variableTypes/tsconfig.json @@ -1,3 +1,3 @@ { - "files": ["actual.tsx"] + "files": ["actual.ts"] } diff --git a/test/cases/fixes/incompleteTypes/variableTypes/typestat.json b/test/cases/fixes/incompleteTypes/variableTypes/typestat.json index e11c754dfe..7e86348177 100644 --- a/test/cases/fixes/incompleteTypes/variableTypes/typestat.json +++ b/test/cases/fixes/incompleteTypes/variableTypes/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true }, diff --git a/test/cases/fixes/missingProperties/missingPropertyAccesses/expected.ts b/test/cases/fixes/missingProperties/missingPropertyAccesses/expected.ts index 8d6e3c08db..b68b59e783 100644 --- a/test/cases/fixes/missingProperties/missingPropertyAccesses/expected.ts +++ b/test/cases/fixes/missingProperties/missingPropertyAccesses/expected.ts @@ -15,6 +15,7 @@ private _withGetterAndSetter: string; this.givenTwiceSame = 1; this.givenTwiceDifferent = 1; +// @ts-expect-error -- TODO: Type 'undefined' is not assignable to type 'number'. this.givenTwiceDifferent = undefined; } diff --git a/test/cases/fixes/missingProperties/missingPropertyAccesses/typestat.json b/test/cases/fixes/missingProperties/missingPropertyAccesses/typestat.json index 3426e95139..099fe388b8 100644 --- a/test/cases/fixes/missingProperties/missingPropertyAccesses/typestat.json +++ b/test/cases/fixes/missingProperties/missingPropertyAccesses/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "missingProperties": true }, diff --git a/test/cases/fixes/noImplicitAny/parameters/expected.ts b/test/cases/fixes/noImplicitAny/parameters/expected.ts index 5bbb9fc213..0bed60e68e 100644 --- a/test/cases/fixes/noImplicitAny/parameters/expected.ts +++ b/test/cases/fixes/noImplicitAny/parameters/expected.ts @@ -15,14 +15,17 @@ console.log(abc); } +// @ts-expect-error -- TODO: Argument of type 'string | null' is not assignable to parameter of type 'string'. givenStringOrNullOnStringTypeLater("" as string | null); function givenStringOrUndefinedOnStringTypeLater(abc: string): void { console.log(abc); } +// @ts-expect-error -- TODO: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. givenStringOrUndefinedOnStringTypeLater("" as string | undefined); +// @ts-expect-error -- TODO: Parameter 'abc' implicitly has an 'any' type. function givenNullTypeLater(abc): void { console.log(abc); } @@ -35,18 +38,21 @@ givenUndefinedTypeLater(undefined); +// @ts-expect-error -- TODO: Parameter 'abc' implicitly has an 'any' type. function givenAnyTypeLater(abc): void { console.log(abc); } givenAnyTypeLater({} as any); +// @ts-expect-error -- TODO: Parameter 'abc' implicitly has an 'any' type. function givenEmptyObjectLiteralTypeLater(abc): void { console.log(abc); } givenEmptyObjectLiteralTypeLater({}); +// @ts-expect-error -- TODO: Parameter 'abc' implicitly has an 'any' type. function givenObjectTypeLater(abc): void { console.log(abc); } diff --git a/test/cases/fixes/noImplicitAny/parameters/typestat.json b/test/cases/fixes/noImplicitAny/parameters/typestat.json index 1d38563258..f144bf7c58 100644 --- a/test/cases/fixes/noImplicitAny/parameters/typestat.json +++ b/test/cases/fixes/noImplicitAny/parameters/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "noImplicitAny": true }, diff --git a/test/cases/fixes/noImplicitAny/propertyDeclarations/typestat.json b/test/cases/fixes/noImplicitAny/propertyDeclarations/typestat.json index e11c754dfe..7e86348177 100644 --- a/test/cases/fixes/noImplicitAny/propertyDeclarations/typestat.json +++ b/test/cases/fixes/noImplicitAny/propertyDeclarations/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true }, diff --git a/test/cases/fixes/noImplicitAny/variableDeclarations/expected.ts b/test/cases/fixes/noImplicitAny/variableDeclarations/expected.ts index 2ca602989f..8c85d9f52f 100644 --- a/test/cases/fixes/noImplicitAny/variableDeclarations/expected.ts +++ b/test/cases/fixes/noImplicitAny/variableDeclarations/expected.ts @@ -2,6 +2,7 @@ // Primitives let givenUndefined = ""; +// @ts-expect-error -- TODO: Type 'undefined' is not assignable to type 'string'. givenUndefined = undefined; let givenUndefinedAsString: string | undefined = ""; @@ -15,6 +16,7 @@ givenNullAndUndefinedHasNull = undefined; let givenNull = ""; +// @ts-expect-error -- TODO: Type 'null' is not assignable to type 'string'. givenNull = null; let givenNullAsString: string | null = ""; @@ -74,9 +76,11 @@ // Void and undefined +// @ts-expect-error -- TODO: Type 'void' is not assignable to type 'undefined'. let startsUndefinedWithVoid: undefined = ((): void => {})(); let startsUndefinedGivenVoid: undefined; +// @ts-expect-error -- TODO: Type 'void' is not assignable to type 'undefined'. startsUndefinedGivenVoid = ((): void => {})(); let startsVoidWithUndefined: void = undefined; @@ -122,12 +126,14 @@ let onlyClassOneExplicitInterface: SampleInterface = new SampleClassOne(); let eitherClassImplicit = new SampleClassOne(); +// @ts-expect-error -- TODO: Type 'SampleClassTwo' is not assignable to type 'SampleClassOne'. eitherClassImplicit = new SampleClassTwo(); let eitherClassExplicit: SampleInterface = new SampleClassOne(); eitherClassExplicit = new SampleClassTwo(); let eitherClassNeedsUnionImplicit = new SampleClassOne(); +// @ts-expect-error -- TODO: Type 'SampleClassTwo' is not assignable to type 'SampleClassOne'. eitherClassNeedsUnionImplicit = new SampleClassTwo(); let eitherClassNeedsUnionExplicit: SampleClassOne | SampleClassTwo = new SampleClassOne(); @@ -138,7 +144,9 @@ eitherClassNeedsUnionExplicitInterface = new SampleClassTwo(); let eitherClassNeedsNullImplicit = new SampleClassOne(); +// @ts-expect-error -- TODO: Type 'SampleClassTwo' is not assignable to type 'SampleClassOne'. eitherClassNeedsNullImplicit = new SampleClassTwo(); +// @ts-expect-error -- TODO: Type 'null' is not assignable to type 'SampleClassOne'. eitherClassNeedsNullImplicit = null; let eitherClassNeedsNullAndClassExplicit: SampleClassOne | null | SampleClassTwo = diff --git a/test/cases/fixes/noImplicitAny/variableDeclarations/typestat.json b/test/cases/fixes/noImplicitAny/variableDeclarations/typestat.json index e11c754dfe..7e86348177 100644 --- a/test/cases/fixes/noImplicitAny/variableDeclarations/typestat.json +++ b/test/cases/fixes/noImplicitAny/variableDeclarations/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "incompleteTypes": true }, diff --git a/test/cases/fixes/noImplicitThis/typestat.json b/test/cases/fixes/noImplicitThis/typestat.json index 3944d4ff52..5112c523c7 100644 --- a/test/cases/fixes/noImplicitThis/typestat.json +++ b/test/cases/fixes/noImplicitThis/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "noImplicitThis": true }, diff --git a/test/cases/fixes/noInferableTypes/parameters/typestat.json b/test/cases/fixes/noInferableTypes/parameters/typestat.json index 474bec31a1..fbf74a5aa8 100644 --- a/test/cases/fixes/noInferableTypes/parameters/typestat.json +++ b/test/cases/fixes/noInferableTypes/parameters/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "noInferableTypes": true }, diff --git a/test/cases/fixes/noInferableTypes/propertyDeclarations/typestat.json b/test/cases/fixes/noInferableTypes/propertyDeclarations/typestat.json index 474bec31a1..fbf74a5aa8 100644 --- a/test/cases/fixes/noInferableTypes/propertyDeclarations/typestat.json +++ b/test/cases/fixes/noInferableTypes/propertyDeclarations/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "noInferableTypes": true }, diff --git a/test/cases/fixes/noInferableTypes/variableDeclarations/typestat.json b/test/cases/fixes/noInferableTypes/variableDeclarations/typestat.json index 474bec31a1..fbf74a5aa8 100644 --- a/test/cases/fixes/noInferableTypes/variableDeclarations/typestat.json +++ b/test/cases/fixes/noInferableTypes/variableDeclarations/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "noInferableTypes": true }, diff --git a/test/cases/fixes/strictNonNullAssertions/binaryExpressions/typestat.json b/test/cases/fixes/strictNonNullAssertions/binaryExpressions/typestat.json index d8bca1f5b2..0716acd539 100644 --- a/test/cases/fixes/strictNonNullAssertions/binaryExpressions/typestat.json +++ b/test/cases/fixes/strictNonNullAssertions/binaryExpressions/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "strictNonNullAssertions": true }, diff --git a/test/cases/fixes/strictNonNullAssertions/callExpressions/expected.ts b/test/cases/fixes/strictNonNullAssertions/callExpressions/expected.ts index cbb6d591af..36272fa857 100644 --- a/test/cases/fixes/strictNonNullAssertions/callExpressions/expected.ts +++ b/test/cases/fixes/strictNonNullAssertions/callExpressions/expected.ts @@ -57,6 +57,7 @@ let textSibling: string | undefined = ""; let textChild: string | undefined = ""; +// @ts-expect-error -- TODO: Argument of type 'undefined' is not assignable to parameter of type 'string'. takesString(emptyExplicitSibling); takesString(emptyImplicitSibling); takesString(textSibling); diff --git a/test/cases/fixes/strictNonNullAssertions/callExpressions/typestat.json b/test/cases/fixes/strictNonNullAssertions/callExpressions/typestat.json index d8bca1f5b2..0716acd539 100644 --- a/test/cases/fixes/strictNonNullAssertions/callExpressions/typestat.json +++ b/test/cases/fixes/strictNonNullAssertions/callExpressions/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "strictNonNullAssertions": true }, diff --git a/test/cases/fixes/strictNonNullAssertions/objectLiterals/typestat.json b/test/cases/fixes/strictNonNullAssertions/objectLiterals/typestat.json index d8bca1f5b2..0716acd539 100644 --- a/test/cases/fixes/strictNonNullAssertions/objectLiterals/typestat.json +++ b/test/cases/fixes/strictNonNullAssertions/objectLiterals/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "strictNonNullAssertions": true }, diff --git a/test/cases/fixes/strictNonNullAssertions/propertyAccesses/expected.ts b/test/cases/fixes/strictNonNullAssertions/propertyAccesses/expected.ts index 59ad19dd95..713a799a05 100644 --- a/test/cases/fixes/strictNonNullAssertions/propertyAccesses/expected.ts +++ b/test/cases/fixes/strictNonNullAssertions/propertyAccesses/expected.ts @@ -1,15 +1,15 @@ (function () { - declare const value: string | undefined; + let value: string | undefined; value!.length; value?.length; - declare const valueAny: any; + let valueAny: any; valueAny.length; valueAny?.length; - declare const valueAnyOrUndefined: any | undefined; + let valueAnyOrUndefined: any | undefined; valueAnyOrUndefined.length; valueAnyOrUndefined?.length; @@ -58,12 +58,16 @@ givenStringHasUndefined: string | undefined = ""; +// @ts-expect-error -- TODO: Type 'undefined' is not assignable to type 'string'. setToUndefined: string = undefined; +// @ts-expect-error -- TODO: Type 'undefined' is not assignable to type 'string | null'. setToUndefinedHasNull: string | null = undefined; +// @ts-expect-error -- TODO: Type 'null' is not assignable to type 'string'. setToNull: string = null; +// @ts-expect-error -- TODO: Type 'null' is not assignable to type 'string | undefined'. setToNullHasUndefined: string | undefined = null; setToString: string = ""; diff --git a/test/cases/fixes/strictNonNullAssertions/propertyAccesses/original.ts b/test/cases/fixes/strictNonNullAssertions/propertyAccesses/original.ts index c89a90b76c..7e4257c13a 100644 --- a/test/cases/fixes/strictNonNullAssertions/propertyAccesses/original.ts +++ b/test/cases/fixes/strictNonNullAssertions/propertyAccesses/original.ts @@ -1,15 +1,15 @@ (function () { - declare const value: string | undefined; + let value: string | undefined; value.length; value?.length; - declare const valueAny: any; + let valueAny: any; valueAny.length; valueAny?.length; - declare const valueAnyOrUndefined: any | undefined; + let valueAnyOrUndefined: any | undefined; valueAnyOrUndefined.length; valueAnyOrUndefined?.length; diff --git a/test/cases/fixes/strictNonNullAssertions/propertyAccesses/typestat.json b/test/cases/fixes/strictNonNullAssertions/propertyAccesses/typestat.json index d8bca1f5b2..0716acd539 100644 --- a/test/cases/fixes/strictNonNullAssertions/propertyAccesses/typestat.json +++ b/test/cases/fixes/strictNonNullAssertions/propertyAccesses/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "strictNonNullAssertions": true }, diff --git a/test/cases/fixes/strictNonNullAssertions/returnTypes/typestat.json b/test/cases/fixes/strictNonNullAssertions/returnTypes/typestat.json index d8bca1f5b2..0716acd539 100644 --- a/test/cases/fixes/strictNonNullAssertions/returnTypes/typestat.json +++ b/test/cases/fixes/strictNonNullAssertions/returnTypes/typestat.json @@ -1,4 +1,7 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "fixes": { "strictNonNullAssertions": true }, diff --git a/test/cases/include/asterisk/typestat.json b/test/cases/include/asterisk/typestat.json index b24b1ee59e..35cb8b2532 100644 --- a/test/cases/include/asterisk/typestat.json +++ b/test/cases/include/asterisk/typestat.json @@ -1,3 +1,6 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "mutators": ["./sampleMutator.cjs"] } diff --git a/test/cases/include/directory/typestat.json b/test/cases/include/directory/typestat.json index b24b1ee59e..35cb8b2532 100644 --- a/test/cases/include/directory/typestat.json +++ b/test/cases/include/directory/typestat.json @@ -1,3 +1,6 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "mutators": ["./sampleMutator.cjs"] } diff --git a/test/cases/infinite wave detection/typestat.json b/test/cases/infinite wave detection/typestat.json index dfe7867a0b..2157f3e009 100644 --- a/test/cases/infinite wave detection/typestat.json +++ b/test/cases/infinite wave detection/typestat.json @@ -1,3 +1,6 @@ { + "cleanups": { + "suppressTypeErrors": true + }, "mutators": ["./infiniteMutator.cjs"] } diff --git a/test/cases/post processing/postProcess.cjs b/test/cases/post processing/postProcess.cjs index b1e9fe3157..2deffd3eba 100644 --- a/test/cases/post processing/postProcess.cjs +++ b/test/cases/post processing/postProcess.cjs @@ -1,5 +1,5 @@ const fs = require("node:fs/promises"); -const { EOL } = require("os"); +const { EOL } = require("node:os"); const writeToFiles = async () => { for (const filePath of process.argv.slice(2)) { diff --git a/test/cleanups.test.ts b/test/cleanups.test.ts index 60a1e687ff..7046075414 100644 --- a/test/cleanups.test.ts +++ b/test/cleanups.test.ts @@ -14,4 +14,15 @@ describe("Cleanups", () => { await expect(actualContent).toMatchFileSnapshot(expectedFilePath); expect(options).toMatchSnapshot("options"); }); + + it("non-TypeErrors", async () => { + const caseDir = path.join( + import.meta.dirname, + "cases/cleanups/nonTypeErrors", + ); + const { actualContent, expectedFilePath, options } = + await runMutationTest(caseDir); + await expect(actualContent).toMatchFileSnapshot(expectedFilePath); + expect(options).toMatchSnapshot("options"); + }, 6000); }); diff --git a/test/files.test.ts b/test/files.test.ts index dd1ed8d5ca..2daeaee347 100644 --- a/test/files.test.ts +++ b/test/files.test.ts @@ -10,7 +10,7 @@ describe("files", () => { await runMutationTest(caseDir); await expect(actualContent).toMatchFileSnapshot(expectedFilePath); expect(options).toMatchSnapshot("options"); - }, 50000); + }, 7000); it("addition below", async () => { const caseDir = path.join(import.meta.dirname, "cases/files/below"); @@ -18,7 +18,7 @@ describe("files", () => { await runMutationTest(caseDir); await expect(actualContent).toMatchFileSnapshot(expectedFilePath); expect(options).toMatchSnapshot("options"); - }, 50000); + }, 7000); it("both", async () => { const caseDir = path.join(import.meta.dirname, "cases/files/both"); @@ -26,7 +26,7 @@ describe("files", () => { await runMutationTest(caseDir); await expect(actualContent).toMatchFileSnapshot(expectedFilePath); expect(options).toMatchSnapshot("options"); - }); + }, 7000); it("empty addition", async () => { const caseDir = path.join(import.meta.dirname, "cases/files/empty"); @@ -34,5 +34,5 @@ describe("files", () => { await runMutationTest(caseDir); await expect(actualContent).toMatchFileSnapshot(expectedFilePath); expect(options).toMatchSnapshot("options"); - }); + }, 7000); }); diff --git a/test/fixStrictNonNullAssertions.test.ts b/test/fixStrictNonNullAssertions.test.ts index f934f38158..651a56dee2 100644 --- a/test/fixStrictNonNullAssertions.test.ts +++ b/test/fixStrictNonNullAssertions.test.ts @@ -13,7 +13,7 @@ describe("strictNonNullAssertions", () => { await runMutationTest(caseDir); await expect(actualContent).toMatchFileSnapshot(expectedFilePath); expect(options).toMatchSnapshot("options"); - }); + }, 10000); it("callExpressions", async () => { const caseDir = path.join(