Skip to content

Commit

Permalink
feat(create-vite): stricter TS configs in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed Mar 26, 2023
1 parent 35d1389 commit 19d6ec7
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 38 deletions.
19 changes: 12 additions & 7 deletions packages/create-vite/template-lit-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
{
"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,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "bundler",
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"useDefineForClassFields": false,
"skipLibCheck": true
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-preact-ts/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from 'preact'
import { App } from './app'
import { App } from './app.tsx'
import './index.css'

render(<App />, document.getElementById('app') as HTMLElement)
21 changes: 13 additions & 8 deletions packages/create-vite/template-preact-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
{
"compilerOptions": {
"target": "ESNext",
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"jsxImportSource": "preact"
"jsxImportSource": "preact",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-react-ts/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
import App from './App.tsx'
import './index.css'

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
Expand Down
18 changes: 11 additions & 7 deletions packages/create-vite/template-react-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"module": "ESNext",
"skipLibCheck": true,

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

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-vanilla-ts/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './style.css'
import typescriptLogo from './typescript.svg'
import viteLogo from '/vite.svg'
import { setupCounter } from './counter'
import { setupCounter } from './counter.ts'

document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
<div>
Expand Down
16 changes: 10 additions & 6 deletions packages/create-vite/template-vanilla-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
{
"compilerOptions": {
"target": "ESNext",
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM"],
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

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

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
21 changes: 14 additions & 7 deletions packages/create-vite/template-vue-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
{
"compilerOptions": {
"target": "ESNext",
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"strict": true,
"jsx": "preserve",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["ESNext", "DOM"],
"skipLibCheck": true,
"noEmit": true
"noEmit": true,
"jsx": "preserve",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
Expand Down

0 comments on commit 19d6ec7

Please sign in to comment.