diff --git a/e2e/runJest.ts b/e2e/runJest.ts index 476ae851a115..3086fb7316f6 100644 --- a/e2e/runJest.ts +++ b/e2e/runJest.ts @@ -59,7 +59,7 @@ function spawnJest( dir: string, args: Array = [], options: RunJestOptions = {}, - spawnAsync: boolean = false, + spawnAsync = false, ): execa.ExecaSyncReturnValue | execa.ExecaChildProcess { const isRelative = !path.isAbsolute(dir); diff --git a/packages/expect/src/asymmetricMatchers.ts b/packages/expect/src/asymmetricMatchers.ts index 02b19c363956..01f56a48df65 100644 --- a/packages/expect/src/asymmetricMatchers.ts +++ b/packages/expect/src/asymmetricMatchers.ts @@ -138,7 +138,7 @@ class Anything extends AsymmetricMatcher { } class ArrayContaining extends AsymmetricMatcher> { - constructor(sample: Array, inverse: boolean = false) { + constructor(sample: Array, inverse = false) { super(sample, inverse); } @@ -171,7 +171,7 @@ class ArrayContaining extends AsymmetricMatcher> { } class ObjectContaining extends AsymmetricMatcher> { - constructor(sample: Record, inverse: boolean = false) { + constructor(sample: Record, inverse = false) { super(sample, inverse); } @@ -209,7 +209,7 @@ class ObjectContaining extends AsymmetricMatcher> { } class StringContaining extends AsymmetricMatcher { - constructor(sample: string, inverse: boolean = false) { + constructor(sample: string, inverse = false) { if (!isA('String', sample)) { throw new Error('Expected is not a string'); } @@ -232,7 +232,7 @@ class StringContaining extends AsymmetricMatcher { } class StringMatching extends AsymmetricMatcher { - constructor(sample: string | RegExp, inverse: boolean = false) { + constructor(sample: string | RegExp, inverse = false) { if (!isA('String', sample) && !isA('RegExp', sample)) { throw new Error('Expected is not a String or a RegExp'); } diff --git a/packages/expect/src/jestMatchersObject.ts b/packages/expect/src/jestMatchersObject.ts index cbfe6344a6db..544530bbe398 100644 --- a/packages/expect/src/jestMatchersObject.ts +++ b/packages/expect/src/jestMatchersObject.ts @@ -68,10 +68,7 @@ export const setMatchers = ( [unknown, ...Array], State > { - constructor( - inverse: boolean = false, - ...sample: [unknown, ...Array] - ) { + constructor(inverse = false, ...sample: [unknown, ...Array]) { super(sample, inverse); } diff --git a/packages/expect/src/matchers.ts b/packages/expect/src/matchers.ts index f7f019129d51..5254722aee10 100644 --- a/packages/expect/src/matchers.ts +++ b/packages/expect/src/matchers.ts @@ -126,7 +126,7 @@ const matchers: MatchersObject = { return {actual: received, expected, message, name: matcherName, pass}; }, - toBeCloseTo(received: number, expected: number, precision: number = 2) { + toBeCloseTo(received: number, expected: number, precision = 2) { const matcherName = 'toBeCloseTo'; const secondArgument = arguments.length === 3 ? 'precision' : undefined; const isNot = this.isNot; diff --git a/packages/jest-cli/src/init/generateConfigFile.ts b/packages/jest-cli/src/init/generateConfigFile.ts index 4e70ad309382..e629b085644c 100644 --- a/packages/jest-cli/src/init/generateConfigFile.ts +++ b/packages/jest-cli/src/init/generateConfigFile.ts @@ -11,7 +11,7 @@ import {defaults, descriptions} from 'jest-config'; const stringifyOption = ( option: keyof Config.InitialOptions, map: Partial, - linePrefix: string = '', + linePrefix = '', ): string => { const optionDescription = ` // ${descriptions[option]}`; const stringifiedObject = `${option}: ${JSON.stringify( diff --git a/packages/jest-cli/src/init/index.ts b/packages/jest-cli/src/init/index.ts index b063fcb66b91..700be87b8728 100644 --- a/packages/jest-cli/src/init/index.ts +++ b/packages/jest-cli/src/init/index.ts @@ -48,7 +48,7 @@ export default async ( } const questions = defaultQuestions.slice(0); - let hasJestProperty: boolean = false; + let hasJestProperty = false; let projectPackageJson: ProjectPackageJson; try { @@ -99,7 +99,7 @@ export default async ( ), ); - let promptAborted: boolean = false; + let promptAborted = false; // @ts-expect-error: Return type cannot be object - faulty typings const results: PromptsResults = await prompts(questions, { diff --git a/packages/jest-config/src/index.ts b/packages/jest-config/src/index.ts index f9b4c8456218..e22cd5dfb754 100644 --- a/packages/jest-config/src/index.ts +++ b/packages/jest-config/src/index.ts @@ -43,7 +43,7 @@ export async function readConfig( // read individual configs for every project. skipArgvConfigOption?: boolean, parentConfigDirname?: Config.Path | null, - projectIndex: number = Infinity, + projectIndex = Infinity, skipMultipleConfigWarning = false, ): Promise { let rawOptions: Config.InitialOptions; diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index a8916f55fd3f..a50715620f29 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -551,7 +551,7 @@ export default async function normalize( initialOptions: Config.InitialOptions, argv: Config.Argv, configPath?: Config.Path | null, - projectIndex: number = Infinity, + projectIndex = Infinity, ): Promise<{ hasDeprecationWarnings: boolean; options: AllOptions;