File tree Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ # React + TypeScript + Vite
2+
3+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+ ## Getting started
6+ Install the dependencies:
7+ ``` bash
8+ npm install
9+ ```
10+
11+ ### Start the server
12+ In dev mode:
13+ ``` bash
14+ npm run dev
15+ ```
16+
17+ ### Build
18+ To build the project:
19+ ``` bash
20+ npm run build
21+ ```
22+
23+ ### Locally preview the production build
24+ ``` bash
25+ npm run preview
26+ ```
27+
28+ ## Expanding the ESLint configuration
29+
30+ If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
31+
32+ - Configure the top-level ` parserOptions ` property like this:
33+
34+ ``` js
35+ export default tseslint .config ({
36+ languageOptions: {
37+ // other options...
38+ parserOptions: {
39+ project: [' ./tsconfig.node.json' , ' ./tsconfig.app.json' ],
40+ tsconfigRootDir: import .meta.dirname,
41+ },
42+ },
43+ })
44+ ```
45+
46+ - Replace ` tseslint.configs.recommended ` to ` tseslint.configs.recommendedTypeChecked ` or ` tseslint.configs.strictTypeChecked `
47+ - Optionally add ` ...tseslint.configs.stylisticTypeChecked `
48+ - Install [ eslint-plugin-react] ( https://github.com/jsx-eslint/eslint-plugin-react ) and update the config:
49+
50+ ``` js
51+ // eslint.config.js
52+ import react from ' eslint-plugin-react'
53+
54+ export default tseslint .config ({
55+ // Set the react version
56+ settings: { react: { version: ' 18.3' } },
57+ plugins: {
58+ // Add the react plugin
59+ react,
60+ },
61+ rules: {
62+ // other rules...
63+ // Enable its recommended rules
64+ ... react .configs .recommended .rules ,
65+ ... react .configs [' jsx-runtime' ].rules ,
66+ },
67+ })
68+ ```
You can’t perform that action at this time.
0 commit comments