diff --git a/TestUtils.ts b/TestUtils.ts index 1398da6b1ba3..a84f3f8bc630 100644 --- a/TestUtils.ts +++ b/TestUtils.ts @@ -5,8 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// eslint-disable-next-line import/no-extraneous-dependencies -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; const DEFAULT_GLOBAL_CONFIG: Config.GlobalConfig = { bail: 0, diff --git a/e2e/Utils.ts b/e2e/Utils.ts index ca1c5549f4b8..d135e623cd6b 100644 --- a/e2e/Utils.ts +++ b/e2e/Utils.ts @@ -7,7 +7,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; // eslint-disable-next-line import/named import {ExecaReturnValue, sync as spawnSync} from 'execa'; diff --git a/e2e/babel-plugin-jest-hoist/entry.ts b/e2e/babel-plugin-jest-hoist/entry.ts index bafd2d4f8606..1c8af26cf8ea 100644 --- a/e2e/babel-plugin-jest-hoist/entry.ts +++ b/e2e/babel-plugin-jest-hoist/entry.ts @@ -5,6 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {Color} from './types'; +import type {Color} from './types'; export const color: Color = 'red'; diff --git a/e2e/runJest.ts b/e2e/runJest.ts index 4abdf3e0e6bc..8f2b0e8d30f8 100644 --- a/e2e/runJest.ts +++ b/e2e/runJest.ts @@ -10,7 +10,7 @@ import * as path from 'path'; import * as fs from 'fs'; import {Writable} from 'stream'; import execa = require('execa'); -import {FormattedTestResults} from '@jest/test-result'; +import type {FormattedTestResults} from '@jest/test-result'; import stripAnsi = require('strip-ansi'); import {normalizeIcons} from './Utils'; diff --git a/packages/babel-jest/src/index.ts b/packages/babel-jest/src/index.ts index bddce17bd536..5d1cc9fa169b 100644 --- a/packages/babel-jest/src/index.ts +++ b/packages/babel-jest/src/index.ts @@ -8,8 +8,8 @@ import {createHash} from 'crypto'; import * as fs from 'fs'; import * as path from 'path'; -import {Transformer} from '@jest/transform'; -import {Config} from '@jest/types'; +import type {Transformer} from '@jest/transform'; +import type {Config} from '@jest/types'; import { PartialConfig, TransformOptions, diff --git a/packages/babel-plugin-jest-hoist/src/index.ts b/packages/babel-plugin-jest-hoist/src/index.ts index 91f2742dfddc..f29b1aeed64d 100644 --- a/packages/babel-plugin-jest-hoist/src/index.ts +++ b/packages/babel-plugin-jest-hoist/src/index.ts @@ -6,11 +6,8 @@ * */ -// Only used for types -/* eslint-disable import/no-extraneous-dependencies */ -import {NodePath, Visitor} from '@babel/traverse'; -import {Identifier} from '@babel/types'; -/* eslint-enable */ +import type {NodePath, Visitor} from '@babel/traverse'; +import type {Identifier} from '@babel/types'; // We allow `jest`, `expect`, `require`, all default Node.js globals and all // ES2015 built-ins to be used inside of a `jest.mock` factory. diff --git a/packages/expect/src/index.ts b/packages/expect/src/index.ts index 8daf40d81926..80adf7d3c686 100644 --- a/packages/expect/src/index.ts +++ b/packages/expect/src/index.ts @@ -7,7 +7,7 @@ */ import * as matcherUtils from 'jest-matcher-utils'; -import { +import type { AsyncExpectationResult, Expect, ExpectationResult, diff --git a/packages/expect/src/jasmineUtils.ts b/packages/expect/src/jasmineUtils.ts index 283af1331968..eabab9bbf236 100644 --- a/packages/expect/src/jasmineUtils.ts +++ b/packages/expect/src/jasmineUtils.ts @@ -24,7 +24,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* eslint-disable */ -import {Tester} from './types'; +import type {Tester} from './types'; // Extracted out of jasmine 2.5.2 export function equals( diff --git a/packages/expect/src/jestMatchersObject.ts b/packages/expect/src/jestMatchersObject.ts index 1bc754a4b7ea..bf08dca6db08 100644 --- a/packages/expect/src/jestMatchersObject.ts +++ b/packages/expect/src/jestMatchersObject.ts @@ -7,7 +7,7 @@ */ import {AsymmetricMatcher} from './asymmetricMatchers'; -import {Expect, MatchersObject, SyncExpectationResult} from './types'; +import type {Expect, MatchersObject, SyncExpectationResult} from './types'; // Global matchers object holds the list of available matchers and // the state, that can hold matcher specific values that change over time. diff --git a/packages/expect/src/matchers.ts b/packages/expect/src/matchers.ts index 58c015992aeb..73b571f49d73 100644 --- a/packages/expect/src/matchers.ts +++ b/packages/expect/src/matchers.ts @@ -25,7 +25,7 @@ import { printWithType, stringify, } from 'jest-matcher-utils'; -import {MatcherState, MatchersObject} from './types'; +import type {MatcherState, MatchersObject} from './types'; import { printCloseTo, printExpectedConstructorName, diff --git a/packages/expect/src/spyMatchers.ts b/packages/expect/src/spyMatchers.ts index f2ebfbc33e1f..b448f232bbd3 100644 --- a/packages/expect/src/spyMatchers.ts +++ b/packages/expect/src/spyMatchers.ts @@ -21,7 +21,11 @@ import { printWithType, stringify, } from 'jest-matcher-utils'; -import {MatcherState, MatchersObject, SyncExpectationResult} from './types'; +import type { + MatcherState, + MatchersObject, + SyncExpectationResult, +} from './types'; import {equals} from './jasmineUtils'; import {iterableEquality} from './utils'; diff --git a/packages/expect/src/toThrowMatchers.ts b/packages/expect/src/toThrowMatchers.ts index 8a018f3298b9..63cc3706264f 100644 --- a/packages/expect/src/toThrowMatchers.ts +++ b/packages/expect/src/toThrowMatchers.ts @@ -26,7 +26,7 @@ import { printReceivedStringContainExpectedResult, printReceivedStringContainExpectedSubstring, } from './print'; -import { +import type { ExpectationResult, MatcherState, MatchersObject, diff --git a/packages/expect/src/types.ts b/packages/expect/src/types.ts index 529d12014df4..54b8486a15b1 100644 --- a/packages/expect/src/types.ts +++ b/packages/expect/src/types.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. * */ -import {Config} from '@jest/types'; -import * as jestMatcherUtils from 'jest-matcher-utils'; +import type {Config} from '@jest/types'; +import type * as jestMatcherUtils from 'jest-matcher-utils'; import {INTERNAL_MATCHER_FLAG} from './jestMatchersObject'; export type SyncExpectationResult = { diff --git a/packages/jest-changed-files/src/git.ts b/packages/jest-changed-files/src/git.ts index 40f9726dedef..70ab9ced6cec 100644 --- a/packages/jest-changed-files/src/git.ts +++ b/packages/jest-changed-files/src/git.ts @@ -8,9 +8,9 @@ import * as path from 'path'; import execa = require('execa'); -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; -import {SCMAdapter} from './types'; +import type {SCMAdapter} from './types'; const findChangedFilesUsingCommand = async ( args: Array, diff --git a/packages/jest-changed-files/src/hg.ts b/packages/jest-changed-files/src/hg.ts index fc4c6e064376..a1f41978b93a 100644 --- a/packages/jest-changed-files/src/hg.ts +++ b/packages/jest-changed-files/src/hg.ts @@ -8,9 +8,9 @@ import * as path from 'path'; import execa = require('execa'); -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; -import {SCMAdapter} from './types'; +import type {SCMAdapter} from './types'; const env = {...process.env, HGPLAIN: '1'}; diff --git a/packages/jest-changed-files/src/index.ts b/packages/jest-changed-files/src/index.ts index 1f4ce3e30660..fd9323e243cf 100644 --- a/packages/jest-changed-files/src/index.ts +++ b/packages/jest-changed-files/src/index.ts @@ -7,15 +7,15 @@ */ import throat from 'throat'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; -import {ChangedFilesPromise, Options, Repos, SCMAdapter} from './types'; +import type {ChangedFilesPromise, Options, Repos, SCMAdapter} from './types'; import git from './git'; import hg from './hg'; type RootPromise = ReturnType; -export {ChangedFiles, ChangedFilesPromise} from './types'; +export type {ChangedFiles, ChangedFilesPromise} from './types'; function notEmpty(value: T | null | undefined): value is T { return value != null; diff --git a/packages/jest-changed-files/src/types.ts b/packages/jest-changed-files/src/types.ts index e45c07d3eb37..a7873ac8cee0 100644 --- a/packages/jest-changed-files/src/types.ts +++ b/packages/jest-changed-files/src/types.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; export type Options = { lastCommit?: boolean; diff --git a/packages/jest-circus/src/__tests__/circusItTestError.test.ts b/packages/jest-circus/src/__tests__/circusItTestError.test.ts index a267f511e836..56e7b8fae366 100644 --- a/packages/jest-circus/src/__tests__/circusItTestError.test.ts +++ b/packages/jest-circus/src/__tests__/circusItTestError.test.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Global} from '@jest/types'; +import type {Global} from '@jest/types'; let circusIt: Global.It; let circusTest: Global.It; diff --git a/packages/jest-circus/src/__tests__/circusItTodoTestError.test.ts b/packages/jest-circus/src/__tests__/circusItTodoTestError.test.ts index dfa31e2f9990..1eb655de77dd 100644 --- a/packages/jest-circus/src/__tests__/circusItTodoTestError.test.ts +++ b/packages/jest-circus/src/__tests__/circusItTodoTestError.test.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Global} from '@jest/types'; +import type {Global} from '@jest/types'; let circusIt: Global.It; diff --git a/packages/jest-circus/src/eventHandler.ts b/packages/jest-circus/src/eventHandler.ts index 7b059983dfb9..651cf541d2e8 100644 --- a/packages/jest-circus/src/eventHandler.ts +++ b/packages/jest-circus/src/eventHandler.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Circus} from '@jest/types'; +import type {Circus} from '@jest/types'; import {TEST_TIMEOUT_SYMBOL} from './types'; import { diff --git a/packages/jest-circus/src/formatNodeAssertErrors.ts b/packages/jest-circus/src/formatNodeAssertErrors.ts index 0b3f79954804..69a3c144fd26 100644 --- a/packages/jest-circus/src/formatNodeAssertErrors.ts +++ b/packages/jest-circus/src/formatNodeAssertErrors.ts @@ -6,7 +6,7 @@ */ import {AssertionError} from 'assert'; -import {Circus} from '@jest/types'; +import type {Circus} from '@jest/types'; import { DiffOptions, diff, diff --git a/packages/jest-circus/src/globalErrorHandlers.ts b/packages/jest-circus/src/globalErrorHandlers.ts index c3e7b7228f5e..3bcf3428dc12 100644 --- a/packages/jest-circus/src/globalErrorHandlers.ts +++ b/packages/jest-circus/src/globalErrorHandlers.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Circus} from '@jest/types'; +import type {Circus} from '@jest/types'; import {dispatch} from './state'; const uncaught: NodeJS.UncaughtExceptionListener & diff --git a/packages/jest-circus/src/index.ts b/packages/jest-circus/src/index.ts index 10056acc358b..22f050694de6 100644 --- a/packages/jest-circus/src/index.ts +++ b/packages/jest-circus/src/index.ts @@ -9,7 +9,7 @@ import chalk = require('chalk'); import {bind as bindEach} from 'jest-each'; import {formatExecError} from 'jest-message-util'; import {ErrorWithStack, isPromise} from 'jest-util'; -import {Circus, Global} from '@jest/types'; +import type {Circus, Global} from '@jest/types'; import {dispatch} from './state'; type THook = (fn: Circus.HookFn, timeout?: number) => void; diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts index 814bb2976bc8..34d214f38dbd 100644 --- a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts +++ b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts @@ -6,11 +6,11 @@ */ import * as path from 'path'; -import {Config} from '@jest/types'; -import {JestEnvironment} from '@jest/environment'; -import {TestResult} from '@jest/test-result'; +import type {Config} from '@jest/types'; +import type {JestEnvironment} from '@jest/environment'; +import type {TestResult} from '@jest/test-result'; import Runtime = require('jest-runtime'); -import {SnapshotStateType} from 'jest-snapshot'; +import type {SnapshotStateType} from 'jest-snapshot'; const FRAMEWORK_INITIALIZER = require.resolve('./jestAdapterInit'); diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts index bceca84537e8..257bd9dfd411 100644 --- a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts +++ b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {Circus, Config, Global} from '@jest/types'; -import {JestEnvironment} from '@jest/environment'; +import type {Circus, Config, Global} from '@jest/types'; +import type {JestEnvironment} from '@jest/environment'; import { AssertionResult, Status, diff --git a/packages/jest-circus/src/run.ts b/packages/jest-circus/src/run.ts index b07fa89ddaf2..71e846ebaed2 100644 --- a/packages/jest-circus/src/run.ts +++ b/packages/jest-circus/src/run.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Circus} from '@jest/types'; +import type {Circus} from '@jest/types'; import {RETRY_TIMES} from './types'; import {dispatch, getState} from './state'; diff --git a/packages/jest-circus/src/state.ts b/packages/jest-circus/src/state.ts index d42928e90bfa..2a5fcbb8a540 100644 --- a/packages/jest-circus/src/state.ts +++ b/packages/jest-circus/src/state.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Circus} from '@jest/types'; +import type {Circus} from '@jest/types'; import {STATE_SYM} from './types'; import {makeDescribe} from './utils'; diff --git a/packages/jest-circus/src/types.ts b/packages/jest-circus/src/types.ts index 9028bfb7e298..2001f920b95f 100644 --- a/packages/jest-circus/src/types.ts +++ b/packages/jest-circus/src/types.ts @@ -9,7 +9,7 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars import expect = require('expect'); // eslint-disable-next-line @typescript-eslint/no-unused-vars -import {Circus} from '@jest/types'; +import type {Circus} from '@jest/types'; export const STATE_SYM = (Symbol( 'JEST_STATE_SYMBOL', diff --git a/packages/jest-circus/src/utils.ts b/packages/jest-circus/src/utils.ts index 7594cbd5f47d..fa477c12d9db 100644 --- a/packages/jest-circus/src/utils.ts +++ b/packages/jest-circus/src/utils.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Circus} from '@jest/types'; +import type {Circus} from '@jest/types'; import {convertDescriptorToString} from 'jest-util'; import isGeneratorFn from 'is-generator-fn'; import co from 'co'; diff --git a/packages/jest-cli/src/__tests__/cli/args.test.ts b/packages/jest-cli/src/__tests__/cli/args.test.ts index 450c43c5c2fb..8e732954b771 100644 --- a/packages/jest-cli/src/__tests__/cli/args.test.ts +++ b/packages/jest-cli/src/__tests__/cli/args.test.ts @@ -6,7 +6,7 @@ * */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {constants} from 'jest-config'; import {check} from '../../cli/args'; import {buildArgv} from '../../cli'; diff --git a/packages/jest-cli/src/cli/args.ts b/packages/jest-cli/src/cli/args.ts index 47b0d5f89285..b368e8a5830d 100644 --- a/packages/jest-cli/src/cli/args.ts +++ b/packages/jest-cli/src/cli/args.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {constants, isJSONString} from 'jest-config'; import isCI = require('is-ci'); diff --git a/packages/jest-cli/src/cli/index.ts b/packages/jest-cli/src/cli/index.ts index c31d18e1a24e..91a41aef85d9 100644 --- a/packages/jest-cli/src/cli/index.ts +++ b/packages/jest-cli/src/cli/index.ts @@ -6,8 +6,8 @@ */ import * as path from 'path'; -import {Config} from '@jest/types'; -import {AggregatedResult} from '@jest/test-result'; +import type {Config} from '@jest/types'; +import type {AggregatedResult} from '@jest/test-result'; import {clearLine} from 'jest-util'; import {validateCLIOptions} from 'jest-validate'; import {deprecationEntries} from 'jest-config'; diff --git a/packages/jest-cli/src/init/generate_config_file.ts b/packages/jest-cli/src/init/generate_config_file.ts index 93389b9d6e3c..36c19bdf3759 100644 --- a/packages/jest-cli/src/init/generate_config_file.ts +++ b/packages/jest-cli/src/init/generate_config_file.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {defaults, descriptions} from 'jest-config'; const stringifyOption = ( diff --git a/packages/jest-cli/src/init/index.ts b/packages/jest-cli/src/init/index.ts index ce23c39b313f..5f732534af27 100644 --- a/packages/jest-cli/src/init/index.ts +++ b/packages/jest-cli/src/init/index.ts @@ -15,7 +15,7 @@ import defaultQuestions, {testScriptQuestion} from './questions'; import {MalformedPackageJsonError, NotFoundPackageJsonError} from './errors'; import generateConfigFile from './generate_config_file'; import modifyPackageJson from './modify_package_json'; -import {ProjectPackageJson} from './types'; +import type {ProjectPackageJson} from './types'; const { JEST_CONFIG_BASE_NAME, diff --git a/packages/jest-cli/src/init/modify_package_json.ts b/packages/jest-cli/src/init/modify_package_json.ts index c38835b00270..dd843aa0b5bb 100644 --- a/packages/jest-cli/src/init/modify_package_json.ts +++ b/packages/jest-cli/src/init/modify_package_json.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {ProjectPackageJson} from './types'; +import type {ProjectPackageJson} from './types'; const modifyPackageJson = ({ projectPackageJson, diff --git a/packages/jest-cli/src/init/questions.ts b/packages/jest-cli/src/init/questions.ts index d9179b2d1cb5..1473cb55382b 100644 --- a/packages/jest-cli/src/init/questions.ts +++ b/packages/jest-cli/src/init/questions.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {PromptObject} from 'prompts'; +import type {PromptObject} from 'prompts'; const defaultQuestions: Array = [ { diff --git a/packages/jest-cli/src/init/types.ts b/packages/jest-cli/src/init/types.ts index e846607dd5ac..14413b8bedc4 100644 --- a/packages/jest-cli/src/init/types.ts +++ b/packages/jest-cli/src/init/types.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; export type ProjectPackageJson = { jest?: Partial; diff --git a/packages/jest-config/src/Defaults.ts b/packages/jest-config/src/Defaults.ts index af912c569d2c..6cdc3cbe8a01 100644 --- a/packages/jest-config/src/Defaults.ts +++ b/packages/jest-config/src/Defaults.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {replacePathSepForRegex} from 'jest-regex-util'; import {NODE_MODULES} from './constants'; import getCacheDirectory from './getCacheDirectory'; diff --git a/packages/jest-config/src/Descriptions.ts b/packages/jest-config/src/Descriptions.ts index 16eb727b3925..8e67339e0637 100644 --- a/packages/jest-config/src/Descriptions.ts +++ b/packages/jest-config/src/Descriptions.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; const descriptions: {[key in keyof Config.InitialOptions]: string} = { automock: 'All imported modules in your tests should be mocked automatically', diff --git a/packages/jest-config/src/ReporterValidationErrors.ts b/packages/jest-config/src/ReporterValidationErrors.ts index 65d3b57b41ff..9a458913ef25 100644 --- a/packages/jest-config/src/ReporterValidationErrors.ts +++ b/packages/jest-config/src/ReporterValidationErrors.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {ValidationError} from 'jest-validate'; import chalk = require('chalk'); import getType = require('jest-get-type'); diff --git a/packages/jest-config/src/ValidConfig.ts b/packages/jest-config/src/ValidConfig.ts index b07cdb441f2c..de566c08c036 100644 --- a/packages/jest-config/src/ValidConfig.ts +++ b/packages/jest-config/src/ValidConfig.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {replacePathSepForRegex} from 'jest-regex-util'; import {multipleValidOptions} from 'jest-validate'; import {NODE_MODULES} from './constants'; diff --git a/packages/jest-config/src/__tests__/setFromArgv.test.ts b/packages/jest-config/src/__tests__/setFromArgv.test.ts index 8757fb685190..99d810f58e32 100644 --- a/packages/jest-config/src/__tests__/setFromArgv.test.ts +++ b/packages/jest-config/src/__tests__/setFromArgv.test.ts @@ -6,7 +6,7 @@ * */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import setFromArgv from '../setFromArgv'; test('maps special values to valid options', () => { diff --git a/packages/jest-config/src/getMaxWorkers.ts b/packages/jest-config/src/getMaxWorkers.ts index 4cc6b7845438..1036816a181c 100644 --- a/packages/jest-config/src/getMaxWorkers.ts +++ b/packages/jest-config/src/getMaxWorkers.ts @@ -6,7 +6,7 @@ */ import {cpus} from 'os'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; export default function getMaxWorkers( argv: Partial< diff --git a/packages/jest-config/src/index.ts b/packages/jest-config/src/index.ts index 495879ce59ed..85b6e34546d8 100644 --- a/packages/jest-config/src/index.ts +++ b/packages/jest-config/src/index.ts @@ -7,7 +7,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import chalk = require('chalk'); import {sync as realpath} from 'realpath-native'; import {isJSONString, replaceRootDirInPath} from './utils'; diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index e20d7026b108..4fbf26ffc57e 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -9,7 +9,7 @@ import {createHash} from 'crypto'; import {statSync} from 'fs'; import * as path from 'path'; import {sync as glob} from 'glob'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {ValidationError, validate} from 'jest-validate'; import {clearLine, replacePathSepForGlob} from 'jest-util'; import chalk = require('chalk'); diff --git a/packages/jest-config/src/readConfigFileAndSetRootDir.ts b/packages/jest-config/src/readConfigFileAndSetRootDir.ts index 7215a86cbd15..867c553b3019 100644 --- a/packages/jest-config/src/readConfigFileAndSetRootDir.ts +++ b/packages/jest-config/src/readConfigFileAndSetRootDir.ts @@ -7,7 +7,7 @@ import * as path from 'path'; import * as fs from 'fs'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; // @ts-ignore: vendored import jsonlint from './vendor/jsonlint'; import {JEST_CONFIG_EXT_JSON, PACKAGE_JSON} from './constants'; diff --git a/packages/jest-config/src/resolveConfigPath.ts b/packages/jest-config/src/resolveConfigPath.ts index d4773eef1e4e..52eed9a07e5c 100644 --- a/packages/jest-config/src/resolveConfigPath.ts +++ b/packages/jest-config/src/resolveConfigPath.ts @@ -7,7 +7,7 @@ import * as path from 'path'; import * as fs from 'fs'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import { JEST_CONFIG_BASE_NAME, JEST_CONFIG_EXT_ORDER, diff --git a/packages/jest-config/src/setFromArgv.ts b/packages/jest-config/src/setFromArgv.ts index 07428fed59b7..e9e287f64893 100644 --- a/packages/jest-config/src/setFromArgv.ts +++ b/packages/jest-config/src/setFromArgv.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; const specialArgs = ['_', '$0', 'h', 'help', 'config']; import {isJSONString} from './utils'; diff --git a/packages/jest-config/src/utils.ts b/packages/jest-config/src/utils.ts index 44cc7dc1e492..ea093ff50747 100644 --- a/packages/jest-config/src/utils.ts +++ b/packages/jest-config/src/utils.ts @@ -6,7 +6,7 @@ */ import * as path from 'path'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {ValidationError} from 'jest-validate'; import Resolver = require('jest-resolve'); import chalk = require('chalk'); diff --git a/packages/jest-console/src/BufferedConsole.ts b/packages/jest-console/src/BufferedConsole.ts index 17225d3d46f0..2ac94ac5c83b 100644 --- a/packages/jest-console/src/BufferedConsole.ts +++ b/packages/jest-console/src/BufferedConsole.ts @@ -10,7 +10,7 @@ import {Console} from 'console'; import {format} from 'util'; import chalk = require('chalk'); import {SourceMapRegistry, getCallsite} from '@jest/source-map'; -import { +import type { ConsoleBuffer, LogCounters, LogMessage, diff --git a/packages/jest-console/src/CustomConsole.ts b/packages/jest-console/src/CustomConsole.ts index d629995beb07..59a7e8441d7a 100644 --- a/packages/jest-console/src/CustomConsole.ts +++ b/packages/jest-console/src/CustomConsole.ts @@ -10,7 +10,7 @@ import {format} from 'util'; import {Console} from 'console'; import chalk = require('chalk'); import {clearLine} from 'jest-util'; -import {LogCounters, LogMessage, LogTimers, LogType} from './types'; +import type {LogCounters, LogMessage, LogTimers, LogType} from './types'; type Formatter = (type: LogType, message: LogMessage) => string; diff --git a/packages/jest-console/src/getConsoleOutput.ts b/packages/jest-console/src/getConsoleOutput.ts index 80097b76ad08..09a3232b557e 100644 --- a/packages/jest-console/src/getConsoleOutput.ts +++ b/packages/jest-console/src/getConsoleOutput.ts @@ -8,7 +8,7 @@ import * as path from 'path'; import chalk = require('chalk'); import slash = require('slash'); -import {ConsoleBuffer} from './types'; +import type {ConsoleBuffer} from './types'; export default ( root: string, diff --git a/packages/jest-console/src/index.ts b/packages/jest-console/src/index.ts index 8734d06f2271..8568eec26786 100644 --- a/packages/jest-console/src/index.ts +++ b/packages/jest-console/src/index.ts @@ -9,4 +9,4 @@ export {default as BufferedConsole} from './BufferedConsole'; export {default as CustomConsole} from './CustomConsole'; export {default as NullConsole} from './NullConsole'; export {default as getConsoleOutput} from './getConsoleOutput'; -export {ConsoleBuffer, LogMessage, LogType} from './types'; +export type {ConsoleBuffer, LogMessage, LogType} from './types'; diff --git a/packages/jest-core/src/FailedTestsCache.ts b/packages/jest-core/src/FailedTestsCache.ts index 095aad123aae..dcb0b370ff11 100644 --- a/packages/jest-core/src/FailedTestsCache.ts +++ b/packages/jest-core/src/FailedTestsCache.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import {Test} from 'jest-runner'; -import {Config} from '@jest/types'; -import {TestResult} from '@jest/test-result'; +import type {Test} from 'jest-runner'; +import type {Config} from '@jest/types'; +import type {TestResult} from '@jest/test-result'; type TestMap = Record>; diff --git a/packages/jest-core/src/ReporterDispatcher.ts b/packages/jest-core/src/ReporterDispatcher.ts index 1e3907f90e2d..e9bd47dbb319 100644 --- a/packages/jest-core/src/ReporterDispatcher.ts +++ b/packages/jest-core/src/ReporterDispatcher.ts @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -import {AggregatedResult, TestResult} from '@jest/test-result'; -import {Test} from 'jest-runner'; -import {Context} from 'jest-runtime'; -import {Reporter, ReporterOnStartOptions} from '@jest/reporters'; +import type {AggregatedResult, TestResult} from '@jest/test-result'; +import type {Test} from 'jest-runner'; +import type {Context} from 'jest-runtime'; +import type {Reporter, ReporterOnStartOptions} from '@jest/reporters'; export default class ReporterDispatcher { private _reporters: Array; diff --git a/packages/jest-core/src/SearchSource.ts b/packages/jest-core/src/SearchSource.ts index 4a4900b324ee..a2b30f8b2652 100644 --- a/packages/jest-core/src/SearchSource.ts +++ b/packages/jest-core/src/SearchSource.ts @@ -8,16 +8,16 @@ import * as os from 'os'; import * as path from 'path'; import micromatch = require('micromatch'); -import {Context} from 'jest-runtime'; -import {Config} from '@jest/types'; -import {Test} from 'jest-runner'; -import {ChangedFiles} from 'jest-changed-files'; +import type {Context} from 'jest-runtime'; +import type {Config} from '@jest/types'; +import type {Test} from 'jest-runner'; +import type {ChangedFiles} from 'jest-changed-files'; import DependencyResolver = require('jest-resolve-dependencies'); import {escapePathForRegex} from 'jest-regex-util'; import {replaceRootDirInPath} from 'jest-config'; import {buildSnapshotResolver} from 'jest-snapshot'; import {replacePathSepForGlob, testPathPatternToRegExp} from 'jest-util'; -import {Filter, Stats, TestPathCases} from './types'; +import type {Filter, Stats, TestPathCases} from './types'; export type SearchResult = { noSCM?: boolean; diff --git a/packages/jest-core/src/SnapshotInteractiveMode.ts b/packages/jest-core/src/SnapshotInteractiveMode.ts index 86968b26a6cc..360c35f5473e 100644 --- a/packages/jest-core/src/SnapshotInteractiveMode.ts +++ b/packages/jest-core/src/SnapshotInteractiveMode.ts @@ -7,7 +7,7 @@ import chalk = require('chalk'); import ansiEscapes = require('ansi-escapes'); -import {AggregatedResult, AssertionLocation} from '@jest/test-result'; +import type {AggregatedResult, AssertionLocation} from '@jest/test-result'; import {KEYS} from 'jest-watcher'; import {pluralize, specialChars} from 'jest-util'; diff --git a/packages/jest-core/src/TestNamePatternPrompt.ts b/packages/jest-core/src/TestNamePatternPrompt.ts index 9de302651ab8..323a73835842 100644 --- a/packages/jest-core/src/TestNamePatternPrompt.ts +++ b/packages/jest-core/src/TestNamePatternPrompt.ts @@ -12,7 +12,7 @@ import { printPatternCaret, printRestoredPatternCaret, } from 'jest-watcher'; -import {TestResult} from '@jest/test-result'; +import type {TestResult} from '@jest/test-result'; // TODO: Make underscored props `private` export default class TestNamePatternPrompt extends PatternPrompt { diff --git a/packages/jest-core/src/TestPathPatternPrompt.ts b/packages/jest-core/src/TestPathPatternPrompt.ts index 6d9cd7fe0a00..59ad72e8aed1 100644 --- a/packages/jest-core/src/TestPathPatternPrompt.ts +++ b/packages/jest-core/src/TestPathPatternPrompt.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {Context} from 'jest-runtime'; -import {Test} from 'jest-runner'; +import type {Context} from 'jest-runtime'; +import type {Test} from 'jest-runner'; import { PatternPrompt, @@ -15,7 +15,7 @@ import { printPatternCaret, printRestoredPatternCaret, } from 'jest-watcher'; -import SearchSource from './SearchSource'; +import type SearchSource from './SearchSource'; type SearchSources = Array<{ context: Context; diff --git a/packages/jest-core/src/TestScheduler.ts b/packages/jest-core/src/TestScheduler.ts index e3901da14834..3211459f2148 100644 --- a/packages/jest-core/src/TestScheduler.ts +++ b/packages/jest-core/src/TestScheduler.ts @@ -7,10 +7,10 @@ import chalk = require('chalk'); import {formatExecError} from 'jest-message-util'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import snapshot = require('jest-snapshot'); import TestRunner = require('jest-runner'); -import {Context} from 'jest-runtime'; +import type {Context} from 'jest-runtime'; import { CoverageReporter, DefaultReporter, @@ -30,7 +30,7 @@ import { } from '@jest/test-result'; import {interopRequireDefault} from 'jest-util'; import ReporterDispatcher from './ReporterDispatcher'; -import TestWatcher from './TestWatcher'; +import type TestWatcher from './TestWatcher'; import {shouldRunInBand} from './testSchedulerHelper'; // The default jest-runner is required because it is the default test runner diff --git a/packages/jest-core/src/__tests__/SearchSource.test.ts b/packages/jest-core/src/__tests__/SearchSource.test.ts index a3a8d05a4067..292e5e4b986a 100644 --- a/packages/jest-core/src/__tests__/SearchSource.test.ts +++ b/packages/jest-core/src/__tests__/SearchSource.test.ts @@ -10,7 +10,7 @@ import * as path from 'path'; import Runtime = require('jest-runtime'); import {normalize} from 'jest-config'; import {Test} from 'jest-runner'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import SearchSource, {SearchResult} from '../SearchSource'; jest.setTimeout(15000); diff --git a/packages/jest-core/src/__tests__/watch-file-changes.test.ts b/packages/jest-core/src/__tests__/watch-file-changes.test.ts index cfc43aaff8cd..be0f3c97760c 100644 --- a/packages/jest-core/src/__tests__/watch-file-changes.test.ts +++ b/packages/jest-core/src/__tests__/watch-file-changes.test.ts @@ -14,7 +14,7 @@ import Runtime = require('jest-runtime'); import {normalize} from 'jest-config'; import HasteMap = require('jest-haste-map'); import rimraf = require('rimraf'); -import {AggregatedResult} from '@jest/test-result'; +import type {AggregatedResult} from '@jest/test-result'; describe('Watch mode flows with changed files', () => { jest.resetModules(); @@ -56,8 +56,8 @@ describe('Watch mode flows with changed files', () => { ` require('./lost-file.js'); describe('Fake test', () => { - it('Hey', () => { - + it('Hey', () => { + }); }); `, diff --git a/packages/jest-core/src/cli/index.ts b/packages/jest-core/src/cli/index.ts index 49d0b990c7cf..9faffd0dcc15 100644 --- a/packages/jest-core/src/cli/index.ts +++ b/packages/jest-core/src/cli/index.ts @@ -5,18 +5,18 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; -import {AggregatedResult} from '@jest/test-result'; +import type {Config} from '@jest/types'; +import type {AggregatedResult} from '@jest/test-result'; import {CustomConsole} from '@jest/console'; import {createDirectory, preRunMessage} from 'jest-util'; import {readConfigs} from 'jest-config'; import Runtime = require('jest-runtime'); -import {ChangedFilesPromise} from 'jest-changed-files'; +import type {ChangedFilesPromise} from 'jest-changed-files'; import HasteMap = require('jest-haste-map'); import chalk = require('chalk'); import rimraf = require('rimraf'); import exit = require('exit'); -import {Filter} from '../types'; +import type {Filter} from '../types'; import createContext from '../lib/create_context'; import getChangedFilesPromise from '../getChangedFilesPromise'; import {formatHandleErrors} from '../collectHandles'; diff --git a/packages/jest-core/src/collectHandles.ts b/packages/jest-core/src/collectHandles.ts index bbb1d92f5819..6cb0f8eb99e6 100644 --- a/packages/jest-core/src/collectHandles.ts +++ b/packages/jest-core/src/collectHandles.ts @@ -6,7 +6,7 @@ */ import * as asyncHooks from 'async_hooks'; -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {formatExecError} from 'jest-message-util'; import {ErrorWithStack} from 'jest-util'; import stripAnsi = require('strip-ansi'); diff --git a/packages/jest-core/src/getChangedFilesPromise.ts b/packages/jest-core/src/getChangedFilesPromise.ts index 390851254daf..8e75aaa33d56 100644 --- a/packages/jest-core/src/getChangedFilesPromise.ts +++ b/packages/jest-core/src/getChangedFilesPromise.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {ChangedFilesPromise, getChangedFilesForRoots} from 'jest-changed-files'; import {formatExecError} from 'jest-message-util'; import chalk = require('chalk'); diff --git a/packages/jest-core/src/getNoTestFound.ts b/packages/jest-core/src/getNoTestFound.ts index 647393d312b3..290d879ec8a1 100644 --- a/packages/jest-core/src/getNoTestFound.ts +++ b/packages/jest-core/src/getNoTestFound.ts @@ -6,8 +6,8 @@ */ import chalk = require('chalk'); -import {Config} from '@jest/types'; -import {TestRunData} from './types'; +import type {Config} from '@jest/types'; +import type {TestRunData} from './types'; import pluralize from './pluralize'; export default function getNoTestFound( diff --git a/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts b/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts index a42c93abc0e3..d4e58ebe1221 100644 --- a/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts +++ b/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts @@ -6,7 +6,7 @@ */ import chalk = require('chalk'); -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {isInteractive} from 'jest-util'; export default function getNoTestFoundRelatedToChangedFiles( diff --git a/packages/jest-core/src/getNoTestFoundVerbose.ts b/packages/jest-core/src/getNoTestFoundVerbose.ts index 71314a3878e9..a79cf5f371a6 100644 --- a/packages/jest-core/src/getNoTestFoundVerbose.ts +++ b/packages/jest-core/src/getNoTestFoundVerbose.ts @@ -6,9 +6,9 @@ */ import chalk = require('chalk'); -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import pluralize from './pluralize'; -import {Stats, TestRunData} from './types'; +import type {Stats, TestRunData} from './types'; export default function getNoTestFoundVerbose( testRunData: TestRunData, diff --git a/packages/jest-core/src/getNoTestsFoundMessage.ts b/packages/jest-core/src/getNoTestsFoundMessage.ts index a411527ee265..d43468e9fefc 100644 --- a/packages/jest-core/src/getNoTestsFoundMessage.ts +++ b/packages/jest-core/src/getNoTestsFoundMessage.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; -import {TestRunData} from './types'; +import type {Config} from '@jest/types'; +import type {TestRunData} from './types'; import getNoTestFound from './getNoTestFound'; import getNoTestFoundRelatedToChangedFiles from './getNoTestFoundRelatedToChangedFiles'; import getNoTestFoundVerbose from './getNoTestFoundVerbose'; diff --git a/packages/jest-core/src/lib/active_filters_message.ts b/packages/jest-core/src/lib/active_filters_message.ts index 97df611b11ad..9f7d40801743 100644 --- a/packages/jest-core/src/lib/active_filters_message.ts +++ b/packages/jest-core/src/lib/active_filters_message.ts @@ -6,7 +6,7 @@ */ import chalk = require('chalk'); -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; const activeFilters = ( globalConfig: Config.GlobalConfig, diff --git a/packages/jest-core/src/lib/create_context.ts b/packages/jest-core/src/lib/create_context.ts index 37439730d1ed..410e0b998c87 100644 --- a/packages/jest-core/src/lib/create_context.ts +++ b/packages/jest-core/src/lib/create_context.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import Runtime = require('jest-runtime'); -import {HasteMapObject} from 'jest-haste-map'; +import type {HasteMapObject} from 'jest-haste-map'; export default ( config: Config.ProjectConfig, diff --git a/packages/jest-core/src/lib/is_valid_path.ts b/packages/jest-core/src/lib/is_valid_path.ts index d37dd14e9774..65180f844623 100644 --- a/packages/jest-core/src/lib/is_valid_path.ts +++ b/packages/jest-core/src/lib/is_valid_path.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {isSnapshotPath} from 'jest-snapshot'; export default function isValidPath( diff --git a/packages/jest-core/src/lib/log_debug_messages.ts b/packages/jest-core/src/lib/log_debug_messages.ts index 6ae3a51d1d4c..57804ae9fcc0 100644 --- a/packages/jest-core/src/lib/log_debug_messages.ts +++ b/packages/jest-core/src/lib/log_debug_messages.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; const VERSION = require('../../package.json').version; diff --git a/packages/jest-core/src/lib/update_global_config.ts b/packages/jest-core/src/lib/update_global_config.ts index 3a0f2879338c..992a03631bdd 100644 --- a/packages/jest-core/src/lib/update_global_config.ts +++ b/packages/jest-core/src/lib/update_global_config.ts @@ -6,8 +6,8 @@ */ import {replacePathSepForRegex} from 'jest-regex-util'; -import {Config} from '@jest/types'; -import {AllowedConfigOptions} from 'jest-watcher'; +import type {Config} from '@jest/types'; +import type {AllowedConfigOptions} from 'jest-watcher'; type ExtraConfigOptions = Partial< Pick diff --git a/packages/jest-core/src/lib/watch_plugins_helpers.ts b/packages/jest-core/src/lib/watch_plugins_helpers.ts index e9fbac71bffa..0da6d432d106 100644 --- a/packages/jest-core/src/lib/watch_plugins_helpers.ts +++ b/packages/jest-core/src/lib/watch_plugins_helpers.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; -import {UsageData, WatchPlugin} from 'jest-watcher'; +import type {Config} from '@jest/types'; +import type {UsageData, WatchPlugin} from 'jest-watcher'; export const filterInteractivePlugins = ( watchPlugins: Array, diff --git a/packages/jest-core/src/plugins/test_name_pattern.ts b/packages/jest-core/src/plugins/test_name_pattern.ts index b16560337f11..5c76866ef9ff 100644 --- a/packages/jest-core/src/plugins/test_name_pattern.ts +++ b/packages/jest-core/src/plugins/test_name_pattern.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {BaseWatchPlugin, Prompt, UpdateConfigCallback} from 'jest-watcher'; import TestNamePatternPrompt from '../TestNamePatternPrompt'; import activeFilters from '../lib/active_filters_message'; diff --git a/packages/jest-core/src/plugins/test_path_pattern.ts b/packages/jest-core/src/plugins/test_path_pattern.ts index aa37447fde83..5abe1e1e9279 100644 --- a/packages/jest-core/src/plugins/test_path_pattern.ts +++ b/packages/jest-core/src/plugins/test_path_pattern.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import {BaseWatchPlugin, Prompt, UpdateConfigCallback} from 'jest-watcher'; import TestPathPatternPrompt from '../TestPathPatternPrompt'; import activeFilters from '../lib/active_filters_message'; diff --git a/packages/jest-core/src/plugins/update_snapshots.ts b/packages/jest-core/src/plugins/update_snapshots.ts index 7007ac413c6c..9c07e919018d 100644 --- a/packages/jest-core/src/plugins/update_snapshots.ts +++ b/packages/jest-core/src/plugins/update_snapshots.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import { BaseWatchPlugin, JestHookSubscriber, diff --git a/packages/jest-core/src/plugins/update_snapshots_interactive.ts b/packages/jest-core/src/plugins/update_snapshots_interactive.ts index 5670d1f84dbc..31414365672d 100644 --- a/packages/jest-core/src/plugins/update_snapshots_interactive.ts +++ b/packages/jest-core/src/plugins/update_snapshots_interactive.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; -import {AggregatedResult, AssertionLocation} from '@jest/test-result'; +import type {Config} from '@jest/types'; +import type {AggregatedResult, AssertionLocation} from '@jest/test-result'; import {BaseWatchPlugin, JestHookSubscriber} from 'jest-watcher'; import SnapshotInteractiveMode from '../SnapshotInteractiveMode'; diff --git a/packages/jest-core/src/runGlobalHook.ts b/packages/jest-core/src/runGlobalHook.ts index c84a9d3a14a4..405e5df5c00a 100644 --- a/packages/jest-core/src/runGlobalHook.ts +++ b/packages/jest-core/src/runGlobalHook.ts @@ -6,8 +6,8 @@ */ import pEachSeries = require('p-each-series'); -import {Config} from '@jest/types'; -import {Test} from 'jest-runner'; +import type {Config} from '@jest/types'; +import type {Test} from 'jest-runner'; import {ScriptTransformer} from '@jest/transform'; import {interopRequireDefault} from 'jest-util'; diff --git a/packages/jest-core/src/runJest.ts b/packages/jest-core/src/runJest.ts index c8fbb8754fc3..38bcb8dc95be 100644 --- a/packages/jest-core/src/runJest.ts +++ b/packages/jest-core/src/runJest.ts @@ -13,25 +13,24 @@ import {interopRequireDefault} from 'jest-util'; import exit = require('exit'); import * as fs from 'graceful-fs'; import {JestHook, JestHookEmitter} from 'jest-watcher'; -import {Context} from 'jest-runtime'; -import {Test} from 'jest-runner'; -import {Config} from '@jest/types'; +import type {Context} from 'jest-runtime'; +import type {Test} from 'jest-runner'; +import type {Config} from '@jest/types'; import { AggregatedResult, formatTestResults, makeEmptyAggregatedTestResult, } from '@jest/test-result'; -// eslint-disable-next-line import/no-extraneous-dependencies -import TestSequencer from '@jest/test-sequencer'; -import {ChangedFiles, ChangedFilesPromise} from 'jest-changed-files'; +import type TestSequencer from '@jest/test-sequencer'; +import type {ChangedFiles, ChangedFilesPromise} from 'jest-changed-files'; import getNoTestsFoundMessage from './getNoTestsFoundMessage'; import runGlobalHook from './runGlobalHook'; import SearchSource from './SearchSource'; import TestScheduler, {TestSchedulerContext} from './TestScheduler'; -import FailedTestsCache from './FailedTestsCache'; +import type FailedTestsCache from './FailedTestsCache'; import collectNodeHandles from './collectHandles'; -import TestWatcher from './TestWatcher'; -import {Filter, TestRunData} from './types'; +import type TestWatcher from './TestWatcher'; +import type {Filter, TestRunData} from './types'; const getTestPaths = async ( globalConfig: Config.GlobalConfig, diff --git a/packages/jest-core/src/testSchedulerHelper.ts b/packages/jest-core/src/testSchedulerHelper.ts index 5866030184e1..a75b6a4cb8cf 100644 --- a/packages/jest-core/src/testSchedulerHelper.ts +++ b/packages/jest-core/src/testSchedulerHelper.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {Config} from '@jest/types'; -import {Test} from 'jest-runner'; +import type {Config} from '@jest/types'; +import type {Test} from 'jest-runner'; const SLOW_TEST_TIME = 1000; diff --git a/packages/jest-core/src/types.ts b/packages/jest-core/src/types.ts index 04fd908b70b2..efba913eee8b 100644 --- a/packages/jest-core/src/types.ts +++ b/packages/jest-core/src/types.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import {Context} from 'jest-runtime'; -import {Test} from 'jest-runner'; -import {Config} from '@jest/types'; +import type {Context} from 'jest-runtime'; +import type {Test} from 'jest-runner'; +import type {Config} from '@jest/types'; export type Stats = { roots: number; diff --git a/packages/jest-core/src/watch.ts b/packages/jest-core/src/watch.ts index 400986d3871c..49c74bf981bc 100644 --- a/packages/jest-core/src/watch.ts +++ b/packages/jest-core/src/watch.ts @@ -14,9 +14,9 @@ import HasteMap = require('jest-haste-map'); import {formatExecError} from 'jest-message-util'; import {isInteractive, preRunMessage, specialChars} from 'jest-util'; import {ValidationError} from 'jest-validate'; -import {Context} from 'jest-runtime'; +import type {Context} from 'jest-runtime'; import Resolver = require('jest-resolve'); -import {Config} from '@jest/types'; +import type {Config} from '@jest/types'; import { AllowedConfigOptions, JestHook, @@ -42,7 +42,7 @@ import { getSortedUsageRows, } from './lib/watch_plugins_helpers'; import activeFilters from './lib/active_filters_message'; -import {Filter} from './types'; +import type {Filter} from './types'; type ReservedInfo = { forbiddenOverwriteMessage?: string; diff --git a/packages/jest-diff/src/diffLines.ts b/packages/jest-diff/src/diffLines.ts index 3fefd37a3f45..89e71f866b49 100644 --- a/packages/jest-diff/src/diffLines.ts +++ b/packages/jest-diff/src/diffLines.ts @@ -9,7 +9,7 @@ import diff from 'diff-sequences'; import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff} from './cleanupSemantic'; import {normalizeDiffOptions} from './normalizeDiffOptions'; import {printDiffLines} from './printDiffs'; -import {DiffOptions} from './types'; +import type {DiffOptions} from './types'; const isEmptyString = (lines: Array) => lines.length === 1 && lines[0].length === 0; diff --git a/packages/jest-diff/src/getAlignedDiffs.ts b/packages/jest-diff/src/getAlignedDiffs.ts index c17117b4a199..e4831f509409 100644 --- a/packages/jest-diff/src/getAlignedDiffs.ts +++ b/packages/jest-diff/src/getAlignedDiffs.ts @@ -6,7 +6,7 @@ */ import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff} from './cleanupSemantic'; -import {DiffOptionsColor} from './types'; +import type {DiffOptionsColor} from './types'; // Given change op and array of diffs, return concatenated string: // * include common strings diff --git a/packages/jest-diff/src/index.ts b/packages/jest-diff/src/index.ts index e7c4c3752bc5..9c9b7f7be867 100644 --- a/packages/jest-diff/src/index.ts +++ b/packages/jest-diff/src/index.ts @@ -12,13 +12,9 @@ import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff} from './cleanupSemantic'; import {diffLinesRaw, diffLinesUnified, diffLinesUnified2} from './diffLines'; import {diffStringsRaw, diffStringsUnified} from './printDiffs'; import {NO_DIFF_MESSAGE, SIMILAR_MESSAGE} from './constants'; -import { - DiffOptions as ImportDiffOptions, - DiffOptionsColor as ImportDiffOptionsColor, -} from './types'; +import type {DiffOptions} from './types'; -export type DiffOptions = ImportDiffOptions; -export type DiffOptionsColor = ImportDiffOptionsColor; +export type {DiffOptions, DiffOptionsColor} from './types'; export {diffLinesRaw, diffLinesUnified, diffLinesUnified2}; export {diffStringsRaw, diffStringsUnified}; diff --git a/packages/jest-diff/src/joinAlignedDiffs.ts b/packages/jest-diff/src/joinAlignedDiffs.ts index 7c69e9e2445c..3b3a079eaa6a 100644 --- a/packages/jest-diff/src/joinAlignedDiffs.ts +++ b/packages/jest-diff/src/joinAlignedDiffs.ts @@ -12,7 +12,7 @@ import { printDeleteLine, printInsertLine, } from './printDiffs'; -import {DiffOptionsNormalized} from './types'; +import type {DiffOptionsNormalized} from './types'; // jest --no-expand // diff --git a/packages/jest-diff/src/normalizeDiffOptions.ts b/packages/jest-diff/src/normalizeDiffOptions.ts index 6ba1e93c561a..b059c1c490f3 100644 --- a/packages/jest-diff/src/normalizeDiffOptions.ts +++ b/packages/jest-diff/src/normalizeDiffOptions.ts @@ -7,7 +7,7 @@ import chalk = require('chalk'); -import {DiffOptions, DiffOptionsNormalized} from './types'; +import type {DiffOptions, DiffOptionsNormalized} from './types'; export const noColor = (string: string): string => string; diff --git a/packages/jest-diff/src/printDiffs.ts b/packages/jest-diff/src/printDiffs.ts index 50a48c26c6c1..05f8619e2b93 100644 --- a/packages/jest-diff/src/printDiffs.ts +++ b/packages/jest-diff/src/printDiffs.ts @@ -20,7 +20,11 @@ import { joinAlignedDiffsNoExpand, } from './joinAlignedDiffs'; import {normalizeDiffOptions} from './normalizeDiffOptions'; -import {DiffOptions, DiffOptionsColor, DiffOptionsNormalized} from './types'; +import type { + DiffOptions, + DiffOptionsColor, + DiffOptionsNormalized, +} from './types'; const formatTrailingSpaces = ( line: string, diff --git a/packages/jest-each/src/bind.ts b/packages/jest-each/src/bind.ts index c32542e9ea41..773f722a4c6d 100644 --- a/packages/jest-each/src/bind.ts +++ b/packages/jest-each/src/bind.ts @@ -6,7 +6,7 @@ * */ -import {Global} from '@jest/types'; +import type {Global} from '@jest/types'; import {ErrorWithStack} from 'jest-util'; import convertArrayTable from './table/array'; diff --git a/packages/jest-each/src/index.ts b/packages/jest-each/src/index.ts index 016e5f60293c..85a213b0cf47 100644 --- a/packages/jest-each/src/index.ts +++ b/packages/jest-each/src/index.ts @@ -6,7 +6,7 @@ * */ -import {Global} from '@jest/types'; +import type {Global} from '@jest/types'; import bind from './bind'; type Global = Global.Global; diff --git a/packages/jest-each/src/table/array.ts b/packages/jest-each/src/table/array.ts index 98a38d82ecfc..61eeb1e58ee2 100644 --- a/packages/jest-each/src/table/array.ts +++ b/packages/jest-each/src/table/array.ts @@ -9,8 +9,8 @@ import * as util from 'util'; import pretty = require('pretty-format'); -import {Global} from '@jest/types'; -import {EachTests} from '../bind'; +import type {Global} from '@jest/types'; +import type {EachTests} from '../bind'; const SUPPORTED_PLACEHOLDERS = /%[sdifjoOp%]/g; const PRETTY_PLACEHOLDER = '%p'; diff --git a/packages/jest-each/src/table/template.ts b/packages/jest-each/src/table/template.ts index d6208c1c3840..936410189a7d 100644 --- a/packages/jest-each/src/table/template.ts +++ b/packages/jest-each/src/table/template.ts @@ -8,8 +8,8 @@ import pretty = require('pretty-format'); import {isPrimitive} from 'jest-get-type'; -import {Global} from '@jest/types'; -import {EachTests} from '../bind'; +import type {Global} from '@jest/types'; +import type {EachTests} from '../bind'; type Template = Record; type Templates = Array