-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
120 lines (108 loc) · 3.34 KB
/
Copy patheslint.config.mjs
File metadata and controls
120 lines (108 loc) · 3.34 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import eslint from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';
import eslintConfigPrettier from 'eslint-config-prettier';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
export default [
// Global ignores
{
ignores: [
'dist/',
'dist-electron/',
'node_modules/',
'release/',
'build/',
'SKILLs/',
'sandbox/',
'scripts/',
],
},
// Base recommended rules
eslint.configs.recommended,
// CommonJS / JS files (config files at root level)
{
files: ['**/*.{js,cjs,mjs}'],
languageOptions: {
globals: {
...globals.node,
},
},
},
// TypeScript files
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
...globals.node,
...globals.es2021,
},
},
plugins: {
'@typescript-eslint': tseslint,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
'simple-import-sort': simpleImportSort,
},
rules: {
// TypeScript recommended rules (manually included for flat config)
...tseslint.configs.recommended.rules,
// Tightened rules (warn level for gradual adoption)
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-explicit-any': 'warn',
// React hooks (v7: keep classic rules as error, downgrade compiler rules to warn)
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/static-components': 'warn',
'react-hooks/use-memo': 'warn',
'react-hooks/preserve-manual-memoization': 'warn',
'react-hooks/incompatible-library': 'warn',
'react-hooks/immutability': 'warn',
'react-hooks/globals': 'warn',
'react-hooks/refs': 'warn',
'react-hooks/set-state-in-effect': 'warn',
'react-hooks/error-boundaries': 'warn',
'react-hooks/purity': 'warn',
'react-hooks/set-state-in-render': 'warn',
'react-hooks/unsupported-syntax': 'warn',
'react-hooks/config': 'warn',
'react-hooks/gating': 'warn',
// React refresh
'react-refresh/only-export-components': 'off',
// Import sorting
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
// Disable rules that TypeScript compiler already handles
'no-undef': 'off',
'no-redeclare': 'off',
// ESLint 10 new rules — downgrade to warn for gradual adoption
'no-useless-assignment': 'warn',
'preserve-caught-error': 'warn',
// Rules kept off (existing codebase compatibility)
'no-control-regex': 'off',
'no-useless-escape': 'off',
'no-constant-condition': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
},
},
// Prettier must be last to override formatting rules
eslintConfigPrettier,
];