diff --git a/.eslintrc.js b/.eslintrc.js index b46a4a031f9..1573d92d69a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,7 +21,7 @@ module.exports = defineConfig({ ], parser: '@typescript-eslint/parser', parserOptions: { - project: ['./tsconfig.lint.json'], + project: ['./tsconfig.json'], sourceType: 'module', warnOnUnsupportedTypeScriptVersion: false, }, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbfb49dbd9c..41899cdf7c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,10 +167,10 @@ jobs: - name: Check formatting run: pnpm prettier --check . - ts-check-scripts: + ts-check: runs-on: ubuntu-latest timeout-minutes: 10 - name: 'TS-Check Scripts: node-18, ubuntu-latest' + name: 'TS-Check: node-18, ubuntu-latest' steps: - name: Checkout uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 @@ -192,34 +192,7 @@ jobs: CYPRESS_INSTALL_BINARY: 0 - name: Check scripts - run: pnpm run ts-check:scripts - - ts-check-tests: - runs-on: ubuntu-latest - timeout-minutes: 10 - name: 'TS-Check Tests: node-18, ubuntu-latest' - steps: - - name: Checkout - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - fetch-depth: 0 - - - name: Install pnpm - uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4 - - - name: Set node version to 18 - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 - with: - node-version: 18 - cache: 'pnpm' - - - name: Install deps - run: pnpm install - env: - CYPRESS_INSTALL_BINARY: 0 - - - name: Check tests - run: pnpm run ts-check:tests + run: pnpm run ts-check codecov: runs-on: ubuntu-latest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b5d0da4ec2a..c5ae53b0f44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,8 +16,7 @@ This is a shorthand for running the following scripts in order: - `pnpm run build:code` - builds the code, both CommonJS and ESM versions - `pnpm run build:types` - builds the TypeScript type definitions - `pnpm run test:update-snapshots ` - runs all tests, and updates any snapshots if needed -- `pnpm run ts-check:scripts` - checks that there are no TypeScript errors in script files -- `pnpm run ts-check:tests` - checks that there are no TypeScript errors in test or script files +- `pnpm run ts-check` - checks that there are no TypeScript errors in any files ## Good to know diff --git a/docs/.vitepress/tsconfig.json b/docs/.vitepress/tsconfig.json deleted file mode 100644 index 75b15f9e2d4..00000000000 --- a/docs/.vitepress/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "ES2020", - "moduleResolution": "Node", - "resolveJsonModule": true - } -} diff --git a/package.json b/package.json index b7c74c7d415..5ac4907c8ff 100644 --- a/package.json +++ b/package.json @@ -53,16 +53,14 @@ }, "files": [ "CHANGELOG.md", - "CHANGELOG_old.md", "dist", - "locale", - "tsconfig.json" + "locale" ], "scripts": { "clean": "rimraf coverage .eslintcache dist docs/.vitepress/dist pnpm-lock.yaml node_modules", "build:clean": "rimraf dist", "build:code": "tsx ./scripts/bundle.ts", - "build:types": "tsc --emitDeclarationOnly --outDir dist/types", + "build:types": "tsc --project tsconfig.build.json", "build": "run-s build:clean build:code build:types", "generate": "run-s generate:locales generate:api-docs", "generate:api-docs": "tsx ./scripts/apidoc.ts", @@ -77,9 +75,7 @@ "docs:diff": "tsx ./scripts/diff.ts", "format": "prettier --cache --write .", "lint": "eslint --cache --cache-strategy content --report-unused-disable-directives .", - "ts-check": "run-s ts-check:scripts ts-check:tests", - "ts-check:scripts": "tsc --project tsconfig.check-scripts.json", - "ts-check:tests": "tsc --project tsconfig.check-tests.json", + "ts-check": "tsc", "test": "vitest", "test:update-snapshots": "vitest run -u", "coverage": "vitest run --coverage", diff --git a/test/scripts/apidoc/tsconfig.json b/test/scripts/apidoc/tsconfig.json deleted file mode 100644 index dafe3a14371..00000000000 --- a/test/scripts/apidoc/tsconfig.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "target": "ES5" - }, - "include": ["signature.example.ts", "module.example.ts"] -} diff --git a/test/scripts/apidoc/utils.ts b/test/scripts/apidoc/utils.ts index 2addfe651a5..095592c52ad 100644 --- a/test/scripts/apidoc/utils.ts +++ b/test/scripts/apidoc/utils.ts @@ -34,7 +34,6 @@ export function loadExampleMethods(): Record { return loadProjectModules( { entryPoints: ['test/scripts/apidoc/signature.example.ts'], - tsconfig: 'test/scripts/apidoc/tsconfig.json', }, true )['SignatureTest'][1]; @@ -47,7 +46,6 @@ export function loadExampleModules(): Record { const modules = loadProjectModules( { entryPoints: ['test/scripts/apidoc/module.example.ts'], - tsconfig: 'test/scripts/apidoc/tsconfig.json', }, true ); diff --git a/tsconfig.base.json b/tsconfig.base.json deleted file mode 100644 index 57660233ffc..00000000000 --- a/tsconfig.base.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "moduleResolution": "Node", - "module": "ESNext", - "noEmit": true, - "esModuleInterop": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "alwaysStrict": true, - // "strictNullChecks": true, - // "strictBindCallApply": true, - "strictFunctionTypes": true, - // "strictPropertyInitialization": true, - // "noImplicitAny": true, - // "noImplicitThis": true, - "useUnknownInCatchVariables": true - }, - "exclude": ["node_modules"] -} diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 00000000000..aa1bfb29830 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "target": "ES2019", + "noEmit": false, + "emitDeclarationOnly": true, + "rootDir": "src", + "outDir": "dist/types", + + // This negates what is set in the extended tsconfig.json + "noImplicitAny": true, + "skipLibCheck": false, + "allowSyntheticDefaultImports": false, + "resolveJsonModule": false + }, + "include": ["src"] +} diff --git a/tsconfig.check-scripts.json b/tsconfig.check-scripts.json deleted file mode 100644 index 5a6511a094f..00000000000 --- a/tsconfig.check-scripts.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "include": ["scripts/**/*.ts"] -} diff --git a/tsconfig.check-tests.json b/tsconfig.check-tests.json deleted file mode 100644 index 206022c4160..00000000000 --- a/tsconfig.check-tests.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "include": ["test/**/*.ts"] -} diff --git a/tsconfig.json b/tsconfig.json index d201dfd1ea2..19053aba1fb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,22 @@ { "compilerOptions": { - "target": "ES2019", - "moduleResolution": "Node", - "rootDir": "src", - "outDir": "dist", + "target": "ESNext", + "moduleResolution": "node", + "module": "ESNext", + "strict": true, + "noEmit": true, "declaration": true, - "esModuleInterop": true, - "allowJs": true, - "alwaysStrict": true, - "strictFunctionTypes": true, - "noImplicitAny": true, - "noImplicitThis": true, - "useUnknownInCatchVariables": true, "stripInternal": true, - "baseUrl": "." + + // We need to disable these for now, and need to tackle them in another PR + "strictNullChecks": false, + "strictBindCallApply": false, + "noImplicitAny": false, + + // These are configs specifically for !build and have to be reverted in the tsconfig.build.json + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "resolveJsonModule": true }, - "include": ["src/**/*"], - "exclude": ["node_modules"] + "exclude": ["node_modules", "dist", "locale"] } diff --git a/tsconfig.lint.json b/tsconfig.lint.json deleted file mode 100644 index e31e38827df..00000000000 --- a/tsconfig.lint.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "target": "ES2020", - "stripInternal": true, - "skipLibCheck": false, - "rootDir": "." - } -}