-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
169 lines (161 loc) · 4.77 KB
/
Copy patheslint.config.js
File metadata and controls
169 lines (161 loc) · 4.77 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import js from '@eslint/js';
import typescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
export default [
js.configs.recommended,
{
files: ['src/ts/**/*.{ts,tsx}', 'src/admints/**/*.{ts,tsx}'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
project: './tsconfig.json',
},
globals: {
window: 'readonly',
document: 'readonly',
console: 'readonly',
navigator: 'readonly',
location: 'readonly',
alert: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
fetch: 'readonly',
URL: 'readonly',
Request: 'readonly',
Response: 'readonly',
Cache: 'readonly',
CacheStorage: 'readonly',
caches: 'readonly',
self: 'readonly',
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
module: 'readonly',
require: 'readonly',
exports: 'readonly',
global: 'readonly',
},
},
plugins: {
'@typescript-eslint': typescript,
'react': react,
'react-hooks': reactHooks,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
// ESLint base rules
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'no-unused-vars': 'off', // Use TypeScript version instead
// TypeScript rules (relaxed for legacy codebase)
'@typescript-eslint/no-unused-vars': ['warn', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrors: 'none',
ignoreRestSiblings: true
}],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off', // Allow any during migration
// React rules
'react/prop-types': 'off', // TypeScript handles prop validation
'react/jsx-uses-react': 'off', // Not needed with new JSX transform
'react/react-in-jsx-scope': 'off', // Not needed with new JSX transform
'react/jsx-uses-vars': 'error',
'react/display-name': 'off',
// React Hooks rules (relaxed)
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'off', // Too noisy during migration
// Style preferences
'camelcase': 'off',
},
},
{
// Configuration for other TypeScript/JavaScript files without TypeScript project
files: ['**/*.{js,jsx,ts,tsx}'],
ignores: ['src/ts/**/*.{ts,tsx}', 'src/admints/**/*.{ts,tsx}'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
// No project reference for files outside main TypeScript project
},
globals: {
window: 'readonly',
document: 'readonly',
console: 'readonly',
navigator: 'readonly',
location: 'readonly',
alert: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
fetch: 'readonly',
URL: 'readonly',
Request: 'readonly',
Response: 'readonly',
Cache: 'readonly',
CacheStorage: 'readonly',
caches: 'readonly',
self: 'readonly',
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
module: 'readonly',
require: 'readonly',
exports: 'readonly',
global: 'readonly',
},
},
plugins: {
'react': react,
'react-hooks': reactHooks,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
// ESLint base rules
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'no-unused-vars': 'off', // Disabled for legacy codebase
// React rules
'react/prop-types': 'off',
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'react/jsx-uses-vars': 'error',
'react/display-name': 'off',
// React Hooks rules (relaxed)
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'off', // Too noisy during migration
// Style preferences
'camelcase': 'off',
},
},
{
// Ignore patterns
ignores: [
'node_modules/**',
'dist/**',
'build/**',
'public/**',
'**/*.d.ts',
],
},
];