diff --git a/package.json b/package.json index de8971d03..a7b24fafb 100644 --- a/package.json +++ b/package.json @@ -43,14 +43,12 @@ "commander": "^12.0.0", "enquirer": "^2.4.1", "glob": "^10.3.10", - "minimatch": "^9.0.3", "strip-ansi": "^7.1.0", "ts-api-utils": "^1.3.0" }, "devDependencies": { "@types/eslint": "^8.56.6", "@types/glob": "8.1.0", - "@types/minimatch": "^5.1.2", "@types/node": "^20.11.30", "@types/prop-types": "15.7.12", "@types/react": "18.2.74", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bf032b782..c050920b2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,9 +26,6 @@ dependencies: glob: specifier: ^10.3.10 version: 10.3.12 - minimatch: - specifier: ^9.0.3 - version: 9.0.4 strip-ansi: specifier: ^7.1.0 version: 7.1.0 @@ -43,9 +40,6 @@ devDependencies: '@types/glob': specifier: 8.1.0 version: 8.1.0 - '@types/minimatch': - specifier: ^5.1.2 - version: 5.1.2 '@types/node': specifier: ^20.11.30 version: 20.12.4 diff --git a/src/cleanups/builtin/suppressTypeErrors/index.ts b/src/cleanups/builtin/suppressTypeErrors/index.ts index 928c11c78..60bbeb051 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/cli/runCli.ts b/src/cli/runCli.ts index e598d757c..174257ba6 100644 --- a/src/cli/runCli.ts +++ b/src/cli/runCli.ts @@ -63,7 +63,7 @@ export const runCli = async ( let result: TypeStatResult; try { - result = await runtime.mainRunner(rawOptions, runtime.output); + result = await runtime.mainRunner(rawOptions.config, runtime.output); } catch (error) { result = { error: error instanceof Error ? error : new Error(error as string), diff --git a/src/collectFileNames.test.ts b/src/collectFileNames.test.ts new file mode 100644 index 000000000..795e7f7bf --- /dev/null +++ b/src/collectFileNames.test.ts @@ -0,0 +1,34 @@ +import path from "node:path"; +import { describe, expect, it } from "vitest"; + +import { collectFileNames } from "./collectFileNames.js"; + +describe("collectFileNames", () => { + it("should collect files with wildcard", async () => { + const cwd = path.resolve(import.meta.dirname, ".."); + const fileNames = await collectFileNames( + path.resolve(import.meta.dirname), + ["*"], + ); + const names = Array.isArray(fileNames) + ? (fileNames as string[]).map((item) => item.replace(cwd, "")) + : undefined; + + // Assert + expect(names).toContain("/src/collectFileNames.test.ts"); + }); + + it("return error if node modules are included", async () => { + const cwd = path.resolve(import.meta.dirname, ".."); + const fileNames = await collectFileNames(cwd, ["*"]); + + // Assert + const error = + typeof fileNames === "string" + ? fileNames.replace(cwd, "") + : undefined; + expect(error).toEqual( + "At least one path including node_modules was included implicitly: '/node_modules'. Either adjust TypeStat's included files to not include node_modules (recommended) or explicitly include node_modules/ (not recommended).", + ); + }); +}); diff --git a/src/collectFileNames.ts b/src/collectFileNames.ts index b58812106..3dff3157b 100644 --- a/src/collectFileNames.ts +++ b/src/collectFileNames.ts @@ -1,14 +1,11 @@ import { glob } from "glob"; import * as path from "node:path"; -import { TypeStatArgv } from "./index.js"; - export const collectFileNames = async ( - argv: TypeStatArgv, cwd: string, include: readonly string[] | undefined, ): Promise => { - const globsAndNames = await collectFileNamesFromGlobs(argv, cwd, include); + const globsAndNames = await collectFileNamesFromGlobs(cwd, include); if (!globsAndNames) { return undefined; } @@ -27,14 +24,9 @@ export const collectFileNames = async ( }; const collectFileNamesFromGlobs = async ( - argv: TypeStatArgv, cwd: string, include: readonly string[] | undefined, ): Promise<[readonly string[], readonly string[]] | undefined> => { - if (argv.args.length) { - return [argv.args, await glob(argv.args)]; - } - if (include === undefined) { return undefined; } diff --git a/src/index.ts b/src/index.ts index 12ee31279..71685c1df 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,10 +44,10 @@ export interface SucceededResult { } export const typeStat = async ( - argv: TypeStatArgv, + configPath: string | undefined, output: ProcessOutput, ): Promise => { - const allPendingOptions = await tryLoadingPendingOptions(argv, output); + const allPendingOptions = await tryLoadingPendingOptions(configPath, output); if ( allPendingOptions instanceof Error || typeof allPendingOptions === "string" @@ -82,7 +82,7 @@ export const typeStat = async ( chalk.green( ` options ${pluralize(allPendingOptions.length, "object")} specified in `, ), - chalk.greenBright(argv.config), + chalk.greenBright(configPath), chalk.green(` to modify your source code.`), ].join(""), ); @@ -91,7 +91,6 @@ export const typeStat = async ( for (let i = 0; i < allPendingOptions.length; i += 1) { // Collect all files to be run on this option iteration from the include glob(s) const fileNames = await collectFileNames( - argv, process.cwd(), allPendingOptions[i].include, ); @@ -146,11 +145,11 @@ export const typeStat = async ( }; const tryLoadingPendingOptions = async ( - argv: TypeStatArgv, + configPath: string | undefined, output: ProcessOutput, ): Promise => { try { - return await loadPendingOptions(argv, output); + return await loadPendingOptions(configPath, output); } catch (error) { return error instanceof Error ? error : new Error(error as string); } diff --git a/src/options/fillOutRawOptions.ts b/src/options/fillOutRawOptions.ts index 6fc796100..c15134b98 100644 --- a/src/options/fillOutRawOptions.ts +++ b/src/options/fillOutRawOptions.ts @@ -1,8 +1,7 @@ -import { TypeStatArgv } from "../index.js"; import { ProcessOutput } from "../output/types.js"; import { collectOptionals } from "../shared/arrays.js"; import { ReactPropTypesHint, ReactPropTypesOptionality } from "./enums.js"; -import { ParsedCompilerOptions } from "./parseRawCompilerOptions.js"; +import { ParsedTsConfig } from "./parseRawCompilerOptions.js"; import { collectAddedMutators } from "./parsing/collectAddedMutators.js"; import { collectFileOptions } from "./parsing/collectFileOptions.js"; import { collectNoImplicitAny } from "./parsing/collectNoImplicitAny.js"; @@ -12,12 +11,11 @@ import { collectStrictNullChecks } from "./parsing/collectStrictNullChecks.js"; import { PendingTypeStatOptions, RawTypeStatOptions } from "./types.js"; export interface OptionsFromRawOptionsSettings { - argv: TypeStatArgv; - compilerOptions: Readonly; cwd: string; output: ProcessOutput; projectPath: string; rawOptions: RawTypeStatOptions; + tsConfig: Readonly; } /** @@ -25,18 +23,13 @@ export interface OptionsFromRawOptionsSettings { * @returns Parsed TypeStat options, or a string for an error complaint. */ export const fillOutRawOptions = ({ - compilerOptions, cwd, output, projectPath, rawOptions, + tsConfig, }: OptionsFromRawOptionsSettings): PendingTypeStatOptions => { const rawOptionTypes = rawOptions.types ?? {}; - const noImplicitAny = collectNoImplicitAny(compilerOptions, rawOptions); - const noImplicitThis = collectNoImplicitThis(compilerOptions, rawOptions); - const { compilerStrictNullChecks, typeStrictNullChecks } = - collectStrictNullChecks(compilerOptions, rawOptionTypes); - const packageOptions = collectPackageOptions(cwd, rawOptions); const shell: (readonly string[])[] = []; @@ -50,10 +43,16 @@ export const fillOutRawOptions = ({ ...rawOptions.cleanups, }, compilerOptions: { - ...compilerOptions, - noImplicitAny, - noImplicitThis, - strictNullChecks: compilerStrictNullChecks, + ...tsConfig.compilerOptions, + noImplicitAny: collectNoImplicitAny(tsConfig.compilerOptions, rawOptions), + noImplicitThis: collectNoImplicitThis( + tsConfig.compilerOptions, + rawOptions, + ), + strictNullChecks: collectStrictNullChecks( + tsConfig.compilerOptions, + rawOptionTypes, + ), }, files: collectFileOptions(rawOptions), filters: collectOptionals(rawOptions.filters), @@ -76,7 +75,7 @@ export const fillOutRawOptions = ({ ReactPropTypesOptionality.AsWritten, }, }, - include: rawOptions.include ?? compilerOptions.include, + include: rawOptions.include ?? tsConfig.include, mutators: collectAddedMutators( rawOptions, packageOptions.directory, @@ -87,7 +86,7 @@ export const fillOutRawOptions = ({ postProcess: { shell }, projectPath, types: { - strictNullChecks: typeStrictNullChecks, + strictNullChecks: rawOptionTypes.strictNullChecks, }, }; }; diff --git a/src/options/loadPendingOptions.ts b/src/options/loadPendingOptions.ts index aee74384e..9015a2cd7 100644 --- a/src/options/loadPendingOptions.ts +++ b/src/options/loadPendingOptions.ts @@ -1,6 +1,5 @@ import * as path from "node:path"; -import { TypeStatArgv } from "../index.js"; import { ProcessOutput } from "../output/types.js"; import { normalizeAndSlashify } from "../shared/paths.js"; import { fillOutRawOptions } from "./fillOutRawOptions.js"; @@ -11,20 +10,18 @@ import { PendingTypeStatOptions, RawTypeStatOptions } from "./types.js"; /** * Reads pre-file-rename TypeStat options using a config path. - * @param argv Root arguments passed to TypeStat. - * @param output Wraps process and logfile output. * @returns Promise for filled-out TypeStat options, or a string complaint from failing to make them. */ export const loadPendingOptions = async ( - argv: TypeStatArgv, + configPath: string | undefined, output: ProcessOutput, ): Promise => { - if (argv.config === undefined) { + if (configPath === undefined) { return "-c/--config file must be provided."; } const cwd = process.cwd(); - const foundRawOptions = findRawOptions(cwd, argv.config); + const foundRawOptions = findRawOptions(cwd, configPath); if (typeof foundRawOptions === "string") { return foundRawOptions; } @@ -37,15 +34,14 @@ export const loadPendingOptions = async ( for (let i = 0; i < allRawOptions.length; i += 1) { const rawOptions = allRawOptions[i]; const projectPath = getProjectPath(cwd, filePath, rawOptions); - const compilerOptions = await parseRawCompilerOptions(cwd, projectPath); + const tsConfig = await parseRawCompilerOptions(cwd, projectPath); const filledOutOptions = fillOutRawOptions({ - argv, - compilerOptions, cwd, output, projectPath, rawOptions, + tsConfig, }); const complaint = findComplaintForOptions(filledOutOptions); if (complaint) { diff --git a/src/options/parseRawCompilerOptions.ts b/src/options/parseRawCompilerOptions.ts index dd2bc99da..682917145 100644 --- a/src/options/parseRawCompilerOptions.ts +++ b/src/options/parseRawCompilerOptions.ts @@ -1,49 +1,30 @@ -import { glob } from "glob"; -import { minimatch } from "minimatch"; -import * as fs from "node:fs"; import * as fsp from "node:fs/promises"; -import * as path from "node:path"; import ts from "typescript"; +import { parseJsonConfigFileContent } from "../services/parseJsonConfigFileContent.js"; import { stringifyDiagnosticMessageText } from "../shared/diagnostics.js"; -export interface ParsedCompilerOptions extends ts.CompilerOptions { +export interface ParsedTsConfig { + compilerOptions: ts.CompilerOptions | undefined; include?: string[]; } export const parseRawCompilerOptions = async ( cwd: string, projectPath: string, -): Promise => { +): Promise => { const configRaw = (await fsp.readFile(projectPath)).toString(); - const compilerOptions = ts.parseConfigFileTextToJson(projectPath, configRaw); - if (compilerOptions.error !== undefined) { + const configResult = ts.parseConfigFileTextToJson(projectPath, configRaw); + if (configResult.error !== undefined) { throw new Error( - `Could not parse compiler options from '${projectPath}': ${stringifyDiagnosticMessageText(compilerOptions.error)}`, + `Could not parse compiler options from '${projectPath}': ${stringifyDiagnosticMessageText(configResult.error)}`, ); } - const config = compilerOptions.config as ParsedCompilerOptions; + const config = configResult.config as ParsedTsConfig; // TSConfig includes often come in a glob form like ["src"] - config.include &&= ts.parseJsonConfigFileContent( - compilerOptions.config, - { - fileExists: (filePath) => fs.statSync(filePath).isFile(), - readDirectory: (rootDir, extensions, excludes, includes) => - includes - .flatMap((include) => glob.sync(path.join(rootDir, include))) - .filter( - (filePath) => - !excludes?.some((exclude) => minimatch(filePath, exclude)) && - extensions.some((extension) => filePath.endsWith(extension)), - ) - .map((filePath) => path.relative(rootDir, filePath)), - readFile: (filePath) => fs.readFileSync(filePath).toString(), - useCaseSensitiveFileNames: true, - }, - cwd, - ).fileNames; + config.include &&= parseJsonConfigFileContent(config, cwd).fileNames; return config; }; diff --git a/src/options/parsing/collectNoImplicitAny.ts b/src/options/parsing/collectNoImplicitAny.ts index 2641555f7..2262ec324 100644 --- a/src/options/parsing/collectNoImplicitAny.ts +++ b/src/options/parsing/collectNoImplicitAny.ts @@ -3,16 +3,8 @@ import ts from "typescript"; import { RawTypeStatOptions } from "../types.js"; export const collectNoImplicitAny = ( - compilerOptions: Readonly, + compilerOptions: Readonly | undefined, rawOptions: RawTypeStatOptions, -): boolean => { - if (rawOptions.fixes?.noImplicitAny !== undefined) { - return rawOptions.fixes.noImplicitAny; - } - - if (compilerOptions.noImplicitAny !== undefined) { - return compilerOptions.noImplicitAny; - } - - return false; -}; +): boolean => + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + rawOptions.fixes?.noImplicitAny || compilerOptions?.noImplicitAny || false; diff --git a/src/options/parsing/collectNoImplicitThis.ts b/src/options/parsing/collectNoImplicitThis.ts index f4b8ae25c..0bc90dcfb 100644 --- a/src/options/parsing/collectNoImplicitThis.ts +++ b/src/options/parsing/collectNoImplicitThis.ts @@ -3,16 +3,8 @@ import ts from "typescript"; import { RawTypeStatOptions } from "../types.js"; export const collectNoImplicitThis = ( - compilerOptions: Readonly, + compilerOptions: Readonly | undefined, rawOptions: RawTypeStatOptions, -): boolean => { - if (rawOptions.fixes?.noImplicitThis !== undefined) { - return rawOptions.fixes.noImplicitThis; - } - - if (compilerOptions.noImplicitThis !== undefined) { - return compilerOptions.noImplicitThis; - } - - return false; -}; +): boolean => + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + rawOptions.fixes?.noImplicitThis || compilerOptions?.noImplicitThis || false; diff --git a/src/options/parsing/collectStrictNullChecks.ts b/src/options/parsing/collectStrictNullChecks.ts index d7694e4b1..8a223067a 100644 --- a/src/options/parsing/collectStrictNullChecks.ts +++ b/src/options/parsing/collectStrictNullChecks.ts @@ -3,33 +3,13 @@ import ts from "typescript"; import { RawTypeStatTypeOptions } from "../types.js"; export const collectStrictNullChecks = ( - compilerOptions: Readonly, - rawOptionTypes: RawTypeStatTypeOptions, -) => { - const typeStrictNullChecks = rawOptionTypes.strictNullChecks; - const compilerStrictNullChecks = collectCompilerStrictNullChecks( - compilerOptions, - typeStrictNullChecks, - ); - - return { compilerStrictNullChecks, typeStrictNullChecks }; -}; - -const collectCompilerStrictNullChecks = ( - compilerOptions: Readonly, - typeStrictNullChecks: boolean | undefined, -): boolean => { - if (typeStrictNullChecks !== undefined) { - return typeStrictNullChecks; - } - - if (compilerOptions.strictNullChecks !== undefined) { - return compilerOptions.strictNullChecks; - } - - if (compilerOptions.strict !== undefined) { - return compilerOptions.strict; - } - - return false; -}; + compilerOptions: Readonly | undefined, + rawOptionTypes: RawTypeStatTypeOptions | undefined, +): boolean => + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + rawOptionTypes?.strictNullChecks || + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + compilerOptions?.strictNullChecks || + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + compilerOptions?.strict || + false; diff --git a/src/options/types.ts b/src/options/types.ts index 9fdf22926..979c72f9b 100644 --- a/src/options/types.ts +++ b/src/options/types.ts @@ -87,7 +87,7 @@ export interface BaseTypeStatOptions { /** * Parsed TypeScript compiler options with relevant fields filled out. */ - readonly compilerOptions: Readonly; + readonly compilerOptions: Readonly; /** * Directives for file-level changes. @@ -161,15 +161,6 @@ export interface TypeStatOptions extends BaseTypeStatOptions { readonly fileNames: readonly string[]; } -/** - * Parsed TypeScript compiler options with relevant fields filled out. - */ -export type TypeStatCompilerOptions = ts.CompilerOptions & { - noImplicitAny: boolean; - noImplicitThis: boolean; - strictNullChecks: boolean; -}; - /** * Directives for file-level changes. */ diff --git a/src/services/createProgramConfiguration.ts b/src/services/createProgramConfiguration.ts index fb5d4f8ae..5d66dc6d0 100644 --- a/src/services/createProgramConfiguration.ts +++ b/src/services/createProgramConfiguration.ts @@ -1,24 +1,19 @@ -import * as fs from "node:fs"; import * as path from "node:path"; import ts from "typescript"; import { TypeStatOptions } from "../options/types.js"; import { collectOptionals, uniquify } from "../shared/arrays.js"; import { normalizeAndSlashify } from "../shared/paths.js"; +import { parseJsonConfigFileContent } from "./parseJsonConfigFileContent.js"; export const createProgramConfiguration = (options: TypeStatOptions) => { // Create a TypeScript configuration using the raw options - const parsedConfiguration = ts.parseJsonConfigFileContent( + const parsedConfiguration = parseJsonConfigFileContent( { - ...options.compilerOptions, - skipLibCheck: true, - }, - { - fileExists: fs.existsSync, - // eslint-disable-next-line @typescript-eslint/unbound-method - readDirectory: ts.sys.readDirectory, - readFile: (file) => fs.readFileSync(file, "utf8"), - useCaseSensitiveFileNames: true, + compilerOptions: { + ...options.compilerOptions, + skipLibCheck: true, + }, }, path.resolve(path.dirname(options.projectPath)), { noEmit: true }, diff --git a/src/services/parseJsonConfigFileContent.ts b/src/services/parseJsonConfigFileContent.ts index 4f6149654..370a78480 100644 --- a/src/services/parseJsonConfigFileContent.ts +++ b/src/services/parseJsonConfigFileContent.ts @@ -1,6 +1,3 @@ -import { minimatch } from "minimatch"; -import * as fs from "node:fs"; -import * as path from "node:path"; import ts from "typescript"; export const parseJsonConfigFileContent = ( @@ -11,21 +8,17 @@ export const parseJsonConfigFileContent = ( return ts.parseJsonConfigFileContent( config, { - fileExists: (filePath) => fs.statSync(filePath).isFile(), - readDirectory: (rootDir, extensions, excludes, includes) => - includes - .flatMap((include) => - fs - .readdirSync(path.join(rootDir, include)) - .map((fileName) => path.join(rootDir, include, fileName)), - ) - .filter( - (filePath) => - !excludes?.some((exclude) => minimatch(filePath, exclude)) && - extensions.some((extension) => filePath.endsWith(extension)), - ) - .map((filePath) => path.relative(rootDir, filePath)), - readFile: (filePath) => fs.readFileSync(filePath).toString(), + // eslint-disable-next-line @typescript-eslint/unbound-method + directoryExists: ts.sys.directoryExists, + // eslint-disable-next-line @typescript-eslint/unbound-method + fileExists: ts.sys.fileExists, + getCurrentDirectory: () => process.cwd(), + // eslint-disable-next-line @typescript-eslint/unbound-method + getDirectories: ts.sys.getDirectories, + // eslint-disable-next-line @typescript-eslint/unbound-method + readDirectory: ts.sys.readDirectory, + // eslint-disable-next-line @typescript-eslint/unbound-method + readFile: ts.sys.readFile, useCaseSensitiveFileNames: true, }, cwd, diff --git a/src/shared/diagnostics.ts b/src/shared/diagnostics.ts index 4c6a59b92..ec8387908 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 c87cbfcb3..345243088 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,11 +37,14 @@ 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"); - const compilerOptions = await parseRawCompilerOptions(dirPath, projectPath); + const tsConfig = await parseRawCompilerOptions(dirPath, projectPath); const output = { // eslint-disable-next-line @typescript-eslint/no-empty-function @@ -48,32 +54,38 @@ export const runMutationTest = async ( stdout: () => {}, }; - const pendingOptions = fillOutRawOptions({ - argv: { args: [] }, - compilerOptions, - cwd: dirPath, - output, - projectPath, - rawOptions, - }); + const pendingOptionsList: PendingTypeStatOptions[] = []; - const provider = createTypeStatProvider({ - ...pendingOptions, - fileNames: [actualFile], - }); + for (const mutationOption of rawOptionsList) { + const pendingOptions = fillOutRawOptions({ + cwd: dirPath, + output, + projectPath, + rawOptions: mutationOption, + tsConfig, + }); - 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 65cfd792d..a7f0c3849 100644 --- a/test/__snapshots__/cleanups.test.ts.snap +++ b/test/__snapshots__/cleanups.test.ts.snap @@ -1,81 +1,155 @@ // 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 + "esModuleInterop": true, + "strictNullChecks": true, + "resolveJsonModule": true, + "noImplicitAny": false, + "noImplicitThis": 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": { + "strictNullChecks": true, + "noImplicitAny": false, + "noImplicitThis": 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 52ba5b62e..03fa0e3ed 100644 --- a/test/__snapshots__/customMutators.test.ts.snap +++ b/test/__snapshots__/customMutators.test.ts.snap @@ -1,192 +1,188 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Custom mutators > empty array > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "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 + ] ], - "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 - ] - ], - "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": { + "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" + "/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": { + "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 28b353eae..84b635574 100644 --- a/test/__snapshots__/files.test.ts.snap +++ b/test/__snapshots__/files.test.ts.snap @@ -1,309 +1,589 @@ // 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": { + "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 + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "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 + ] ], - [ - "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" +"[ + { + "cleanups": { + "suppressTypeErrors": false + }, + "compilerOptions": { + "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 + ] ], - "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 + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "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 + ] ], - [ - "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 > both > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { - "files": [ - "actual.ts" +"[ + { + "cleanups": { + "suppressTypeErrors": false + }, + "compilerOptions": { + "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 + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "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 + ] ], - [ - "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" +"[ + { + "cleanups": { + "suppressTypeErrors": false + }, + "compilerOptions": { + "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 + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "projectPath": "/tsconfig.json", + "types": {} }, - "hints": { - "react": { - "propTypes": "whenRequired", - "propTypesOptionality": "asWritten" - } - }, - "mutators": [ - [ - "fixImportExtensions", - null - ], - [ - "fixIncompleteTypes", - null - ], - [ - "fixMissingProperties", - null + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "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 + ] ], - [ - "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__/filters.test.ts.snap b/test/__snapshots__/filters.test.ts.snap index 7ed294d1a..767100ee5 100644 --- a/test/__snapshots__/filters.test.ts.snap +++ b/test/__snapshots__/filters.test.ts.snap @@ -1,243 +1,240 @@ // 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": { + "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": { + "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": { + "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__/fixImportExtensions.test.ts.snap b/test/__snapshots__/fixImportExtensions.test.ts.snap index 32f240211..12d2bc915 100644 --- a/test/__snapshots__/fixImportExtensions.test.ts.snap +++ b/test/__snapshots__/fixImportExtensions.test.ts.snap @@ -1,80 +1,77 @@ // 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": { + "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 8a1ec6ef0..b5ea13de9 100644 --- a/test/__snapshots__/fixIncompleteTypes.test.ts.snap +++ b/test/__snapshots__/fixIncompleteTypes.test.ts.snap @@ -1,1335 +1,1319 @@ // 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": { + "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": { + "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": { + "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": { + "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": { + "esModuleInterop": true, + "jsx": "react", + "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": { + "esModuleInterop": true, + "jsx": "react", + "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": { + "esModuleInterop": true, + "jsx": "react", + "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": { + "esModuleInterop": true, + "jsx": "react", + "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" + "jsx": "react", + "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" + "jsx": "react", + "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": { + "esModuleInterop": true, + "jsx": "react", + "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" + "jsx": "react", + "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" + "jsx": "react", + "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": { + "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": { + "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": { + "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": { + "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 37c6aee94..fc8427e39 100644 --- a/test/__snapshots__/fixMissingProperties.test.ts.snap +++ b/test/__snapshots__/fixMissingProperties.test.ts.snap @@ -1,80 +1,79 @@ // 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": { + "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 3bba4656e..fa5a82213 100644 --- a/test/__snapshots__/fixNoImplicitAny.test.ts.snap +++ b/test/__snapshots__/fixNoImplicitAny.test.ts.snap @@ -1,238 +1,235 @@ // 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": { + "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": { + "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": { + "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 107c7fa4e..309ecb407 100644 --- a/test/__snapshots__/fixNoImplicitThis.test.ts.snap +++ b/test/__snapshots__/fixNoImplicitThis.test.ts.snap @@ -1,80 +1,79 @@ // 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": { + "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 593589946..5b98e7ba4 100644 --- a/test/__snapshots__/fixNoInferableTypes.test.ts.snap +++ b/test/__snapshots__/fixNoInferableTypes.test.ts.snap @@ -1,238 +1,235 @@ // 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": { + "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": { + "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": { + "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 7ecbf4039..3c4f252f4 100644 --- a/test/__snapshots__/fixStrictNonNullAssertions.test.ts.snap +++ b/test/__snapshots__/fixStrictNonNullAssertions.test.ts.snap @@ -1,402 +1,391 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`strictNonNullAssertions > binaryExpressions > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, "compilerOptions": { - "strictNullChecks": true + "strictNullChecks": true, + "noImplicitAny": false, + "noImplicitThis": false }, - "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": { + "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": { + "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": { + "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": { - "strictNullChecks": true + "strictNullChecks": true, + "noImplicitAny": false, + "noImplicitThis": false }, - "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 42c664ead..6bf18c0b4 100644 --- a/test/__snapshots__/include.test.ts.snap +++ b/test/__snapshots__/include.test.ts.snap @@ -1,115 +1,115 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`include > asterisk > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "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" + "/actual.ts", + "/expected.ts", + "/original.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": { - "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": {} -}" +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "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", + "/expected.ts", + "/original.ts" + ], + "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 741246989..b810e4b12 100644 --- a/test/__snapshots__/infiniteWaveDetection.test.ts.snap +++ b/test/__snapshots__/infiniteWaveDetection.test.ts.snap @@ -1,58 +1,56 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Infinite wave detection > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "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" + "/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 bf04506a1..c5194407e 100644 --- a/test/__snapshots__/postProcessing.test.ts.snap +++ b/test/__snapshots__/postProcessing.test.ts.snap @@ -1,87 +1,159 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Post processing > options 1`] = ` -"{ - "cleanups": { - "suppressTypeErrors": false - }, - "compilerOptions": { +"[ + { + "cleanups": { + "suppressTypeErrors": false + }, + "compilerOptions": { + "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 + "/actual.ts" ], - [ - "fixNoImplicitAny", - null - ], - [ - "fixNoImplicitThis", - null - ], - [ - "fixNoInferableTypes", - null + "mutators": [ + [ + "fixImportExtensions", + null + ], + [ + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null + ] ], - [ - "fixStrictNonNullAssertions", - null - ] - ], - "output": {}, - "package": { - "directory": "", - "file": "/package.json" + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [ + [ + "node", + "./postProcess.cjs" + ] + ] + }, + "projectPath": "/tsconfig.json", + "types": {} }, - "postProcess": { - "shell": [ + { + "cleanups": { + "suppressTypeErrors": true + }, + "compilerOptions": { + "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 + ], [ - "node", - "./postProcess.cjs" + "fixIncompleteTypes", + null + ], + [ + "fixMissingProperties", + null + ], + [ + "fixNoImplicitAny", + null + ], + [ + "fixNoImplicitThis", + null + ], + [ + "fixNoInferableTypes", + null + ], + [ + "fixStrictNonNullAssertions", + null ] - ] - }, - "projectPath": "/tsconfig.json", - "types": {} -}" + ], + "output": {}, + "package": { + "directory": "", + "file": "/package.json" + }, + "postProcess": { + "shell": [] + }, + "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 000000000..4792d6685 --- /dev/null +++ b/test/cases/cleanups/nonTypeErrors/expected.ts @@ -0,0 +1,4 @@ +import ts from "typescript"; +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 000000000..4792d6685 --- /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 000000000..2c5f1ded5 --- /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 000000000..8a37358a9 --- /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 dd07e8f78..fb6bdb346 100644 --- a/test/cases/cleanups/suppressTypeErrors/expected.ts +++ b/test/cases/cleanups/suppressTypeErrors/expected.ts @@ -1,7 +1,12 @@ +// @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; -// @ts-expect-error -- TODO: Property 'replace' does not exist on type 'undefined[]'. Property 'values' does not exist on type '{}'. +// @ts-expect-error -- TODO: Property 'replace' does not exist on type 'never[]'. Property 'values' does not exist on type '{}'. let incorrectMultiple: string = [].replace() + {}.values(); })(); diff --git a/test/cases/cleanups/suppressTypeErrors/original.ts b/test/cases/cleanups/suppressTypeErrors/original.ts index c144374ed..0945363db 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 d73983394..6baa52f77 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 b24b1ee59..35cb8b253 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 abbf7b2cd..38215e64a 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/above/typestat.json b/test/cases/files/above/typestat.json index 59e0f05f2..3e8d6345f 100644 --- a/test/cases/files/above/typestat.json +++ b/test/cases/files/above/typestat.json @@ -1,8 +1,18 @@ -{ - "files": { - "above": "/* Above file */" +[ + { + "files": { + "above": "/* Above file */" + }, + "fixes": { + "incompleteTypes": true + } }, - "fixes": { - "incompleteTypes": true + { + "cleanups": { + "suppressTypeErrors": true + }, + "fixes": { + "incompleteTypes": true + } } -} +] diff --git a/test/cases/files/below/typestat.json b/test/cases/files/below/typestat.json index c7cb53a22..cbcf3c303 100644 --- a/test/cases/files/below/typestat.json +++ b/test/cases/files/below/typestat.json @@ -1,8 +1,18 @@ -{ - "files": { - "below": "/* Below file */" +[ + { + "files": { + "below": "/* Below file */" + }, + "fixes": { + "incompleteTypes": true + } }, - "fixes": { - "incompleteTypes": true + { + "cleanups": { + "suppressTypeErrors": true + }, + "fixes": { + "incompleteTypes": true + } } -} +] diff --git a/test/cases/files/both/typestat.json b/test/cases/files/both/typestat.json index 79b531ee6..0e93a4a28 100644 --- a/test/cases/files/both/typestat.json +++ b/test/cases/files/both/typestat.json @@ -1,9 +1,19 @@ -{ - "files": { - "above": "/* Above file */", - "below": "/* Below file */" +[ + { + "files": { + "above": "/* Above file */", + "below": "/* Below file */" + }, + "fixes": { + "incompleteTypes": true + } }, - "fixes": { - "incompleteTypes": true + { + "cleanups": { + "suppressTypeErrors": true + }, + "fixes": { + "incompleteTypes": true + } } -} +] diff --git a/test/cases/files/empty/typestat.json b/test/cases/files/empty/typestat.json index db23342b6..ff81bbfd3 100644 --- a/test/cases/files/empty/typestat.json +++ b/test/cases/files/empty/typestat.json @@ -1,9 +1,19 @@ -{ - "files": { - "above": "", - "below": "" +[ + { + "files": { + "above": "", + "below": "" + }, + "fixes": { + "incompleteTypes": true + } }, - "fixes": { - "incompleteTypes": true + { + "cleanups": { + "suppressTypeErrors": true + }, + "fixes": { + "incompleteTypes": true + } } -} +] diff --git a/test/cases/filters/empty/typestat.json b/test/cases/filters/empty/typestat.json index 37854e3a6..c72a33a83 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 92fd4f60d..6d9d165d5 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 1c9e9d1f3..5ec2acf85 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 8f5b0bff8..e5d42e725 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 2adb4737a..50db723e0 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 2adb4737a..7d35a0f86 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 391a1d440..eb41e18e4 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 bcdd14321..b47107715 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 04c1b9dc8..15105ad28 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 1406ae0fa..7d43d990c 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 1406ae0fa..7d43d990c 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 1406ae0fa..7d43d990c 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 1406ae0fa..7d43d990c 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 1406ae0fa..7d43d990c 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 1406ae0fa..7d43d990c 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 1406ae0fa..7d43d990c 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 1406ae0fa..7d43d990c 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/tsconfig.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromLaterAssignments/tsconfig.json index 8dd234eaf..62f9fc0c6 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 1406ae0fa..7d43d990c 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 8bc657c8f..84fc2e7b4 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/expected.tsx +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/expected.tsx @@ -129,6 +129,7 @@ interface LaterAssignedComponentProps { } } +// @ts-expect-error -- TODO: Property 'propTypes' does not exist on type 'typeof LaterAssignedComponent'. LaterAssignedComponent.propTypes = { string: PropTypes.string, stringRequired: PropTypes.string.isRequired, diff --git a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/tsconfig.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/tsconfig.json index 8dd234eaf..62f9fc0c6 100644 --- a/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/tsconfig.json +++ b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/all/tsconfig.json @@ -1,3 +1,7 @@ { + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react" + }, "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 1406ae0fa..7d43d990c 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/tsconfig.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysOptional/tsconfig.json index 8dd234eaf..62f9fc0c6 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 a5a0aa30d..3313dc202 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/tsconfig.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/alwaysRequired/tsconfig.json index 8dd234eaf..62f9fc0c6 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 9485eaf37..983a93541 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/tsconfig.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromPropTypes/optionality/asWritten/tsconfig.json index 8dd234eaf..62f9fc0c6 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 91b1e297f..42e8c56e1 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/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsFromUses/typestat.json index 1406ae0fa..7d43d990c 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/typestat.json b/test/cases/fixes/incompleteTypes/reactTypes/reactPropsMissing/typestat.json index 1406ae0fa..7d43d990c 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 8959e96b7..bb6ec4218 100644 --- a/test/cases/fixes/incompleteTypes/returnTypes/expected.ts +++ b/test/cases/fixes/incompleteTypes/returnTypes/expected.ts @@ -85,19 +85,18 @@ return ""; }; +// @ts-expect-error -- TODO: Type 'boolean | Promise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. async function navigateTo(): Promise | boolean { - return await new Promise(() => ""); + return await new Promise(() => {}); } - function navigateByUrl(url: string): Promise; - - async function navigateTo(): Promise | boolean { - return await navigateByUrl(""); + async function navigateByUrl(url: string): Promise { + return Promise.resolve(true); } +// @ts-expect-error -- TODO: Type 'boolean | Promise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. async function navigateTo2(): Promise | boolean { - const navigated = await navigateByUrl(""); - return navigated; + return await navigateByUrl(""); } async function returnSame(): Promise { diff --git a/test/cases/fixes/incompleteTypes/returnTypes/original.ts b/test/cases/fixes/incompleteTypes/returnTypes/original.ts index 381dd531d..7b239fbb1 100644 --- a/test/cases/fixes/incompleteTypes/returnTypes/original.ts +++ b/test/cases/fixes/incompleteTypes/returnTypes/original.ts @@ -86,18 +86,15 @@ }; async function navigateTo(): Promise { - return await new Promise(() => ""); + return await new Promise(() => {}); } - function navigateByUrl(url: string): Promise; - - async function navigateTo(): Promise { - return await navigateByUrl(""); + async function navigateByUrl(url: string): Promise { + return Promise.resolve(true); } async function navigateTo2(): Promise { - const navigated = await navigateByUrl(""); - return navigated; + return await navigateByUrl(""); } async function returnSame(): Promise { diff --git a/test/cases/fixes/incompleteTypes/returnTypes/typestat.json b/test/cases/fixes/incompleteTypes/returnTypes/typestat.json index e11c754df..7e8634817 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 353c9284a..c0344da2e 100644 --- a/test/cases/fixes/incompleteTypes/variableTypes/expected.tsx +++ b/test/cases/fixes/incompleteTypes/variableTypes/expected.ts @@ -4,6 +4,7 @@ import * as React from "react"; // Primitives let givenUndefined = ""; +// @ts-expect-error -- TODO: Type 'undefined' is not assignable to type 'string'. givenUndefined = undefined; let givenUndefinedAsString: string | undefined = ""; @@ -17,6 +18,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 +109,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 +127,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 +193,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 96% rename from test/cases/fixes/incompleteTypes/variableTypes/original.tsx rename to test/cases/fixes/incompleteTypes/variableTypes/original.ts index 00532aca4..829a4c5ee 100644 --- a/test/cases/fixes/incompleteTypes/variableTypes/original.tsx +++ b/test/cases/fixes/incompleteTypes/variableTypes/original.ts @@ -187,14 +187,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 8dd234eaf..7de2b9de3 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 e11c754df..7e8634817 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 8d6e3c08d..b68b59e78 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 3426e9513..099fe388b 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 5bbb9fc21..0bed60e68 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 1d3856325..f144bf7c5 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 e11c754df..7e8634817 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 2ca602989..8c85d9f52 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 e11c754df..7e8634817 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 3944d4ff5..5112c523c 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 474bec31a..fbf74a5aa 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 474bec31a..fbf74a5aa 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 474bec31a..fbf74a5aa 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 d8bca1f5b..0716acd53 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 cbb6d591a..36272fa85 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 d8bca1f5b..0716acd53 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 d8bca1f5b..0716acd53 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 59ad19dd9..713a799a0 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 c89a90b76..7e4257c13 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 d8bca1f5b..0716acd53 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 d8bca1f5b..0716acd53 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 b24b1ee59..35cb8b253 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 b24b1ee59..35cb8b253 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 dfe7867a0..2157f3e00 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/typestat.json b/test/cases/post processing/typestat.json index 3800881cd..0c00640b6 100644 --- a/test/cases/post processing/typestat.json +++ b/test/cases/post processing/typestat.json @@ -1,8 +1,18 @@ -{ - "fixes": { - "incompleteTypes": true +[ + { + "fixes": { + "incompleteTypes": true + }, + "postProcess": { + "shell": [["node", "./postProcess.cjs"]] + } }, - "postProcess": { - "shell": [["node", "./postProcess.cjs"]] + { + "cleanups": { + "suppressTypeErrors": true + }, + "fixes": { + "incompleteTypes": true + } } -} +] diff --git a/test/cleanups.test.ts b/test/cleanups.test.ts index 60a1e687f..704607541 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 dd1ed8d5c..2daeaee34 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); });