-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy patheslint.config.mjs
More file actions
197 lines (194 loc) · 5.46 KB
/
eslint.config.mjs
File metadata and controls
197 lines (194 loc) · 5.46 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// @ts-check
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import importPlugin from 'eslint-plugin-import';
import {jsdoc} from 'eslint-plugin-jsdoc';
import tsdoc from "eslint-plugin-tsdoc";
import noComplexInlineReturnType from './tools/eslint-rules/no-complex-inline-return-type.js';
export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended,
jsdoc({
config: 'flat/requirements-typescript',
}),
{
ignores: [
'**/generated/*',
'**/dist/*',
'**/build/*',
'**/coverage/*',
'docs/**/*',
'**/.react-router/**',
'**/fixtures/**',
],
},
{
plugins : {
"tsdoc": tsdoc,
"custom": {
rules: {
"no-complex-inline-return-type": noComplexInlineReturnType
}
}
},
files: ['**/*.{ts,tsx}'],
extends: [importPlugin.flatConfigs.recommended, importPlugin.flatConfigs.typescript],
rules: {
"tsdoc/syntax": "warn",
'import/no-unresolved': 'off',
'jsdoc/require-example': 'off',
'jsdoc/require-throws-type': 'off',
'jsdoc/require-param': ['warn', { checkDestructured: false }],
'max-lines': ['error', { max: 400, skipBlankLines: false, skipComments: false }],
'@typescript-eslint/explicit-member-accessibility': 'warn',
"complexity": ["warn", { "max": 15 }],
"max-lines-per-function": ["warn", {
max: 80,
skipBlankLines: true,
skipComments: true
}],
"@typescript-eslint/prefer-as-const": "error",
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-error": "allow-with-description",
"minimumDescriptionLength": 10
}
],
"custom/no-complex-inline-return-type": ["error", { "maxProperties": 1 }]
},
"settings": {
"import/resolver": {
"node": {
"extensions": [
".js",
".jsx"
]
}
}
}
},
{
files: [
'**/*.test.{ts,tsx}',
'**/test/**/*.ts',
'**/test-*.ts',
'**/__tests__/**/*.ts',
],
rules: {
'@typescript-eslint/explicit-member-accessibility': 'off',
'jsdoc/require-yields': 'off',
"complexity": 'off',
"max-lines-per-function": 'off'
},
},
{
rules: {
'no-console': [
'error',
{
allow: ['warn', 'error', 'debug', 'info'], // Allow console.warn, console.error, console.debug, and console.info
},
],
'@typescript-eslint/no-namespace': [
'error',
{
allowDeclarations: true,
},
],
// Handle unused variables and parameters more intelligently
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'after-used', // Allow unused params if they come after used ones
argsIgnorePattern: '^_', // Ignore parameters starting with underscore
varsIgnorePattern: '^_', // Ignore variables starting with underscore
ignoreRestSiblings: true, // Ignore unused vars in object destructuring rest
destructuredArrayIgnorePattern: '^_', // Ignore unused array destructuring elements starting with _
caughtErrors: 'all', // Check caught error arguments
caughtErrorsIgnorePattern: '^_', // Ignore caught errors starting with _
},
],
},
},
{
// Override for scripts, snippet, and validate files - allow more console methods but still restrict console.log
files: ['scripts/**/*', 'services/snippet/src/snippet.ts', 'validate.ts'],
rules: {
'no-console': [
'error',
{
allow: ['warn', 'error', 'debug', 'info'], // Allow all except console.log
},
],
},
},
{
// Override for test files, build scripts, and demos
files: [
'**/*.test.ts',
'**/*.spec.ts',
'**/build.ts',
'**/demo.ts',
'**/__tests__/**',
'**/test/**',
],
rules: {
'no-console': 'off', // Allow console usage in tests and build scripts
},
},
{
// Explicit override for synthetic loader fixtures (CommonJS modules used by e2e loader tests)
// We lint them with CommonJS globals and script sourceType instead of ignoring them.
// Rationale: keep fixtures under lint while avoiding noisy no-undef for CJS patterns
files: ['packages/agents/core/test-fixtures/**/*.js'],
languageOptions: {
sourceType: 'script',
globals: {
module: 'readonly',
exports: 'readonly',
require: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
process: 'readonly',
},
},
rules: {
// Allow console in fixtures if used for test signaling
'no-console': 'off',
},
},
{
files: ['packages/commands/js-debugger/test/fixtures/browser/**/*.js'],
languageOptions: {
globals: {
window: 'readonly',
document: 'readonly',
console: 'readonly',
setTimeout: 'readonly',
},
},
rules: {
'no-console': 'off',
'no-debugger': 'off',
},
},
{
files: ['packages/commands/js-debugger/test/fixtures/node/**/*.js'],
languageOptions: {
globals: {
console: 'readonly',
process: 'readonly',
setTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
require: 'readonly',
module: 'readonly',
},
},
rules: {
'no-console': 'off',
'no-debugger': 'off',
},
},
);