Skip to content

Commit c0e3dba

Browse files
bluwyArnaudBarre
andauthored
fix(create-vite): remove eslint-plugin-react (#19514)
Co-authored-by: Arnaud Barré <[email protected]>
1 parent aa1d807 commit c0e3dba

File tree

6 files changed

+18
-17
lines changed

6 files changed

+18
-17
lines changed

.github/renovate.json5

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"rollup",
1717
"node",
1818
"typescript",
19-
"eslint-plugin-react-hooks", // prevent bumping to messy -rc-<hash>-<date>
2019
"@rollup/plugin-dynamic-import-vars", // prefer version using tinyglobby
2120
"@types/express", // express latest is still on v4, so types should also be v4
2221

packages/create-vite/template-react-ts/README.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ Currently, two official plugins are available:
99

1010
## Expanding the ESLint configuration
1111

12-
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13-
14-
- Configure the top-level `parserOptions` property like this:
12+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
1513

1614
```js
1715
export default tseslint.config({
16+
extends: [
17+
// Remove ...tseslint.configs.recommended and replace with this
18+
...tseslint.configs.recommendedTypeChecked,
19+
// Alternatively, use this for stricter rules
20+
...tseslint.configs.strictTypeChecked,
21+
// Optionally, add this for stylistic rules
22+
...tseslint.configs.stylisticTypeChecked,
23+
],
1824
languageOptions: {
1925
// other options...
2026
parserOptions: {
@@ -25,17 +31,15 @@ export default tseslint.config({
2531
})
2632
```
2733

28-
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
29-
- Optionally add `...tseslint.configs.stylisticTypeChecked`
30-
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
34+
You can also install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) for React-specific lint rules:
3135

3236
```js
3337
// eslint.config.js
3438
import react from 'eslint-plugin-react'
3539

3640
export default tseslint.config({
3741
// Set the react version
38-
settings: { react: { version: '18.3' } },
42+
settings: { react: { version: '19.0' } },
3943
plugins: {
4044
// Add the react plugin
4145
react,

packages/create-vite/template-react-ts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@types/react-dom": "^19.0.4",
2020
"@vitejs/plugin-react": "^4.3.4",
2121
"eslint": "^9.21.0",
22-
"eslint-plugin-react-hooks": "^5.0.0",
22+
"eslint-plugin-react-hooks": "^5.1.0",
2323
"eslint-plugin-react-refresh": "^0.4.19",
2424
"globals": "^15.15.0",
2525
"typescript": "~5.7.2",

packages/create-vite/template-react/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ Currently, two official plugins are available:
66

77
- [@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
88
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9+
10+
## Expanding the ESLint configuration
11+
12+
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.

packages/create-vite/template-react/eslint.config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import js from '@eslint/js'
22
import globals from 'globals'
3-
import react from 'eslint-plugin-react'
43
import reactHooks from 'eslint-plugin-react-hooks'
54
import reactRefresh from 'eslint-plugin-react-refresh'
65

@@ -17,18 +16,14 @@ export default [
1716
sourceType: 'module',
1817
},
1918
},
20-
settings: { react: { version: '18.3' } },
2119
plugins: {
22-
react,
2320
'react-hooks': reactHooks,
2421
'react-refresh': reactRefresh,
2522
},
2623
rules: {
2724
...js.configs.recommended.rules,
28-
...react.configs.recommended.rules,
29-
...react.configs['jsx-runtime'].rules,
3025
...reactHooks.configs.recommended.rules,
31-
'react/jsx-no-target-blank': 'off',
26+
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
3227
'react-refresh/only-export-components': [
3328
'warn',
3429
{ allowConstantExport: true },

packages/create-vite/template-react/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"@types/react-dom": "^19.0.4",
2020
"@vitejs/plugin-react": "^4.3.4",
2121
"eslint": "^9.21.0",
22-
"eslint-plugin-react": "^7.37.4",
23-
"eslint-plugin-react-hooks": "^5.0.0",
22+
"eslint-plugin-react-hooks": "^5.1.0",
2423
"eslint-plugin-react-refresh": "^0.4.19",
2524
"globals": "^15.15.0",
2625
"vite": "^6.2.0"

0 commit comments

Comments
 (0)