From 9c8c659158c294ac7e2433850968f7a5ee3fd4c9 Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Sat, 25 May 2024 12:44:29 +0200 Subject: [PATCH] Enable `noUnusedLocals` for type checking test files --- .../esm-interpolate/esm-interpolate.test.tsx | 1 - test/unit/esm-interpolate/fixture.tsx | 1 - test/unit/link-warnings.test.tsx | 1 - test/unit/next-dynamic.test.tsx | 1 - tsconfig.base.json | 23 ---------------- tsconfig.json | 26 ++++++++++++++++--- 6 files changed, 23 insertions(+), 30 deletions(-) delete mode 100644 tsconfig.base.json diff --git a/test/unit/esm-interpolate/esm-interpolate.test.tsx b/test/unit/esm-interpolate/esm-interpolate.test.tsx index c6ffb8137582f..3be0c8148b968 100644 --- a/test/unit/esm-interpolate/esm-interpolate.test.tsx +++ b/test/unit/esm-interpolate/esm-interpolate.test.tsx @@ -1,4 +1,3 @@ -import React from 'react' import { renderToString } from 'react-dom/server' import * as nextRouter from 'next/router' diff --git a/test/unit/esm-interpolate/fixture.tsx b/test/unit/esm-interpolate/fixture.tsx index 90485c11e409d..af413aa5b5a0e 100644 --- a/test/unit/esm-interpolate/fixture.tsx +++ b/test/unit/esm-interpolate/fixture.tsx @@ -1,4 +1,3 @@ -import React from 'react' import { useRouter } from 'next/router' export const Foo = () => { diff --git a/test/unit/link-warnings.test.tsx b/test/unit/link-warnings.test.tsx index d102876f6a361..1ed744fdf5f82 100644 --- a/test/unit/link-warnings.test.tsx +++ b/test/unit/link-warnings.test.tsx @@ -3,7 +3,6 @@ */ import { act, render } from '@testing-library/react' import Link from 'next/link' -import React from 'react' describe('', () => { let spy diff --git a/test/unit/next-dynamic.test.tsx b/test/unit/next-dynamic.test.tsx index a46004030e436..1375026063393 100644 --- a/test/unit/next-dynamic.test.tsx +++ b/test/unit/next-dynamic.test.tsx @@ -1,7 +1,6 @@ /** * @jest-environment jsdom */ -import React from 'react' import { act, render } from '@testing-library/react' import dynamic from 'next/dynamic' diff --git a/tsconfig.base.json b/tsconfig.base.json deleted file mode 100644 index ba074f2baea90..0000000000000 --- a/tsconfig.base.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "strict": false, - "noEmit": true, - "allowJs": true, - "resolveJsonModule": true, - "jsx": "react-jsx", - "module": "esnext", - "target": "ESNext", - "esModuleInterop": true, - "moduleResolution": "node", - "types": ["react", "jest", "node", "trusted-types", "jest-extended"], - "paths": { - "development-sandbox": ["./test/lib/development-sandbox"], - "next-test-utils": ["./test/lib/next-test-utils"], - "amp-test-utils": ["./test/lib/amp-test-utils"], - "next-webdriver": ["./test/lib/next-webdriver"], - "e2e-utils": ["./test/lib/e2e-utils"], - "test-data-service/*": ["./test/lib/test-data-service/*"], - "test-log": ["./test/lib/test-log"] - } - } -} diff --git a/tsconfig.json b/tsconfig.json index f35f67680c5c2..d7dc15ddb9469 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,25 @@ { - "extends": "./tsconfig.base.json", - "include": ["test/**/*.test.ts", "test/**/*.test.tsx"], - "exclude": ["node_modules"] + "compilerOptions": { + "allowJs": true, + "esModuleInterop": true, + "jsx": "react-jsx", + "module": "esnext", + "moduleResolution": "node", + "noEmit": true, + "noUnusedLocals": true, + "paths": { + "amp-test-utils": ["./test/lib/amp-test-utils"], + "development-sandbox": ["./test/lib/development-sandbox"], + "e2e-utils": ["./test/lib/e2e-utils"], + "next-test-utils": ["./test/lib/next-test-utils"], + "next-webdriver": ["./test/lib/next-webdriver"], + "test-data-service/*": ["./test/lib/test-data-service/*"], + "test-log": ["./test/lib/test-log"] + }, + "resolveJsonModule": true, + "strict": false, + "target": "ESNext", + "types": ["react", "jest", "node", "trusted-types", "jest-extended"] + }, + "include": ["test/**/*.test.ts", "test/**/*.test.tsx"] }