diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 3a445ce334a1..c7a6e781bc9b 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -344,7 +344,6 @@ module.exports = { 'handle-callback-err': 'off', 'id-length': 'off', 'id-match': 'off', - 'import/no-duplicates': 'error', 'import/no-extraneous-dependencies': [ 'error', { @@ -414,6 +413,7 @@ module.exports = { 'no-dupe-class-members': 'error', 'no-dupe-keys': 'error', 'no-duplicate-case': 'error', + 'no-duplicate-imports': 'error', 'no-else-return': 'off', 'no-empty': 'off', 'no-empty-character-class': 'warn', diff --git a/e2e/babel-plugin-jest-hoist/__tests__/importJest.test.js b/e2e/babel-plugin-jest-hoist/__tests__/importJest.test.js index 21bce0f6957f..7252283d0e4f 100644 --- a/e2e/babel-plugin-jest-hoist/__tests__/importJest.test.js +++ b/e2e/babel-plugin-jest-hoist/__tests__/importJest.test.js @@ -6,11 +6,11 @@ * */ -/* eslint-disable import/no-duplicates */ +/* eslint-disable no-duplicate-imports */ import {jest} from '@jest/globals'; import {jest as aliasedJest} from '@jest/globals'; import * as JestGlobals from '@jest/globals'; -/* eslint-enable import/no-duplicates */ +/* eslint-enable no-duplicate-imports */ import a from '../__test_modules__/a'; import b from '../__test_modules__/b'; import c from '../__test_modules__/c'; diff --git a/e2e/native-esm/__tests__/native-esm.test.js b/e2e/native-esm/__tests__/native-esm.test.js index 494d67e62146..d99607115780 100644 --- a/e2e/native-esm/__tests__/native-esm.test.js +++ b/e2e/native-esm/__tests__/native-esm.test.js @@ -18,11 +18,9 @@ import staticImportedStatefulFromCjs from '../fromCjs.mjs'; import {double} from '../index'; import defaultFromCjs, {half, namedFunction} from '../namedExport.cjs'; import {bag} from '../namespaceExport.js'; -/* eslint-disable import/no-duplicates */ import staticImportedStateful from '../stateful.mjs'; import staticImportedStatefulWithQuery from '../stateful.mjs?query=1'; import staticImportedStatefulWithAnotherQuery from '../stateful.mjs?query=2'; -/* eslint-enable import/no-duplicates */ test('should have correct import.meta', () => { expect(typeof require).toBe('undefined'); diff --git a/packages/jest-diff/src/index.ts b/packages/jest-diff/src/index.ts index fb33e9e16863..1c4f68fcbbad 100644 --- a/packages/jest-diff/src/index.ts +++ b/packages/jest-diff/src/index.ts @@ -8,10 +8,10 @@ import chalk = require('chalk'); import {getType} from 'jest-get-type'; import { + PrettyFormatOptions, format as prettyFormat, plugins as prettyFormatPlugins, } from 'pretty-format'; -import type {PrettyFormatOptions} from 'pretty-format'; import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff} from './cleanupSemantic'; import {NO_DIFF_MESSAGE, SIMILAR_MESSAGE} from './constants'; import {diffLinesRaw, diffLinesUnified, diffLinesUnified2} from './diffLines'; diff --git a/packages/jest-each/src/table/array.ts b/packages/jest-each/src/table/array.ts index 14bc5df89e07..7fb027a451f3 100644 --- a/packages/jest-each/src/table/array.ts +++ b/packages/jest-each/src/table/array.ts @@ -10,8 +10,7 @@ import * as util from 'util'; import type {Global} from '@jest/types'; import {format as pretty} from 'pretty-format'; import type {EachTests} from '../bind'; -import type {Templates} from './interpolation'; -import {interpolateVariables} from './interpolation'; +import {Templates, interpolateVariables} from './interpolation'; 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 a7d90a163a8d..694bcacbd4b8 100644 --- a/packages/jest-each/src/table/template.ts +++ b/packages/jest-each/src/table/template.ts @@ -8,8 +8,12 @@ import type {Global} from '@jest/types'; import type {EachTests} from '../bind'; -import type {Headings, Template, Templates} from './interpolation'; -import {interpolateVariables} from './interpolation'; +import { + Headings, + Template, + Templates, + interpolateVariables, +} from './interpolation'; export default function template( title: string, diff --git a/packages/jest-reporters/__typetests__/jest-reporters.test.ts b/packages/jest-reporters/__typetests__/jest-reporters.test.ts index ba538ed4bf5b..d49c2fcdd555 100644 --- a/packages/jest-reporters/__typetests__/jest-reporters.test.ts +++ b/packages/jest-reporters/__typetests__/jest-reporters.test.ts @@ -6,13 +6,13 @@ */ import {expectError, expectType} from 'tsd-lite'; -import {utils} from '@jest/reporters'; -import type { +import { AggregatedResult, Config, SnapshotSummary, SummaryOptions, TestResult, + utils, } from '@jest/reporters'; declare const aggregatedResults: AggregatedResult; diff --git a/packages/jest-runner/__typetests__/jest-runner.test.ts b/packages/jest-runner/__typetests__/jest-runner.test.ts index 97ad722655ab..8e068abe0106 100644 --- a/packages/jest-runner/__typetests__/jest-runner.test.ts +++ b/packages/jest-runner/__typetests__/jest-runner.test.ts @@ -6,10 +6,11 @@ */ import {expectType} from 'tsd-lite'; -import {CallbackTestRunner, EmittingTestRunner} from 'jest-runner'; -import type { +import { + CallbackTestRunner, CallbackTestRunnerInterface, Config, + EmittingTestRunner, EmittingTestRunnerInterface, OnTestFailure, OnTestStart, diff --git a/packages/jest-runtime/src/index.ts b/packages/jest-runtime/src/index.ts index 5a4b38af6b06..00f36fe8272b 100644 --- a/packages/jest-runtime/src/index.ts +++ b/packages/jest-runtime/src/index.ts @@ -48,8 +48,7 @@ import { shouldInstrument, } from '@jest/transform'; import type {Config, Global} from '@jest/types'; -import type {IModuleMap} from 'jest-haste-map'; -import HasteMap from 'jest-haste-map'; +import HasteMap, {IModuleMap} from 'jest-haste-map'; import {formatStackTrace, separateMessageFromStack} from 'jest-message-util'; import type {MockFunctionMetadata, ModuleMocker} from 'jest-mock'; import {escapePathForRegex} from 'jest-regex-util';