-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
57 lines (50 loc) · 1.53 KB
/
eslint.config.mjs
File metadata and controls
57 lines (50 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import tseslint from 'typescript-eslint'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import prettier from 'eslint-config-prettier'
export default tseslint.config(
// Base TypeScript rules
...tseslint.configs.recommended,
// React hooks
{
plugins: { 'react-hooks': reactHooks },
rules: reactHooks.configs.recommended.rules,
},
// React Refresh (Vite HMR safety)
{
plugins: { 'react-refresh': reactRefresh },
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
},
},
// Project-specific overrides
{
rules: {
// Allow unused vars prefixed with _ (e.g. _req, _err)
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
// `any` is sometimes needed in adapter code / error boundaries
'@typescript-eslint/no-explicit-any': 'warn',
// Consistent type imports
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
],
},
},
// Stories and tests — relax some rules
{
files: ['src/stories/**', '**/*.test.ts', '**/*.test.tsx', 'e2e/**'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
// Ignore generated / vendored dirs
{
ignores: ['dist/', 'storybook-static/', 'examples/', 'node_modules/'],
},
// Prettier must be last — disables all formatting rules
prettier,
)