create-vite
Advanced tools
Comparing version
{ | ||
"name": "create-vite", | ||
"version": "6.3.0", | ||
"version": "6.3.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -22,3 +22,3 @@ { | ||
"eslint": "^9.21.0", | ||
"eslint-plugin-react-hooks": "^5.0.0", | ||
"eslint-plugin-react-hooks": "^5.1.0", | ||
"eslint-plugin-react-refresh": "^0.4.19", | ||
@@ -25,0 +25,0 @@ "globals": "^15.15.0", |
@@ -12,8 +12,14 @@ # React + TypeScript + Vite | ||
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: | ||
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 tseslint.config({ | ||
extends: [ | ||
// Remove ...tseslint.configs.recommended and replace with this | ||
...tseslint.configs.recommendedTypeChecked, | ||
// Alternatively, use this for stricter rules | ||
...tseslint.configs.strictTypeChecked, | ||
// Optionally, add this for stylistic rules | ||
...tseslint.configs.stylisticTypeChecked, | ||
], | ||
languageOptions: { | ||
@@ -29,24 +35,22 @@ // other options... | ||
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` | ||
- Optionally add `...tseslint.configs.stylisticTypeChecked` | ||
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: | ||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: | ||
```js | ||
// eslint.config.js | ||
import react from 'eslint-plugin-react' | ||
import reactX from 'eslint-plugin-react-x' | ||
import reactDom from 'eslint-plugin-react-dom' | ||
export default tseslint.config({ | ||
// Set the react version | ||
settings: { react: { version: '18.3' } }, | ||
plugins: { | ||
// Add the react plugin | ||
react, | ||
// Add the react-x and react-dom plugins | ||
'react-x': reactX, | ||
'react-dom': reactDom, | ||
}, | ||
rules: { | ||
// other rules... | ||
// Enable its recommended rules | ||
...react.configs.recommended.rules, | ||
...react.configs['jsx-runtime'].rules, | ||
// Enable its recommended typescript rules | ||
...reactX.configs['recommended-typescript'].rules, | ||
...reactDom.configs.recommended.rules, | ||
}, | ||
}) | ||
``` |
import js from '@eslint/js' | ||
import globals from 'globals' | ||
import react from 'eslint-plugin-react' | ||
import reactHooks from 'eslint-plugin-react-hooks' | ||
@@ -20,5 +19,3 @@ import reactRefresh from 'eslint-plugin-react-refresh' | ||
}, | ||
settings: { react: { version: '18.3' } }, | ||
plugins: { | ||
react, | ||
'react-hooks': reactHooks, | ||
@@ -29,6 +26,4 @@ 'react-refresh': reactRefresh, | ||
...js.configs.recommended.rules, | ||
...react.configs.recommended.rules, | ||
...react.configs['jsx-runtime'].rules, | ||
...reactHooks.configs.recommended.rules, | ||
'react/jsx-no-target-blank': 'off', | ||
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }], | ||
'react-refresh/only-export-components': [ | ||
@@ -35,0 +30,0 @@ 'warn', |
@@ -22,4 +22,3 @@ { | ||
"eslint": "^9.21.0", | ||
"eslint-plugin-react": "^7.37.4", | ||
"eslint-plugin-react-hooks": "^5.0.0", | ||
"eslint-plugin-react-hooks": "^5.1.0", | ||
"eslint-plugin-react-refresh": "^0.4.19", | ||
@@ -26,0 +25,0 @@ "globals": "^15.15.0", |
@@ -9,1 +9,5 @@ # React + Vite | ||
- [@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 using TypeScript and enable type-aware lint rules. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project. |
Sorry, the diff of this file is not supported yet
211444
0.21%2640
-0.19%