From a8c454f4a1caf4511b1e58a6b71ef4529264f628 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 21 Jun 2023 16:20:48 -0700 Subject: [PATCH 1/8] Update module and moduleResolution to stop using node and invalid combinations --- bases/create-react-app.json | 2 +- bases/docusaurus.json | 3 ++- bases/ember.json | 2 +- bases/esm.json | 1 + bases/next.json | 2 +- bases/node-lts.json | 8 ++++---- bases/node14.json | 4 ++-- bases/node16.json | 2 +- bases/node17.json | 2 +- bases/node18.json | 2 +- bases/node19.json | 2 +- bases/node20.json | 2 +- bases/nuxt.json | 2 +- bases/remix.json | 2 +- bases/svelte.json | 3 ++- scripts/generate-lts.ts | 13 ++++--------- 16 files changed, 25 insertions(+), 27 deletions(-) diff --git a/bases/create-react-app.json b/bases/create-react-app.json index afc3a1d..073d0fd 100644 --- a/bases/create-react-app.json +++ b/bases/create-react-app.json @@ -6,6 +6,7 @@ "compilerOptions": { "lib": ["dom", "dom.iterable", "esnext"], "module": "esnext", + "moduleResolution": "bundler", "target": "es2015", "allowJs": true, @@ -14,7 +15,6 @@ "forceConsistentCasingInFileNames": true, "isolatedModules": true, "jsx": "react-jsx", - "moduleResolution": "node", "noEmit": true, "noFallthroughCasesInSwitch": true, "resolveJsonModule": true, diff --git a/bases/docusaurus.json b/bases/docusaurus.json index cfa406f..c4fb27a 100644 --- a/bases/docusaurus.json +++ b/bases/docusaurus.json @@ -8,7 +8,8 @@ "esModuleInterop": true, "jsx": "react", "lib": ["DOM"], - "moduleResolution": "Node16", + "module": "esnext", + "moduleResolution": "bundler", "noEmit": true, "types": ["node", "@docusaurus/module-type-aliases", "@docusaurus/theme-classic"], "baseUrl": ".", diff --git a/bases/ember.json b/bases/ember.json index 4caec44..7248995 100644 --- a/bases/ember.json +++ b/bases/ember.json @@ -10,7 +10,7 @@ "compilerOptions": { "target": "ES2021", "module": "ES2020", - "moduleResolution": "node", + "moduleResolution": "bundler", // Trying to check Ember apps and addons with `allowJs: true` is a recipe // for many unresolveable type errors, because with *considerable* extra diff --git a/bases/esm.json b/bases/esm.json index d65f3d2..242b5df 100644 --- a/bases/esm.json +++ b/bases/esm.json @@ -4,6 +4,7 @@ "compilerOptions": { "module": "es2022", + "moduleResolution": "bundler", "verbatimModuleSyntax": true } diff --git a/bases/next.json b/bases/next.json index 0790745..303efe1 100644 --- a/bases/next.json +++ b/bases/next.json @@ -11,7 +11,7 @@ "noEmit": true, "esModuleInterop": true, "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", diff --git a/bases/node-lts.json b/bases/node-lts.json index 7ac73a4..f8ed894 100644 --- a/bases/node-lts.json +++ b/bases/node-lts.json @@ -3,10 +3,10 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Node LTS", - "_version": "18.12.1", + "_version": "2.0.0", "compilerOptions": { "lib": [ - "es2022" + "es2023" ], "module": "Node16", "target": "es2022", @@ -14,6 +14,6 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" + "moduleResolution": "node16" } -} +} \ No newline at end of file diff --git a/bases/node14.json b/bases/node14.json index d1d7551..6be2e68 100644 --- a/bases/node14.json +++ b/bases/node14.json @@ -4,13 +4,13 @@ "compilerOptions": { "lib": ["es2020"], - "module": "commonjs", + "module": "node16", "target": "es2020", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" + "moduleResolution": "node16" } } diff --git a/bases/node16.json b/bases/node16.json index 2671912..edcefe6 100644 --- a/bases/node16.json +++ b/bases/node16.json @@ -11,6 +11,6 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" + "moduleResolution": "node16" } } diff --git a/bases/node17.json b/bases/node17.json index 3699ae2..b972d93 100644 --- a/bases/node17.json +++ b/bases/node17.json @@ -12,6 +12,6 @@ "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "useDefineForClassFields": true, - "moduleResolution": "node" + "moduleResolution": "node16" } } diff --git a/bases/node18.json b/bases/node18.json index a97e800..3075345 100644 --- a/bases/node18.json +++ b/bases/node18.json @@ -13,6 +13,6 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" + "moduleResolution": "node16" } } diff --git a/bases/node19.json b/bases/node19.json index 1910361..fb3f258 100644 --- a/bases/node19.json +++ b/bases/node19.json @@ -13,6 +13,6 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" + "moduleResolution": "node16" } } diff --git a/bases/node20.json b/bases/node20.json index bad605d..6592802 100644 --- a/bases/node20.json +++ b/bases/node20.json @@ -11,6 +11,6 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" + "moduleResolution": "node16" } } diff --git a/bases/nuxt.json b/bases/nuxt.json index 252a9da..c15006b 100644 --- a/bases/nuxt.json +++ b/bases/nuxt.json @@ -5,7 +5,7 @@ "compilerOptions": { "target": "ES2018", "module": "ESNext", - "moduleResolution": "Node", + "moduleResolution": "bundler", "lib": [ "ESNext", "ESNext.AsyncIterable", diff --git a/bases/remix.json b/bases/remix.json index b57efe1..78c7945 100644 --- a/bases/remix.json +++ b/bases/remix.json @@ -6,7 +6,7 @@ "isolatedModules": true, "esModuleInterop": true, "jsx": "react-jsx", - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, "target": "ES2019", "strict": true, diff --git a/bases/svelte.json b/bases/svelte.json index e1fd117..8543993 100644 --- a/bases/svelte.json +++ b/bases/svelte.json @@ -4,7 +4,8 @@ "_version": "4.0.0", "compilerOptions": { - "moduleResolution": "node", + "module": "esnext", + "moduleResolution": "bundler", "target": "es2017", /** Svelte Preprocess cannot figure out whether you have a value or a type, so tell TypeScript diff --git a/scripts/generate-lts.ts b/scripts/generate-lts.ts index 10ad743..d492c31 100644 --- a/scripts/generate-lts.ts +++ b/scripts/generate-lts.ts @@ -1,6 +1,9 @@ // deno run --allow-read --allow-write scripts/generate-lts.ts // +import { gt } from "https://deno.land/std@0.192.0/semver/gt.ts"; +import { parse } from "https://deno.land/std@0.192.0/semver/parse.ts"; + interface NodeReleaseMetadata { version: string; date: string; @@ -19,20 +22,12 @@ type Tsconfig = Record; const versionRegex = /v(\d+)\.(\d+)\.(\d+)/; -function calcVersion(x: string) { - const match = x.match(versionRegex); - if (!match) { - throw new Error(`version regex failed to match version string '${x}'`); - } - return +match[1] * 1000000 + +match[2] * 1000 + +match[3]; -} - const releasesResponse = await fetch("https://nodejs.org/download/release/index.json"); const releasesJson = (await releasesResponse.json()) as NodeReleaseMetadata[]; const lts = releasesJson .filter((r) => r.lts) .reduce( - (prevValue, currValue) => (calcVersion(currValue.version) > calcVersion(prevValue.version) ? currValue : prevValue), + (prevValue, currValue) => (gt(parse(currValue.version), parse(prevValue.version)) ? currValue : prevValue), { version: "v0.0.0" } From 449f1c9a169be2e3e588fa8fb68d73f984e42c29 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 21 Jun 2023 16:25:06 -0700 Subject: [PATCH 2/8] bundler needs nodenext --- bases/ember.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bases/ember.json b/bases/ember.json index 7248995..6e065de 100644 --- a/bases/ember.json +++ b/bases/ember.json @@ -9,7 +9,7 @@ // `compilerOptions.baseUrl`, `compilerOptions.paths`, and `include` set. "compilerOptions": { "target": "ES2021", - "module": "ES2020", + "module": "esnext", "moduleResolution": "bundler", // Trying to check Ember apps and addons with `allowJs: true` is a recipe From b1eae8cdf0959509bdcfa19394b64e9c83c325dc Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 21 Jun 2023 16:30:03 -0700 Subject: [PATCH 3/8] Update node12 --- bases/node12.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bases/node12.json b/bases/node12.json index eeaf944..0b1a9a6 100644 --- a/bases/node12.json +++ b/bases/node12.json @@ -4,13 +4,13 @@ "compilerOptions": { "lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"], - "module": "commonjs", + "module": "node16", "target": "es2019", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" + "moduleResolution": "node16" } } From 700981cefc8888edf8353e8ff0832cdc4db8200b Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 21 Jun 2023 16:31:31 -0700 Subject: [PATCH 4/8] bundler needs esnext --- bases/remix.json | 1 + 1 file changed, 1 insertion(+) diff --git a/bases/remix.json b/bases/remix.json index 78c7945..caaa64c 100644 --- a/bases/remix.json +++ b/bases/remix.json @@ -6,6 +6,7 @@ "isolatedModules": true, "esModuleInterop": true, "jsx": "react-jsx", + "module": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "target": "ES2019", From 7f15ea06f499cc16a5a3bbca60a108084237adef Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 21 Jun 2023 16:34:25 -0700 Subject: [PATCH 5/8] Delist esm.json --- README.md | 14 -------------- scripts/update-markdown-readme.ts | 1 + 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/README.md b/README.md index 4d49883..4f94f2f 100644 --- a/README.md +++ b/README.md @@ -90,20 +90,6 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/ember/tsconfig.json" ``` -### ESM tsconfig.json - -Install: - -```sh -npm install --save-dev @tsconfig/esm -yarn add --dev @tsconfig/esm -``` - -Add to your `tsconfig.json`: - -```json -"extends": "@tsconfig/esm/tsconfig.json" -``` ### Next.js tsconfig.json Install: diff --git a/scripts/update-markdown-readme.ts b/scripts/update-markdown-readme.ts index d26f6c8..0ce1eac 100644 --- a/scripts/update-markdown-readme.ts +++ b/scripts/update-markdown-readme.ts @@ -15,6 +15,7 @@ for await (const tsconfigEntry of Deno.readDir("bases")) { const sortedPaths = paths.sort((l, r) => l.localeCompare(r)).filter(r => !r.includes("recommended")) const basePaths = ["recommended.json", ...sortedPaths] for (const base of basePaths) { + if (base === "esm.json") continue const tsconfigFilePath = path.join("bases", base) const name = path.basename(base).replace(".json", "") From 7301ec5544e2d0cdb3177ec41631f86ffbb2e2e5 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Thu, 22 Jun 2023 20:49:20 +0100 Subject: [PATCH 6/8] Bump some versions --- README.md | 2 ++ bases/ember.json | 2 +- bases/esm.json | 1 + bases/node12.json | 1 + bases/node14.json | 1 + bases/node16.json | 1 + bases/node17.json | 2 +- bases/node18.json | 2 +- bases/node19.json | 2 +- bases/svelte.json | 2 +- 10 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4f94f2f..95c1cf9 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ Hosts TSConfigs for you to extend in your apps, tuned to a particular runtime environment. Owned and improved by the community. Basically Definitely Typed for TSConfigs. +We target the latest versions stable version of TypeScript, note that because we want to be consistent with the versioning the target runtime we can't always do semver releases. + ### Available TSConfigs diff --git a/bases/ember.json b/bases/ember.json index 6e065de..c74bc85 100644 --- a/bases/ember.json +++ b/bases/ember.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/tsconfig", "display": "Ember", "docs": "https://docs.ember-cli-typescript.com", - "_version": "2.0.0", + "_version": "2.1.0", // This is the base config used by Ember apps and addons. When actually used // via Ember CLI (e.g. ember-cli-typescript's blueprint), it additionally has diff --git a/bases/esm.json b/bases/esm.json index 242b5df..3435bbd 100644 --- a/bases/esm.json +++ b/bases/esm.json @@ -1,4 +1,5 @@ { + "_deprecated": true, "$schema": "https://json.schemastore.org/tsconfig", "display": "ESM", diff --git a/bases/node12.json b/bases/node12.json index 0b1a9a6..401f5bf 100644 --- a/bases/node12.json +++ b/bases/node12.json @@ -1,6 +1,7 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Node 12", + "_version": "12.1.0", "compilerOptions": { "lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"], diff --git a/bases/node14.json b/bases/node14.json index 6be2e68..7216556 100644 --- a/bases/node14.json +++ b/bases/node14.json @@ -1,6 +1,7 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Node 14", + "_version": "14.1.0", "compilerOptions": { "lib": ["es2020"], diff --git a/bases/node16.json b/bases/node16.json index edcefe6..5bd9f95 100644 --- a/bases/node16.json +++ b/bases/node16.json @@ -1,6 +1,7 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Node 16", + "_version": "16.1.0", "compilerOptions": { "lib": ["es2021"], diff --git a/bases/node17.json b/bases/node17.json index b972d93..80a0259 100644 --- a/bases/node17.json +++ b/bases/node17.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Node 17", - + "_version": "17.1.0", "compilerOptions": { "lib": ["es2022"], "module": "Node16", diff --git a/bases/node18.json b/bases/node18.json index 3075345..6c784d8 100644 --- a/bases/node18.json +++ b/bases/node18.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/tsconfig", "display": "Node 18", - "_version": "2.0.0", + "_version": "18.1.0", "compilerOptions": { "lib": ["es2023"], diff --git a/bases/node19.json b/bases/node19.json index fb3f258..1c5fd9c 100644 --- a/bases/node19.json +++ b/bases/node19.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/tsconfig", "display": "Node 19", - "_version": "2.0.0", + "_version": "19.1.0", "compilerOptions": { "lib": ["es2023"], diff --git a/bases/svelte.json b/bases/svelte.json index 8543993..7f7e6e0 100644 --- a/bases/svelte.json +++ b/bases/svelte.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Svelte", - "_version": "4.0.0", + "_version": "5.0.0", "compilerOptions": { "module": "esnext", From 4fd7c968e72da3b78e11e85fb78ea02e47b2c880 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 27 Jun 2023 08:46:58 -0600 Subject: [PATCH 7/8] Bump `@tsconfig/ember` version to 3.0.0 --- bases/ember.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bases/ember.json b/bases/ember.json index c74bc85..6ec8b9f 100644 --- a/bases/ember.json +++ b/bases/ember.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/tsconfig", "display": "Ember", "docs": "https://docs.ember-cli-typescript.com", - "_version": "2.1.0", + "_version": "3.0.0", // This is the base config used by Ember apps and addons. When actually used // via Ember CLI (e.g. ember-cli-typescript's blueprint), it additionally has From f2fd2b6b919ddb3448c1fd8acac9e81a0c7b175e Mon Sep 17 00:00:00 2001 From: orta Date: Tue, 27 Jun 2023 18:19:41 +0100 Subject: [PATCH 8/8] Major semver to all of them --- README.md | 4 ++++ bases/create-react-app.json | 2 +- bases/docusaurus.json | 1 + bases/next.json | 3 ++- bases/node-lts.json | 2 +- bases/node18.json | 2 +- bases/nuxt.json | 3 ++- bases/remix.json | 2 ++ 8 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 95c1cf9..306b714 100644 --- a/README.md +++ b/README.md @@ -355,6 +355,10 @@ to start from a Node 18 + Strictest base config, you can install both You can see the result of the combined configs via `tsc --showConfig`. +### What about `@tsconfig/esm`? + +We deprecated it in favour of setting [module/moduleResolution](https://github.com/tsconfig/bases/pull/197) to node/bundler. + ### Contributing ```sh diff --git a/bases/create-react-app.json b/bases/create-react-app.json index 073d0fd..fb5b166 100644 --- a/bases/create-react-app.json +++ b/bases/create-react-app.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Create React App", - + "_version": "2.0.0", "compilerOptions": { "lib": ["dom", "dom.iterable", "esnext"], diff --git a/bases/docusaurus.json b/bases/docusaurus.json index c4fb27a..f130384 100644 --- a/bases/docusaurus.json +++ b/bases/docusaurus.json @@ -2,6 +2,7 @@ "$schema": "https://json.schemastore.org/tsconfig", "display": "Docusaurus v2", "docs": "https://v2.docusaurus.io/docs/typescript-support", + "_version": "2.0.0", "compilerOptions": { "allowJs": true, diff --git a/bases/next.json b/bases/next.json index 303efe1..2baab07 100644 --- a/bases/next.json +++ b/bases/next.json @@ -1,8 +1,9 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Next.js", + "_version": "2.0.0", + "compilerOptions": { - "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, diff --git a/bases/node-lts.json b/bases/node-lts.json index f8ed894..7c3d0ef 100644 --- a/bases/node-lts.json +++ b/bases/node-lts.json @@ -3,7 +3,7 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Node LTS", - "_version": "2.0.0", + "_version": "18.1.0", "compilerOptions": { "lib": [ "es2023" diff --git a/bases/node18.json b/bases/node18.json index 6c784d8..9589794 100644 --- a/bases/node18.json +++ b/bases/node18.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/tsconfig", "display": "Node 18", - "_version": "18.1.0", + "_version": "18.2.0", "compilerOptions": { "lib": ["es2023"], diff --git a/bases/nuxt.json b/bases/nuxt.json index c15006b..bb6ff56 100644 --- a/bases/nuxt.json +++ b/bases/nuxt.json @@ -1,7 +1,8 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Nuxt", - + "_version": "2.0.0", + "compilerOptions": { "target": "ES2018", "module": "ESNext", diff --git a/bases/remix.json b/bases/remix.json index caaa64c..270e2fe 100644 --- a/bases/remix.json +++ b/bases/remix.json @@ -1,6 +1,8 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Remix", + "_version": "2.0.0", + "compilerOptions": { "lib": ["DOM", "DOM.Iterable", "ES2019"], "isolatedModules": true,