diff --git a/.changeset/tsserver-empty-root-tsconfig.md b/.changeset/tsserver-empty-root-tsconfig.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/tsserver-empty-root-tsconfig.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.typedoc/tsconfig.json b/.typedoc/tsconfig.json index 1f99426b1b6..3bc2abafb08 100644 --- a/.typedoc/tsconfig.json +++ b/.typedoc/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../tsconfig.json", + "extends": "../tsconfig.base.json", "compilerOptions": { "allowJs": true, "noEmit": true, diff --git a/packages/electron/tsconfig.base.json b/packages/electron/tsconfig.base.json new file mode 100644 index 00000000000..ee52e33f76a --- /dev/null +++ b/packages/electron/tsconfig.base.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2019", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "preserve", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "react-jsx" + } +} diff --git a/packages/electron/tsconfig.json b/packages/electron/tsconfig.json index e0589f90356..455bdc92f74 100644 --- a/packages/electron/tsconfig.json +++ b/packages/electron/tsconfig.json @@ -1,19 +1,6 @@ { + "extends": "./tsconfig.base.json", "compilerOptions": { - "target": "ES2019", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "preserve", - "moduleResolution": "bundler", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "react-jsx", "declaration": true, "declarationDir": "dist/types", "declarationMap": true, @@ -21,5 +8,6 @@ "rootDir": "./src" }, "include": ["src"], - "exclude": ["src/**/__tests__/**"] + "exclude": ["src/**/__tests__/**"], + "references": [{ "path": "./tsconfig.test.json" }] } diff --git a/packages/electron/tsconfig.test.json b/packages/electron/tsconfig.test.json new file mode 100644 index 00000000000..4f9dcdd38bd --- /dev/null +++ b/packages/electron/tsconfig.test.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + // composite so tsserver can load this via tsconfig.json references (tsc --noEmit requires it). + "composite": true, + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "node_modules/.cache/tsconfig-test", + "tsBuildInfoFile": "node_modules/.cache/tsconfig-test.tsbuildinfo" + }, + "include": ["src/**/__tests__/**/*.ts", "src/**/__tests__/**/*.tsx"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/testing/tsconfig.json b/packages/testing/tsconfig.json index bba2e4e248c..952204a1509 100644 --- a/packages/testing/tsconfig.json +++ b/packages/testing/tsconfig.json @@ -16,12 +16,6 @@ "declarationDir": "dist/types", "rootDir": "./src" }, - "include": [ - "src/index.ts", - "src/playwright/index.ts", - "src/playwright/unstable/index.ts", - "src/cypress/index.ts", - "src/global.d.ts" - ], + "include": ["src"], "exclude": ["node_modules"] } diff --git a/packages/ui/tsconfig.base.json b/packages/ui/tsconfig.base.json new file mode 100644 index 00000000000..acdf124e912 --- /dev/null +++ b/packages/ui/tsconfig.base.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "es2022", + "strict": true, + "skipLibCheck": true, + "resolveJsonModule": true, + "noUnusedLocals": true, + "moduleResolution": "bundler", + "moduleDetection": "force", + "module": "preserve", + "lib": ["ES2023", "DOM", "WebWorker"], + "jsx": "react-jsx", + "jsxImportSource": "@emotion/react", + "isolatedModules": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true, + "allowJs": true, + "verbatimModuleSyntax": true, + "paths": { + // Test-only imports; vitest.config.mts aliases these to clerk-js at runtime. + "@/core/*": ["../clerk-js/src/core/*"], + "@/*": ["./src/*"], + // Adding this to avoid changes in the ui files + // in order to make git merges easier + // TODO: @nikos remove after v6 release + "@/ui*": ["./src/*"] + } + } +} diff --git a/packages/ui/tsconfig.json b/packages/ui/tsconfig.json index f6bc61c6e53..05dc93a5b78 100644 --- a/packages/ui/tsconfig.json +++ b/packages/ui/tsconfig.json @@ -1,35 +1,11 @@ { + "extends": "./tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "verbatimModuleSyntax": true, - "target": "es2022", - "strict": true, - "skipLibCheck": true, - "resolveJsonModule": true, "preserveWatchOutput": true, "outDir": "dist", - "noUnusedLocals": true, - "moduleResolution": "bundler", - "moduleDetection": "force", - "module": "preserve", - "lib": ["ES2023", "DOM", "WebWorker"], - "jsx": "react-jsx", - "jsxImportSource": "@emotion/react", - "isolatedModules": true, - "forceConsistentCasingInFileNames": true, - "esModuleInterop": true, "declaration": true, "declarationMap": true, - "allowJs": true, - "paths": { - // Test-only imports; vitest.config.mts aliases these to clerk-js at runtime. - "@/core/*": ["../clerk-js/src/core/*"], - "@/*": ["./src/*"], - // Adding this to avoid changes in the ui files - // in order to make git merges easier - // TODO: @nikos remove after v6 release - "@/ui*": ["./src/*"] - }, "types": ["@rspack/core/module"] }, "exclude": [ @@ -41,5 +17,6 @@ "**/__tests__/**", "./src/test/**" ], - "include": ["src", "src/global.d.ts"] + "include": ["src", "src/global.d.ts"], + "references": [{ "path": "./tsconfig.test.json" }] } diff --git a/packages/ui/tsconfig.test.json b/packages/ui/tsconfig.test.json new file mode 100644 index 00000000000..2f48da331b8 --- /dev/null +++ b/packages/ui/tsconfig.test.json @@ -0,0 +1,22 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + // composite so tsserver can load this via tsconfig.json references (tsc --noEmit requires it). + "composite": true, + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "node_modules/.cache/tsconfig-test", + "tsBuildInfoFile": "node_modules/.cache/tsconfig-test.tsbuildinfo" + }, + "include": [ + "src/**/*.test.ts", + "src/**/*.test.tsx", + "src/**/*.spec.ts", + "src/**/*.spec.tsx", + "src/**/__tests__/**/*.ts", + "src/**/__tests__/**/*.tsx", + "src/test/**/*.ts", + "src/test/**/*.tsx" + ], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/upgrade/tsconfig.json b/packages/upgrade/tsconfig.json index da32e81b638..930d3a9c766 100644 --- a/packages/upgrade/tsconfig.json +++ b/packages/upgrade/tsconfig.json @@ -1,6 +1,7 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "allowJs": true - } + }, + "include": ["src"] } diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index c51dedc934e..bb7e901acdf 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -1,7 +1,9 @@ { - "extends": "../tsconfig.json", + "extends": "../tsconfig.base.json", "compilerOptions": { "allowJs": true, "noEmit": true - } + }, + "include": ["./**/*.ts", "./**/*.mjs", "./**/*.js"], + "exclude": ["node_modules", "dist"] } diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 00000000000..444fe7d6976 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "alwaysStrict": false, + "declaration": true, + "declarationMap": false, + "downlevelIteration": true, + "forceConsistentCasingInFileNames": true, + "importHelpers": true, + "lib": ["es6"], + "module": "commonjs", + "moduleResolution": "node", + "noEmitHelpers": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "pretty": true, + "skipLibCheck": true, + "sourceMap": false, + "strict": true, + "target": "ES2019", + "noErrorTruncation": true + } +} diff --git a/tsconfig.json b/tsconfig.json index e5339d09383..244bb5eacce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,25 +1,7 @@ { + "extends": "./tsconfig.base.json", "compileOnSave": false, - "compilerOptions": { - "alwaysStrict": false, - "declaration": true, - "declarationMap": false, - "downlevelIteration": true, - "forceConsistentCasingInFileNames": true, - "importHelpers": true, - "lib": ["es6"], - "module": "commonjs", - "moduleResolution": "node", - "noEmitHelpers": true, - "noFallthroughCasesInSwitch": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "pretty": true, - "sourceMap": false, - "strict": true, - "target": "ES2019", - "noErrorTruncation": true - }, - "exclude": ["node_modules", "dist", "**/dist/**", "packages/*/dist/**"] + // Empty so tsserver does not load the whole monorepo as one program. + "files": [], + "include": [] } diff --git a/tsconfig.typedoc.json b/tsconfig.typedoc.json index 71338f87dc4..deb650c5b13 100644 --- a/tsconfig.typedoc.json +++ b/tsconfig.typedoc.json @@ -1,5 +1,5 @@ { - "extends": "./tsconfig.json", + "extends": "./tsconfig.base.json", "compilerOptions": { "skipLibCheck": true, "noImplicitReturns": false,