chore: make TypeScript strict in test folder. Simplify tsconfig (#10582)

This PR makes the "test" folder strict in typescript.

`pnpm build:test` before: Found 3275 errors in 174 files.
`pnpm build:test` after: Found 4912 errors in 268 files.

At some point we should bring that number to 0 and make it a requirement
in the CI. Currently `pnpm build:test` is not run anywhere in the CI.

Additionally, I took the opportunity to combine the duplicate
configurations from `tsconfig.json` and `tsconfig.typecheck.json` using
"extend".

declaration, declarationMap and sourceMap have been removed as they have
no reason to exist in noEmit.

The settings I left in `tsconfig.typecheck.json` are ones that I'm not
sure why they are there. Perhaps the file could be removed or at least
reduced further.
This commit is contained in:
Germán Jabloñski
2025-01-14 20:00:00 -03:00
committed by GitHub
parent 8ab05b0c22
commit a304dc4b01
3 changed files with 12 additions and 55 deletions

View File

@@ -1,9 +1,12 @@
{ {
"compilerOptions": { "compilerOptions": {
/* Strictness */
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noEmit": true, "noEmit": true,
"rootDir": ".", "rootDir": ".",
"declaration": true,
"declarationMap": true,
"target": "ES2022", "target": "ES2022",
"module": "NodeNext", "module": "NodeNext",
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",
@@ -12,20 +15,10 @@
"esModuleInterop": true, "esModuleInterop": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"jsx": "preserve", "jsx": "preserve",
"lib": [ "lib": ["DOM", "DOM.Iterable", "ES2022"],
"DOM",
"DOM.Iterable",
"ES2022"
],
"resolveJsonModule": true, "resolveJsonModule": true,
"skipLibCheck": true, "skipLibCheck": true,
"sourceMap": true, "types": ["jest", "node", "@types/jest"],
"strict": false,
"types": [
"jest",
"node",
"@types/jest"
],
"incremental": true, "incremental": true,
"isolatedModules": true, "isolatedModules": true,
"plugins": [ "plugins": [
@@ -35,9 +28,7 @@
], ],
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@payload-config": [ "@payload-config": ["./_community/config.ts"]
"./_community/config.ts"
]
} }
}, },
"exclude": [ "exclude": [
@@ -48,12 +39,6 @@
"dist/**/*.js", "dist/**/*.js",
"**/dist/**/*.js" "**/dist/**/*.js"
], ],
"include": [ "include": ["./**/*.ts", "./**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts", "setup.js"],
"./**/*.ts",
"./**/*.tsx",
"next-env.d.ts",
".next/types/**/*.ts",
"setup.js"
],
"references": [] "references": []
} }

View File

@@ -1,30 +1,7 @@
{ {
"extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"noEmit": true, "incremental": false
"rootDir": ".",
"baseUrl": ".",
"target": "esnext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"allowJs": true,
"checkJs": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"resolveJsonModule": true,
"skipLibCheck": true,
"types": ["jest", "node", "@types/jest"],
// "incremental": true,
"isolatedModules": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@payload-config": ["./_community/config.ts"]
}
}, },
"exclude": ["dist", "build", "temp", "node_modules"], "exclude": ["dist", "build", "temp", "node_modules"],
"include": [ "include": [

View File

@@ -1,8 +1,3 @@
{ {
"extends": "../tsconfig.json", "extends": "../tsconfig.json"
"compilerOptions": {
"strict": true,
"exactOptionalPropertyTypes": true,
"noUncheckedIndexedAccess": true
}
} }