diff --git a/.eslintrc.js b/.eslintrc.js index bb36714e2a68..3608aed77d00 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -100,7 +100,6 @@ module.exports = { 'packages/expect/src/matchers.ts', 'packages/expect/src/print.ts', 'packages/expect/src/toThrowMatchers.ts', - 'packages/expect/src/types.ts', 'packages/expect/src/utils.ts', 'packages/jest-core/src/ReporterDispatcher.ts', 'packages/jest-core/src/TestScheduler.ts', @@ -259,11 +258,13 @@ module.exports = { 'website/**', '**/__mocks__/**', '**/__tests__/**', + '**/__typetests__/**', '**/__performance_tests__/**', 'packages/diff-sequences/perf/index.js', 'packages/pretty-format/perf/test.js', ], rules: { + '@typescript-eslint/no-unused-vars': 'off', 'import/no-unresolved': 'off', 'no-console': 'off', 'no-unused-vars': 'off', diff --git a/e2e/coverage-remapping/covered.ts b/e2e/coverage-remapping/covered.ts index c98fb1b4d9eb..1e17add201fc 100644 --- a/e2e/coverage-remapping/covered.ts +++ b/e2e/coverage-remapping/covered.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-disable local/ban-types-eventually, @typescript-eslint/no-unused-vars */ +/* eslint-disable local/ban-types-eventually */ export = function difference(a: number, b: number): number { const branch1: boolean = true ? 1 : 0; diff --git a/e2e/stack-trace-source-maps-with-coverage/lib.ts b/e2e/stack-trace-source-maps-with-coverage/lib.ts index 9142999572c5..18d7f451daae 100644 --- a/e2e/stack-trace-source-maps-with-coverage/lib.ts +++ b/e2e/stack-trace-source-maps-with-coverage/lib.ts @@ -4,8 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -// @ts-expect-error -// eslint-disable-next-line @typescript-eslint/no-unused-vars + interface NotUsedButTakesUpLines { a: number; b: string; diff --git a/e2e/stack-trace-source-maps/__tests__/fails.ts b/e2e/stack-trace-source-maps/__tests__/fails.ts index eaca9bfca2ef..90465ec9dc82 100644 --- a/e2e/stack-trace-source-maps/__tests__/fails.ts +++ b/e2e/stack-trace-source-maps/__tests__/fails.ts @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -// eslint-disable-next-line @typescript-eslint/no-unused-vars + interface NotUsedButTakesUpLines { a: number; b: string; diff --git a/packages/expect/__typetests__/expect.test.ts b/packages/expect/__typetests__/expect.test.ts index 0fd539c8d9dd..af5d2ad1fe21 100644 --- a/packages/expect/__typetests__/expect.test.ts +++ b/packages/expect/__typetests__/expect.test.ts @@ -5,9 +5,12 @@ * LICENSE file in the root directory of this source tree. */ +import {expectError} from 'tsd-lite'; import type * as expect from 'expect'; -export type M = expect.Matchers; -export type N = expect.Matchers; -// @ts-expect-error: Generic type 'Matchers' requires between 1 and 2 type arguments. -export type E = expect.Matchers; +type M = expect.Matchers; +type N = expect.Matchers; + +expectError(() => { + type E = expect.Matchers; +}); diff --git a/packages/expect/package.json b/packages/expect/package.json index d0e899662727..d45ae07fa4fb 100644 --- a/packages/expect/package.json +++ b/packages/expect/package.json @@ -26,9 +26,11 @@ }, "devDependencies": { "@jest/test-utils": "^27.4.6", + "@tsd/typescript": "~4.1.5", "chalk": "^4.0.0", "fast-check": "^2.0.0", - "immutable": "^4.0.0" + "immutable": "^4.0.0", + "tsd-lite": "^0.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" diff --git a/packages/jest-matcher-utils/src/__tests__/Replaceable.test.ts b/packages/jest-matcher-utils/src/__tests__/Replaceable.test.ts index ef82ba3772ea..c5040d69b3ac 100644 --- a/packages/jest-matcher-utils/src/__tests__/Replaceable.test.ts +++ b/packages/jest-matcher-utils/src/__tests__/Replaceable.test.ts @@ -39,7 +39,6 @@ describe('Replaceable', () => { test('init with other type should throw error', () => { expect(() => { - //eslint-disable-next-line @typescript-eslint/no-unused-vars const replaceable = new Replaceable(new Date()); }).toThrow('Type date is not support in Replaceable!'); }); diff --git a/packages/jest-snapshot/src/__tests__/utils.test.ts b/packages/jest-snapshot/src/__tests__/utils.test.ts index 222ce9e758be..51a4f56d8880 100644 --- a/packages/jest-snapshot/src/__tests__/utils.test.ts +++ b/packages/jest-snapshot/src/__tests__/utils.test.ts @@ -178,8 +178,7 @@ test('escaping', () => { 'exports[`key`] = `"\'\\\\`;\n', ); - // @ts-expect-error - const exports = {}; // eslint-disable-line @typescript-eslint/no-unused-vars + const exports = {}; // eslint-disable-next-line no-eval const readData = eval('var exports = {}; ' + writtenData + ' exports'); expect(readData).toEqual({key: data}); diff --git a/packages/jest-types/package.json b/packages/jest-types/package.json index 9efb6c0e638b..27f81bf4628d 100644 --- a/packages/jest-types/package.json +++ b/packages/jest-types/package.json @@ -28,7 +28,7 @@ }, "devDependencies": { "@tsd/typescript": "~4.1.5", - "tsd-lite": "^0.5.0" + "tsd-lite": "^0.5.1" }, "publishConfig": { "access": "public" diff --git a/yarn.lock b/yarn.lock index a5849ae19f77..b5197b0744dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2803,7 +2803,7 @@ __metadata: "@types/node": "*" "@types/yargs": ^16.0.0 chalk: ^4.0.0 - tsd-lite: ^0.5.0 + tsd-lite: ^0.5.1 languageName: unknown linkType: soft @@ -9883,12 +9883,14 @@ __metadata: dependencies: "@jest/test-utils": ^27.4.6 "@jest/types": ^27.4.2 + "@tsd/typescript": ~4.1.5 chalk: ^4.0.0 fast-check: ^2.0.0 immutable: ^4.0.0 jest-get-type: ^27.4.0 jest-matcher-utils: ^27.4.6 jest-message-util: ^27.4.6 + tsd-lite: ^0.5.1 languageName: unknown linkType: soft @@ -20663,12 +20665,12 @@ react-native@0.64.0: languageName: node linkType: hard -"tsd-lite@npm:^0.5.0": - version: 0.5.0 - resolution: "tsd-lite@npm:0.5.0" +"tsd-lite@npm:^0.5.0, tsd-lite@npm:^0.5.1": + version: 0.5.1 + resolution: "tsd-lite@npm:0.5.1" peerDependencies: "@tsd/typescript": ^3.8.3 || ^4.0.7 - checksum: 6590ca24f2ac07e961ec3786a94269c26bfa93b09c3d397f5f3c3b09fedee515dbe96aa09de4c24ce3a42a3bbe47543f0a30aa06770b34b4a6eb8b61e92dce21 + checksum: 875cf890f3cc10c0974a4588568ee9e5202b047480cd261dbe1e7487fb25b56df6217b2a3e95b5cc1a88d27e0e1f13299b3048b908afe2da782369e381ad083c languageName: node linkType: hard