Skip to content

Commit f7e00f6

Browse files
committed
upgrade eslint
1 parent 9fc2652 commit f7e00f6

17 files changed

Lines changed: 891 additions & 377 deletions

.eslintrc.cjs

Lines changed: 0 additions & 27 deletions
This file was deleted.

client/.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

client/.eslintrc.cjs

Lines changed: 0 additions & 30 deletions
This file was deleted.

client/eslint.config.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* eslint-env node */
2+
import globals from 'globals';
3+
import path from 'path';
4+
import { fileURLToPath } from 'url';
5+
import rootConfig from '../eslint.config.js';
6+
import tsEslintParser from '@typescript-eslint/parser';
7+
import reactHooks from 'eslint-plugin-react-hooks';
8+
import reactRefresh from 'eslint-plugin-react-refresh';
9+
10+
// mimic CommonJS variables -- not needed if using CommonJS
11+
const __filename = fileURLToPath(import.meta.url);
12+
const __dirname = path.dirname(__filename);
13+
14+
export default [
15+
...rootConfig,
16+
{
17+
// Note: there should be no other properties in this object
18+
ignores: ['src/server-types.d.ts', 'eslint.config.js', 'postcss.config.js'],
19+
},
20+
{
21+
languageOptions: {
22+
ecmaVersion: 2022,
23+
sourceType: 'module',
24+
globals: { ...globals.browser },
25+
parser: tsEslintParser,
26+
parserOptions: {
27+
project: './tsconfig.eslint.json',
28+
tsconfigRootDir: __dirname,
29+
},
30+
},
31+
plugins: { 'react-hooks': reactHooks, 'react-refresh': reactRefresh },
32+
rules: {
33+
'react-refresh/only-export-components': [
34+
'warn',
35+
{ allowConstantExport: true },
36+
],
37+
'no-restricted-imports': [
38+
'error',
39+
{
40+
paths: [
41+
{
42+
name: '@sentry/react',
43+
message: '@sentry/react should only be lazy imported',
44+
},
45+
],
46+
},
47+
],
48+
},
49+
},
50+
];

client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"@types/react-dom": "^19.1.3",
3131
"@vitejs/plugin-react-swc": "^3.7.0",
3232
"autoprefixer": "^10.4.19",
33-
"eslint-plugin-react-hooks": "^4.6.2",
34-
"eslint-plugin-react-refresh": "^0.4.7",
33+
"eslint-plugin-react-hooks": "^5.2.0",
34+
"eslint-plugin-react-refresh": "^0.4.20",
3535
"jsdom": "^24.1.0",
3636
"postcss": "^8.4.39",
3737
"tailwindcss": "^3.4.4",

e2e/.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

e2e/.eslintrc.cjs

Lines changed: 0 additions & 12 deletions
This file was deleted.

e2e/eslint.config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* eslint-env node */
2+
import path from 'path';
3+
import { fileURLToPath } from 'url';
4+
import globals from 'globals';
5+
import rootConfig from '../eslint.config.js';
6+
import tsEslintParser from '@typescript-eslint/parser';
7+
8+
// mimic CommonJS variables -- not needed if using CommonJS
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
12+
export default [
13+
...rootConfig,
14+
{
15+
// Note: there should be no other properties in this object
16+
ignores: ['eslint.config.js'],
17+
},
18+
{
19+
languageOptions: {
20+
ecmaVersion: 2022,
21+
sourceType: 'module',
22+
globals: { ...globals.browser },
23+
parser: tsEslintParser,
24+
parserOptions: {
25+
project: './tsconfig.eslint.json',
26+
tsconfigRootDir: __dirname,
27+
},
28+
},
29+
},
30+
];

e2e/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "@create-react-spa-cloudflare/e2e",
3+
"type": "module",
4+
"version": "0.0.0",
5+
"scripts": {
6+
"lint": "eslint ."
7+
}
8+
}

eslint.config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* eslint-env node */
2+
import path from 'path';
3+
import { fileURLToPath } from 'url';
4+
import js from '@eslint/js';
5+
import tsEslint from 'typescript-eslint';
6+
import tsEslintParser from '@typescript-eslint/parser';
7+
8+
// mimic CommonJS variables -- not needed if using CommonJS
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
12+
export default [
13+
js.configs.recommended,
14+
...tsEslint.configs.recommended,
15+
{
16+
// Note: there should be no other properties in this object
17+
ignores: ['dist', 'eslint.config.js'],
18+
},
19+
{
20+
languageOptions: {
21+
ecmaVersion: 2022,
22+
sourceType: 'module',
23+
parser: tsEslintParser,
24+
parserOptions: {
25+
project: './tsconfig.eslint.json',
26+
tsconfigRootDir: __dirname,
27+
},
28+
},
29+
rules: {
30+
'default-case': 'error',
31+
'@typescript-eslint/consistent-type-exports': 'warn',
32+
'@typescript-eslint/consistent-type-imports': 'warn',
33+
'@typescript-eslint/no-unused-vars': 'warn',
34+
'@typescript-eslint/no-unused-expressions': [
35+
'warn',
36+
{ allowShortCircuit: true },
37+
],
38+
},
39+
settings: {
40+
'max-warnings': 0,
41+
},
42+
},
43+
];

0 commit comments

Comments
 (0)