diff --git a/README.md b/README.md index 4d49883..306b714 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 @@ -90,20 +92,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: @@ -367,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 afc3a1d..fb5b166 100644 --- a/bases/create-react-app.json +++ b/bases/create-react-app.json @@ -1,11 +1,12 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Create React App", - + "_version": "2.0.0", "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..f130384 100644 --- a/bases/docusaurus.json +++ b/bases/docusaurus.json @@ -2,13 +2,15 @@ "$schema": "https://json.schemastore.org/tsconfig", "display": "Docusaurus v2", "docs": "https://v2.docusaurus.io/docs/typescript-support", + "_version": "2.0.0", "compilerOptions": { "allowJs": true, "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..6ec8b9f 100644 --- a/bases/ember.json +++ b/bases/ember.json @@ -2,15 +2,15 @@ "$schema": "https://json.schemastore.org/tsconfig", "display": "Ember", "docs": "https://docs.ember-cli-typescript.com", - "_version": "2.0.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 // `compilerOptions.baseUrl`, `compilerOptions.paths`, and `include` set. "compilerOptions": { "target": "ES2021", - "module": "ES2020", - "moduleResolution": "node", + "module": "esnext", + "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..3435bbd 100644 --- a/bases/esm.json +++ b/bases/esm.json @@ -1,9 +1,11 @@ { + "_deprecated": true, "$schema": "https://json.schemastore.org/tsconfig", "display": "ESM", "compilerOptions": { "module": "es2022", + "moduleResolution": "bundler", "verbatimModuleSyntax": true } diff --git a/bases/next.json b/bases/next.json index 0790745..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, @@ -11,7 +12,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..7c3d0ef 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": "18.1.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/node12.json b/bases/node12.json index eeaf944..401f5bf 100644 --- a/bases/node12.json +++ b/bases/node12.json @@ -1,16 +1,17 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Node 12", + "_version": "12.1.0", "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" } } diff --git a/bases/node14.json b/bases/node14.json index d1d7551..7216556 100644 --- a/bases/node14.json +++ b/bases/node14.json @@ -1,16 +1,17 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Node 14", + "_version": "14.1.0", "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..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"], @@ -11,6 +12,6 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" + "moduleResolution": "node16" } } diff --git a/bases/node17.json b/bases/node17.json index 3699ae2..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", @@ -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..9589794 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.2.0", "compilerOptions": { "lib": ["es2023"], @@ -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..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"], @@ -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..bb6ff56 100644 --- a/bases/nuxt.json +++ b/bases/nuxt.json @@ -1,11 +1,12 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Nuxt", - + "_version": "2.0.0", + "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..270e2fe 100644 --- a/bases/remix.json +++ b/bases/remix.json @@ -1,12 +1,15 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Remix", + "_version": "2.0.0", + "compilerOptions": { "lib": ["DOM", "DOM.Iterable", "ES2019"], "isolatedModules": true, "esModuleInterop": true, "jsx": "react-jsx", - "moduleResolution": "node", + "module": "esnext", + "moduleResolution": "bundler", "resolveJsonModule": true, "target": "ES2019", "strict": true, diff --git a/bases/svelte.json b/bases/svelte.json index e1fd117..7f7e6e0 100644 --- a/bases/svelte.json +++ b/bases/svelte.json @@ -1,10 +1,11 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Svelte", - "_version": "4.0.0", + "_version": "5.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" } 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", "")