Skip to content

Commit 26ff770

Browse files
feat: update react templates eslint configuration (#66)
* feat: update react templates eslint configuration * chore: redo as on main
1 parent 47d1949 commit 26ff770

File tree

12 files changed

+157
-83
lines changed

12 files changed

+157
-83
lines changed

templates/react-example/.eslintrc.cjs

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import react from 'eslint-plugin-react'
4+
import reactHooks from 'eslint-plugin-react-hooks'
5+
import reactRefresh from 'eslint-plugin-react-refresh'
6+
7+
export default [
8+
{ ignores: ['dist', 'public/workers'] },
9+
{
10+
files: ['**/*.{js,jsx}'],
11+
languageOptions: {
12+
ecmaVersion: 2020,
13+
globals: globals.browser,
14+
parserOptions: {
15+
ecmaVersion: 'latest',
16+
ecmaFeatures: { jsx: true },
17+
sourceType: 'module',
18+
},
19+
},
20+
settings: { react: { version: '18.3' } },
21+
plugins: {
22+
react,
23+
'react-hooks': reactHooks,
24+
'react-refresh': reactRefresh,
25+
},
26+
rules: {
27+
...js.configs.recommended.rules,
28+
...react.configs.recommended.rules,
29+
...react.configs['jsx-runtime'].rules,
30+
...reactHooks.configs.recommended.rules,
31+
'react/jsx-no-target-blank': 'off',
32+
'react-refresh/only-export-components': [
33+
'warn',
34+
{ allowConstantExport: true },
35+
],
36+
},
37+
},
38+
]

templates/react-example/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "vite build",
9-
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
9+
"lint": "eslint .",
1010
"preview": "vite preview",
1111
"format": "prettier --write .",
1212
"postinstall:copy-auth": "node -e \"require('fs').cpSync('node_modules/@junobuild/core/dist/workers/', './public/workers', {recursive: true});\"",
@@ -19,16 +19,18 @@
1919
"react-dom": "19.0.0"
2020
},
2121
"devDependencies": {
22+
"@eslint/js": "^9.17.0",
2223
"@junobuild/config": "^0.0.17",
2324
"@junobuild/vite-plugin": "^0.0.19",
2425
"@types/react": "19.0.0",
2526
"@types/react-dom": "19.0.0",
2627
"@vitejs/plugin-react": "^4.3.4",
2728
"autoprefixer": "^10.4.20",
28-
"eslint": "^9.16.0",
29+
"eslint": "^9.17.0",
2930
"eslint-plugin-react": "^7.37.2",
3031
"eslint-plugin-react-hooks": "^5.1.0",
3132
"eslint-plugin-react-refresh": "^0.4.16",
33+
"globals": "^15.14.0",
3234
"postcss": "^8.4.49",
3335
"prettier": "^3.4.2",
3436
"tailwindcss": "^3.4.16",

templates/react-starter/.eslintrc.cjs

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import react from 'eslint-plugin-react'
4+
import reactHooks from 'eslint-plugin-react-hooks'
5+
import reactRefresh from 'eslint-plugin-react-refresh'
6+
7+
export default [
8+
{ ignores: ['dist', 'public/workers'] },
9+
{
10+
files: ['**/*.{js,jsx}'],
11+
languageOptions: {
12+
ecmaVersion: 2020,
13+
globals: globals.browser,
14+
parserOptions: {
15+
ecmaVersion: 'latest',
16+
ecmaFeatures: { jsx: true },
17+
sourceType: 'module',
18+
},
19+
},
20+
settings: { react: { version: '18.3' } },
21+
plugins: {
22+
react,
23+
'react-hooks': reactHooks,
24+
'react-refresh': reactRefresh,
25+
},
26+
rules: {
27+
...js.configs.recommended.rules,
28+
...react.configs.recommended.rules,
29+
...react.configs['jsx-runtime'].rules,
30+
...reactHooks.configs.recommended.rules,
31+
'react/jsx-no-target-blank': 'off',
32+
'react-refresh/only-export-components': [
33+
'warn',
34+
{ allowConstantExport: true },
35+
],
36+
},
37+
},
38+
]

templates/react-starter/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "vite build",
9-
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
9+
"lint": "eslint .",
1010
"preview": "vite preview",
1111
"format": "prettier --write .",
1212
"postinstall:copy-auth": "node -e \"require('fs').cpSync('node_modules/@junobuild/core/dist/workers/', './public/workers', {recursive: true});\"",
@@ -18,16 +18,18 @@
1818
"react-dom": "19.0.0"
1919
},
2020
"devDependencies": {
21+
"@eslint/js": "^9.17.0",
2122
"@junobuild/config": "^0.0.17",
2223
"@junobuild/vite-plugin": "^0.0.19",
2324
"@types/react": "19.0.0",
2425
"@types/react-dom": "19.0.0",
2526
"@vitejs/plugin-react": "^4.3.4",
2627
"autoprefixer": "^10.4.20",
27-
"eslint": "^9.16.0",
28+
"eslint": "^9.17.0",
2829
"eslint-plugin-react": "^7.37.2",
2930
"eslint-plugin-react-hooks": "^5.1.0",
3031
"eslint-plugin-react-refresh": "^0.4.16",
32+
"globals": "^15.14.0",
3133
"postcss": "^8.4.49",
3234
"prettier": "^3.4.2",
3335
"tailwindcss": "^3.4.16",

templates/react-ts-starter/.eslintrc.cjs

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import js from '@eslint/js';
2+
import reactHooks from 'eslint-plugin-react-hooks';
3+
import reactRefresh from 'eslint-plugin-react-refresh';
4+
import globals from 'globals';
5+
import tseslint from 'typescript-eslint';
6+
7+
export default tseslint.config(
8+
{ignores: ['dist', 'public/workers']},
9+
{
10+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11+
files: ['**/*.{ts,tsx}'],
12+
languageOptions: {
13+
ecmaVersion: 2020,
14+
globals: globals.browser
15+
},
16+
plugins: {
17+
'react-hooks': reactHooks,
18+
'react-refresh': reactRefresh
19+
},
20+
rules: {
21+
...reactHooks.configs.recommended.rules,
22+
'react-refresh/only-export-components': ['warn', {allowConstantExport: true}]
23+
}
24+
}
25+
);

templates/react-ts-starter/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "tsc -b && vite build",
9-
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
9+
"lint": "eslint .",
1010
"preview": "vite preview",
1111
"format": "prettier --write .",
1212
"postinstall:copy-auth": "node -e \"require('fs').cpSync('node_modules/@junobuild/core/dist/workers/', './public/workers', {recursive: true});\"",
@@ -19,21 +19,22 @@
1919
"react-dom": "19.0.0"
2020
},
2121
"devDependencies": {
22+
"@eslint/js": "^9.17.0",
2223
"@junobuild/config": "^0.0.17",
2324
"@junobuild/vite-plugin": "^0.0.19",
2425
"@types/react": "19.0.0",
2526
"@types/react-dom": "19.0.0",
2627
"@vitejs/plugin-react": "^4.3.4",
2728
"autoprefixer": "^10.4.20",
28-
"eslint": "^9.16.0",
29-
"eslint-plugin-react": "^7.37.2",
30-
"eslint-plugin-react-hooks": "^5.1.0",
29+
"eslint": "^9.17.0",
30+
"eslint-plugin-react-hooks": "^5.0.0",
3131
"eslint-plugin-react-refresh": "^0.4.16",
32+
"globals": "^15.14.0",
3233
"postcss": "^8.4.49",
3334
"prettier": "^3.4.2",
3435
"tailwindcss": "^3.4.16",
3536
"typescript": "^5.7.3",
36-
"typescript-eslint": "^8.20.0",
37+
"typescript-eslint": "^8.18.2",
3738
"vite": "^6.0.3",
3839
"vite-plugin-node-polyfills": "^0.22.0"
3940
},

templates/react-workshop/.eslintrc.cjs

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import react from 'eslint-plugin-react'
4+
import reactHooks from 'eslint-plugin-react-hooks'
5+
import reactRefresh from 'eslint-plugin-react-refresh'
6+
7+
export default [
8+
{ ignores: ['dist', 'public/workers'] },
9+
{
10+
files: ['**/*.{js,jsx}'],
11+
languageOptions: {
12+
ecmaVersion: 2020,
13+
globals: globals.browser,
14+
parserOptions: {
15+
ecmaVersion: 'latest',
16+
ecmaFeatures: { jsx: true },
17+
sourceType: 'module',
18+
},
19+
},
20+
settings: { react: { version: '18.3' } },
21+
plugins: {
22+
react,
23+
'react-hooks': reactHooks,
24+
'react-refresh': reactRefresh,
25+
},
26+
rules: {
27+
...js.configs.recommended.rules,
28+
...react.configs.recommended.rules,
29+
...react.configs['jsx-runtime'].rules,
30+
...reactHooks.configs.recommended.rules,
31+
'react/jsx-no-target-blank': 'off',
32+
'react-refresh/only-export-components': [
33+
'warn',
34+
{ allowConstantExport: true },
35+
],
36+
},
37+
},
38+
]

templates/react-workshop/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "vite build",
9-
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
9+
"lint": "eslint .",
1010
"preview": "vite preview",
1111
"format": "prettier --write .",
1212
"postinstall:copy-auth": "node -e \"require('fs').cpSync('node_modules/@junobuild/core/dist/workers/', './public/workers', {recursive: true});\"",
@@ -19,16 +19,18 @@
1919
"react-dom": "19.0.0"
2020
},
2121
"devDependencies": {
22+
"@eslint/js": "^9.17.0",
2223
"@junobuild/config": "^0.0.17",
2324
"@junobuild/vite-plugin": "^0.0.19",
2425
"@types/react": "19.0.0",
2526
"@types/react-dom": "19.0.0",
2627
"@vitejs/plugin-react": "^4.3.4",
2728
"autoprefixer": "^10.4.20",
28-
"eslint": "^9.16.0",
29+
"eslint": "^9.17.0",
2930
"eslint-plugin-react": "^7.37.2",
3031
"eslint-plugin-react-hooks": "^5.1.0",
3132
"eslint-plugin-react-refresh": "^0.4.16",
33+
"globals": "^15.14.0",
3234
"postcss": "^8.4.49",
3335
"prettier": "^3.4.2",
3436
"tailwindcss": "^3.4.16",

0 commit comments

Comments
 (0)