Skip to content

Commit cf91ecb

Browse files
committed
package-fixes.
1 parent 4bcc106 commit cf91ecb

8 files changed

Lines changed: 950 additions & 866 deletions

File tree

web/.eslintrc.cjs

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

web/eslint.config.mjs

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import js from '@eslint/js'
2+
import { FlatCompat } from '@eslint/eslintrc'
3+
import reactRefresh from 'eslint-plugin-react-refresh'
4+
import path from 'path'
5+
import { fileURLToPath } from 'url'
6+
7+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
8+
9+
const compat = new FlatCompat({
10+
baseDirectory: __dirname,
11+
recommendedConfig: js.configs.recommended,
12+
})
13+
14+
export default [
15+
{
16+
ignores: ['dist'],
17+
},
18+
{
19+
plugins: {
20+
'react-refresh': reactRefresh,
21+
},
22+
},
23+
...compat.config({
24+
env: { browser: true, es2020: true },
25+
extends: [
26+
'eslint:recommended',
27+
'plugin:@typescript-eslint/recommended',
28+
'plugin:react-hooks/recommended',
29+
],
30+
parser: '@typescript-eslint/parser',
31+
rules: {
32+
'react-refresh/only-export-components': [
33+
'warn',
34+
{ allowConstantExport: true },
35+
],
36+
'@typescript-eslint/no-explicit-any': 'off',
37+
'@typescript-eslint/no-empty-object-type': 'off',
38+
'@typescript-eslint/no-unused-expressions': 'off',
39+
'react-hooks/immutability': 'off',
40+
'react-hooks/refs': 'off',
41+
'react-hooks/set-state-in-effect': 'off',
42+
'no-restricted-imports': [
43+
'error',
44+
{
45+
paths: [
46+
{
47+
name: 'react',
48+
importNames: ['useEffect'],
49+
message:
50+
'Direct useEffect is banned. Use useMountEffect() for DOM setup, useQuery/useMutation for data, inline computation for derived state, or event handlers for user actions.',
51+
},
52+
],
53+
},
54+
],
55+
'no-restricted-syntax': [
56+
'error',
57+
{
58+
selector: "CallExpression[callee.name='useEffect']",
59+
message:
60+
'Direct useEffect is banned. Use useMountEffect() from @/hooks/useMountEffect for one-time DOM setup.',
61+
},
62+
{
63+
selector:
64+
"CallExpression[callee.object.name='React'][callee.property.name='useEffect']",
65+
message:
66+
'Direct React.useEffect is banned. Use useMountEffect() from @/hooks/useMountEffect.',
67+
},
68+
],
69+
},
70+
overrides: [
71+
{
72+
files: [
73+
'src/hooks/**/*.{ts,tsx}',
74+
'src/components/ui/**/*.{ts,tsx}',
75+
'src/components/ThemeProvider.tsx',
76+
'src/contexts/**/*.{ts,tsx}',
77+
],
78+
rules: {
79+
'no-restricted-imports': 'off',
80+
'no-restricted-syntax': 'off',
81+
'react-refresh/only-export-components': 'off',
82+
},
83+
},
84+
{
85+
files: ['src/components/common/**/*.{ts,tsx}'],
86+
rules: {
87+
'react-refresh/only-export-components': 'off',
88+
},
89+
},
90+
],
91+
}),
92+
]

0 commit comments

Comments
 (0)