Skip to content

Commit

Permalink
chore: update examples including tsconfig and type module (#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin authored Sep 8, 2023
1 parent 3bb7844 commit d5a20be
Show file tree
Hide file tree
Showing 25 changed files with 217 additions and 71 deletions.
1 change: 1 addition & 0 deletions examples/preact-router/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "example-preact-router",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/preact-router/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-pwa/client" />
/// <reference types="vite-plugin-pwa/preact" />
/// <reference types="vite-plugin-pwa/info" />
31 changes: 17 additions & 14 deletions examples/preact-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
{
"compilerOptions": {
"target": "ESNext",
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext", "WebWorker"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"lib": ["ES2020", "DOM", "DOM.Iterable", "WebWorker"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment",
"types": ["vite/client", "vite-plugin-pwa/client", "vite-plugin-pwa/info"]
"jsx": "react-jsx",
"jsxImportSource": "preact",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
10 changes: 10 additions & 0 deletions examples/preact-router/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
1 change: 1 addition & 0 deletions examples/react-router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "example-react-router",
"version": "0.0.0",
"type": "module",
"private": true,
"scripts": {
"dev": "rimraf dev-dist && DEBUG=vite-plugin-pwa SW_DEV=true vite --force",
Expand Down
33 changes: 17 additions & 16 deletions examples/react-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext", "WebWorker"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable", "WebWorker"],
"module": "ESNext",
"moduleResolution": "Node",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"types": [
"vite/client",
"vite-plugin-pwa/react",
"vite-plugin-pwa/info"
]
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["./src"]
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
10 changes: 10 additions & 0 deletions examples/react-router/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
1 change: 1 addition & 0 deletions examples/solid-router/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "example-solid-router",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions examples/solid-router/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-pwa/info" />
/// <reference types="vite-plugin-pwa/solid" />
27 changes: 20 additions & 7 deletions examples/solid-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": ["WebWorker"],
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"lib": ["ES2020", "DOM", "DOM.Iterable", "WebWorker"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"types": ["vite/client", "vite-plugin-pwa/info", "vite-plugin-pwa/solid"]
}

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
10 changes: 10 additions & 0 deletions examples/solid-router/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
23 changes: 12 additions & 11 deletions examples/svelte-routify/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"extends": "@tsconfig/svelte/tsconfig.json",
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"resolveJsonModule": true,
"baseUrl": ".",
"ignoreDeprecations": "5.0",
"lib": ["DOM", "DOM.Iterable", "ESNext", "WebWorker"],

/**
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable checkJs if you'd like to use dynamic types in JS.
* Note that setting allowJs false does not prevent the use
* of JS in `.svelte` files.
*/
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable checkJs if you'd like to use dynamic types in JS.
* Note that setting allowJs false does not prevent the use
* of JS in `.svelte` files.
*/
"allowJs": true,
"checkJs": true,
"isolatedModules": true
},
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"]
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
"references": [{ "path": "./tsconfig.node.json" }]
}
9 changes: 9 additions & 0 deletions examples/svelte-routify/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler"
},
"include": ["vite.config.ts"]
}
1 change: 1 addition & 0 deletions examples/vanilla-ts-dev-options/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "vanilla-ts-dev-options",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
Expand Down
21 changes: 12 additions & 9 deletions examples/vanilla-ts-dev-options/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
{
"compilerOptions": {
"target": "ESNext",
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM"],
"moduleResolution": "Node",
"strict": true,
"sourceMap": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"types": ["vite/client", "vite-plugin-pwa/vanillajs", "vite-plugin-pwa/info"],

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true,
"types": ["vite-plugin-pwa/vanillajs", "vite-plugin-pwa/info"]
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
1 change: 1 addition & 0 deletions examples/vanilla-ts-no-ip/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "vanilla-ts-no-ip",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
Expand Down
23 changes: 13 additions & 10 deletions examples/vanilla-ts-no-ip/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
{
"compilerOptions": {
"target": "ESNext",
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM", "WebWorker"],
"moduleResolution": "Node",
"strict": true,
"sourceMap": true,
"lib": ["ES2020", "DOM", "DOM.Iterable", "WebWorker"],
"skipLibCheck": true,
"types": ["vite/client", "vite-plugin-pwa/vanillajs", "vite-plugin-pwa/info"],

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true,
"types": ["vite/client", "vite-plugin-pwa/vanillajs", "vite-plugin-pwa/info"]
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts"]
"include": ["src"]
}
1 change: 1 addition & 0 deletions examples/vue-basic-cdn/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "example-vue-basic",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
Expand Down
25 changes: 25 additions & 0 deletions examples/vue-basic-cdn/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
10 changes: 10 additions & 0 deletions examples/vue-basic-cdn/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
1 change: 1 addition & 0 deletions examples/vue-router/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "example-vue-router",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions examples/vue-router/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-pwa/info" />
/// <reference types="vite-plugin-pwa/vue" />
25 changes: 25 additions & 0 deletions examples/vue-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
10 changes: 10 additions & 0 deletions examples/vue-router/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
Loading

0 comments on commit d5a20be

Please sign in to comment.