From 465b3a7970c1d3e59f7aa99d68be2c8bb50547ea Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Thu, 28 Apr 2022 08:42:55 -0700 Subject: [PATCH] Update example tsconfig (#3107) --- examples/basics/tsconfig.json | 12 +++++++++++- examples/blog-multiple-authors/tsconfig.json | 12 +++++++++++- examples/blog/tsconfig.json | 12 +++++++++++- examples/docs/tsconfig.json | 17 ++++++++++++----- examples/env-vars/tsconfig.json | 11 ++++++++++- examples/framework-alpine/tsconfig.json | 12 +++++++++++- examples/framework-lit/tsconfig.json | 12 +++++++++++- examples/framework-multiple/tsconfig.json | 12 +++++++++++- examples/framework-preact/tsconfig.json | 15 ++++++++++++++- examples/framework-react/package.json | 2 ++ examples/framework-react/tsconfig.json | 12 +++++++++++- examples/framework-solid/tsconfig.json | 15 ++++++++++++++- examples/framework-svelte/tsconfig.json | 12 +++++++++++- examples/framework-vue/tsconfig.json | 12 +++++++++++- examples/integrations-playground/tsconfig.json | 12 +++++++++++- examples/minimal/tsconfig.json | 12 +++++++++++- examples/non-html-pages/tsconfig.json | 12 +++++++++++- examples/portfolio/tsconfig.json | 12 +++++++++++- examples/ssr/tsconfig.json | 12 +++++++++--- examples/starter/tsconfig.json | 12 +++++++++++- examples/subpath/tsconfig.json | 12 +++++++++++- examples/with-markdown-plugins/tsconfig.json | 12 +++++++++++- examples/with-markdown-shiki/tsconfig.json | 12 +++++++++++- examples/with-markdown/tsconfig.json | 12 +++++++++++- examples/with-nanostores/tsconfig.json | 12 +++++++++++- examples/with-tailwindcss/tsconfig.json | 12 +++++++++++- examples/with-vite-plugin-pwa/tsconfig.json | 14 +++++++++++++- pnpm-lock.yaml | 18 ++++++++++++++++++ 28 files changed, 312 insertions(+), 32 deletions(-) diff --git a/examples/basics/tsconfig.json b/examples/basics/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/basics/tsconfig.json +++ b/examples/basics/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/blog-multiple-authors/tsconfig.json b/examples/blog-multiple-authors/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/blog-multiple-authors/tsconfig.json +++ b/examples/blog-multiple-authors/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/blog/tsconfig.json b/examples/blog/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/blog/tsconfig.json +++ b/examples/blog/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/docs/tsconfig.json b/examples/docs/tsconfig.json index cb92ff9ff..7ac81809a 100644 --- a/examples/docs/tsconfig.json +++ b/examples/docs/tsconfig.json @@ -1,8 +1,15 @@ { "compilerOptions": { - "target": "es2020", - "module": "esnext", - "jsx": "preserve" - }, - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] + } } diff --git a/examples/env-vars/tsconfig.json b/examples/env-vars/tsconfig.json index c9d2331c8..7ac81809a 100644 --- a/examples/env-vars/tsconfig.json +++ b/examples/env-vars/tsconfig.json @@ -1,6 +1,15 @@ { "compilerOptions": { + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. "moduleResolution": "node", - "module": "ES2020" + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/framework-alpine/tsconfig.json b/examples/framework-alpine/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/framework-alpine/tsconfig.json +++ b/examples/framework-alpine/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/framework-lit/tsconfig.json b/examples/framework-lit/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/framework-lit/tsconfig.json +++ b/examples/framework-lit/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/framework-multiple/tsconfig.json b/examples/framework-multiple/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/framework-multiple/tsconfig.json +++ b/examples/framework-multiple/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/framework-preact/tsconfig.json b/examples/framework-preact/tsconfig.json index 8e881cf9c..8c4c4bb42 100644 --- a/examples/framework-preact/tsconfig.json +++ b/examples/framework-preact/tsconfig.json @@ -1,5 +1,18 @@ { "compilerOptions": { - "moduleResolution": "node" + // Preact specific settings + "jsx": "react-jsx", + "jsxImportSource": "preact", + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index e767740f1..8d618e645 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -13,6 +13,8 @@ "astro": "^1.0.0-beta.19" }, "dependencies": { + "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.0", "react": "^18.0.0", "react-dom": "^18.0.0" } diff --git a/examples/framework-react/tsconfig.json b/examples/framework-react/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/framework-react/tsconfig.json +++ b/examples/framework-react/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/framework-solid/tsconfig.json b/examples/framework-solid/tsconfig.json index 8e881cf9c..3aae33ef4 100644 --- a/examples/framework-solid/tsconfig.json +++ b/examples/framework-solid/tsconfig.json @@ -1,5 +1,18 @@ { "compilerOptions": { - "moduleResolution": "node" + // Solid specific settings + "jsx": "preserve", + "jsxImportSource": "solid-js", + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/framework-svelte/tsconfig.json b/examples/framework-svelte/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/framework-svelte/tsconfig.json +++ b/examples/framework-svelte/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/framework-vue/tsconfig.json b/examples/framework-vue/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/framework-vue/tsconfig.json +++ b/examples/framework-vue/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/integrations-playground/tsconfig.json b/examples/integrations-playground/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/integrations-playground/tsconfig.json +++ b/examples/integrations-playground/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/minimal/tsconfig.json b/examples/minimal/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/minimal/tsconfig.json +++ b/examples/minimal/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/non-html-pages/tsconfig.json b/examples/non-html-pages/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/non-html-pages/tsconfig.json +++ b/examples/non-html-pages/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/portfolio/tsconfig.json b/examples/portfolio/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/portfolio/tsconfig.json +++ b/examples/portfolio/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/ssr/tsconfig.json b/examples/ssr/tsconfig.json index ee0432bb3..7ac81809a 100644 --- a/examples/ssr/tsconfig.json +++ b/examples/ssr/tsconfig.json @@ -1,9 +1,15 @@ { "compilerOptions": { - "lib": ["ES2015", "DOM"], - "module": "ES2022", + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. "moduleResolution": "node", + // Enable JSON imports. "resolveJsonModule": true, - "types": ["astro/env"] + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/starter/tsconfig.json b/examples/starter/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/starter/tsconfig.json +++ b/examples/starter/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/subpath/tsconfig.json b/examples/subpath/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/subpath/tsconfig.json +++ b/examples/subpath/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/with-markdown-plugins/tsconfig.json b/examples/with-markdown-plugins/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/with-markdown-plugins/tsconfig.json +++ b/examples/with-markdown-plugins/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/with-markdown-shiki/tsconfig.json b/examples/with-markdown-shiki/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/with-markdown-shiki/tsconfig.json +++ b/examples/with-markdown-shiki/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/with-markdown/tsconfig.json b/examples/with-markdown/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/with-markdown/tsconfig.json +++ b/examples/with-markdown/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/with-nanostores/tsconfig.json b/examples/with-nanostores/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/with-nanostores/tsconfig.json +++ b/examples/with-nanostores/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/with-tailwindcss/tsconfig.json b/examples/with-tailwindcss/tsconfig.json index 8e881cf9c..7ac81809a 100644 --- a/examples/with-tailwindcss/tsconfig.json +++ b/examples/with-tailwindcss/tsconfig.json @@ -1,5 +1,15 @@ { "compilerOptions": { - "moduleResolution": "node" + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] } } diff --git a/examples/with-vite-plugin-pwa/tsconfig.json b/examples/with-vite-plugin-pwa/tsconfig.json index 5d9f97afe..7ac81809a 100644 --- a/examples/with-vite-plugin-pwa/tsconfig.json +++ b/examples/with-vite-plugin-pwa/tsconfig.json @@ -1,3 +1,15 @@ { - "include": ["src/**/*.ts"] + "compilerOptions": { + // Enable top-level await, and other modern ESM features. + "target": "ESNext", + "module": "ESNext", + // Enable node-style module resolution, for things like npm package imports. + "moduleResolution": "node", + // Enable JSON imports. + "resolveJsonModule": true, + // Enable stricter transpilation for better output. + "isolatedModules": true, + // Add type definitions for our Vite runtime. + "types": ["vite/client"] + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d80665b82..1ab95ed58 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -192,10 +192,14 @@ importers: examples/framework-react: specifiers: '@astrojs/react': ^0.1.1 + '@types/react': ^18.0.0 + '@types/react-dom': ^18.0.0 astro: ^1.0.0-beta.19 react: ^18.0.0 react-dom: ^18.0.0 dependencies: + '@types/react': 18.0.6 + '@types/react-dom': 18.0.2 react: 18.0.0 react-dom: 18.0.0_react@18.0.0 devDependencies: @@ -4017,6 +4021,12 @@ packages: '@types/react': 17.0.44 dev: true + /@types/react-dom/18.0.2: + resolution: {integrity: sha512-UxeS+Wtj5bvLRREz9tIgsK4ntCuLDo0EcAcACgw3E+9wE8ePDr9uQpq53MfcyxyIS55xJ+0B6mDS8c4qkkHLBg==} + dependencies: + '@types/react': 18.0.6 + dev: false + /@types/react/17.0.44: resolution: {integrity: sha512-Ye0nlw09GeMp2Suh8qoOv0odfgCoowfM/9MG6WeRD60Gq9wS90bdkdRtYbRkNhXOpG4H+YXGvj4wOWhAC0LJ1g==} dependencies: @@ -4024,6 +4034,14 @@ packages: '@types/scheduler': 0.16.2 csstype: 3.0.11 + /@types/react/18.0.6: + resolution: {integrity: sha512-bPqwzJRzKtfI0mVYr5R+1o9BOE8UEXefwc1LwcBtfnaAn6OoqMhLa/91VA8aeWfDPJt1kHvYKI8RHcQybZLHHA==} + dependencies: + '@types/prop-types': 15.7.5 + '@types/scheduler': 0.16.2 + csstype: 3.0.11 + dev: false + /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: