Skip to content

Commit

Permalink
feat(create-vite): stricter TS configs in templates (#12604)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed Apr 5, 2023
1 parent 3a41bd8 commit 4ffaeee
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 40 deletions.
19 changes: 12 additions & 7 deletions packages/create-vite/template-lit-ts/tsconfig.json
@@ -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
@@ -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
@@ -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-preact/src/main.jsx
@@ -1,5 +1,5 @@
import { render } from 'preact'
import { App } from './app'
import { App } from './app.jsx'
import './index.css'

render(<App />, document.getElementById('app'))
2 changes: 1 addition & 1 deletion packages/create-vite/template-react-ts/src/main.tsx
@@ -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
@@ -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-react/src/main.jsx
@@ -1,6 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
import App from './App.jsx'
import './index.css'

ReactDOM.createRoot(document.getElementById('root')).render(
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-vanilla-ts/src/main.ts
@@ -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
@@ -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
@@ -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 4ffaeee

Please sign in to comment.