Skip to content

Commit

Permalink
chore: sync templates form create-vite
Browse files Browse the repository at this point in the history
  • Loading branch information
caoxiemeihao committed Mar 17, 2024
1 parent c8d33a9 commit 742b923
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 20 deletions.
30 changes: 30 additions & 0 deletions template-react-ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
}
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
18 changes: 9 additions & 9 deletions template-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"@vitejs/plugin-react": "^4.0.4",
"eslint": "^8.48.0",
"@types/react": "^18.2.64",
"@types/react-dom": "^18.2.21",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"eslint-plugin-react-refresh": "^0.4.5",
"typescript": "^5.2.2",
"vite": "^4.4.9"
"vite": "^5.1.6"
}
}
1 change: 0 additions & 1 deletion template-react-ts/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}

a {
Expand Down
3 changes: 2 additions & 1 deletion template-react-ts/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["vite.config.ts"]
}
2 changes: 1 addition & 1 deletion template-vanilla-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^4.4.9"
"vite": "^5.1.6"
}
}
1 change: 0 additions & 1 deletion template-vanilla-ts/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}

a {
Expand Down
2 changes: 1 addition & 1 deletion template-vue-ts/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
"recommendations": ["Vue.volar"]
}
8 changes: 4 additions & 4 deletions template-vue-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.3.4"
"vue": "^3.4.21"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.3.4",
"@vitejs/plugin-vue": "^5.0.4",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vue-tsc": "^1.8.8"
"vite": "^5.1.6",
"vue-tsc": "^1.8.27"
}
}
1 change: 0 additions & 1 deletion template-vue-ts/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}

a {
Expand Down
3 changes: 2 additions & 1 deletion template-vue-ts/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["vite.config.ts"]
}

0 comments on commit 742b923

Please sign in to comment.