-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy patheslint.config.js
More file actions
218 lines (208 loc) · 5.93 KB
/
Copy patheslint.config.js
File metadata and controls
218 lines (208 loc) · 5.93 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// ESLint configuration for MCP ADR Analysis Server
// Simple flat config without TypeScript project dependencies
import js from '@eslint/js';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import prettierConfig from 'eslint-config-prettier';
export default [
// TypeScript files in src/ and tests/
{
files: ['src/**/*.ts', 'tests/**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
globals: {
console: 'readonly',
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
global: 'readonly',
// Node.js timer functions
setTimeout: 'readonly',
setInterval: 'readonly',
clearTimeout: 'readonly',
clearInterval: 'readonly',
setImmediate: 'readonly',
clearImmediate: 'readonly',
// Node.js types
NodeJS: 'readonly',
require: 'readonly',
// Web APIs
fetch: 'readonly',
Response: 'readonly',
Request: 'readonly',
Headers: 'readonly',
AbortController: 'readonly',
URLSearchParams: 'readonly',
URL: 'readonly',
performance: 'readonly',
},
},
plugins: {
'@typescript-eslint': tsPlugin,
},
rules: {
// JavaScript recommended rules
...js.configs.recommended.rules,
// ESLint 10 promoted these to error in `recommended`; downgrade to match
// the project's existing posture (warnings for stylistic-only issues).
'no-useless-assignment': 'warn',
'preserve-caught-error': 'warn',
// Basic TypeScript rules (without project)
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
// Code quality rules
'no-console': 'off', // Allow console for MCP server
'no-debugger': 'error',
'no-unused-vars': 'off', // Handled by TypeScript
'no-duplicate-imports': 'error',
eqeqeq: ['error', 'always'],
'no-var': 'error',
'prefer-const': 'error',
'prefer-arrow-callback': 'error',
// Security rules
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
},
},
// JavaScript files
{
files: ['**/*.{js,mjs}', '*.config.js'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
console: 'readonly',
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
global: 'readonly',
module: 'readonly',
require: 'readonly',
exports: 'readonly',
// Node.js timer functions
setTimeout: 'readonly',
setInterval: 'readonly',
clearTimeout: 'readonly',
clearInterval: 'readonly',
setImmediate: 'readonly',
clearImmediate: 'readonly',
// Node.js types
NodeJS: 'readonly',
// Web APIs
fetch: 'readonly',
Response: 'readonly',
Request: 'readonly',
Headers: 'readonly',
AbortController: 'readonly',
URLSearchParams: 'readonly',
URL: 'readonly',
performance: 'readonly',
},
},
rules: {
// JavaScript recommended rules only
...js.configs.recommended.rules,
'no-useless-assignment': 'warn',
'preserve-caught-error': 'warn',
'no-console': 'off',
'no-debugger': 'error',
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
eqeqeq: ['error', 'always'],
'no-var': 'error',
'prefer-const': 'error',
},
},
// Test files specific configuration
{
files: ['**/*.test.{ts,js}', '**/*.spec.{ts,js}', 'tests/**/*.{ts,js}'],
languageOptions: {
globals: {
// Vitest globals (primary test framework)
vi: 'readonly',
Mock: 'readonly',
MockedFunction: 'readonly',
MockInstance: 'readonly',
Mocked: 'readonly',
// Common test globals
describe: 'readonly',
it: 'readonly',
test: 'readonly',
expect: 'readonly',
beforeAll: 'readonly',
beforeEach: 'readonly',
afterAll: 'readonly',
afterEach: 'readonly',
// Node.js timer functions for tests
setTimeout: 'readonly',
setInterval: 'readonly',
clearTimeout: 'readonly',
clearInterval: 'readonly',
setImmediate: 'readonly',
clearImmediate: 'readonly',
// Node.js types
NodeJS: 'readonly',
require: 'readonly',
// Web APIs
fetch: 'readonly',
Response: 'readonly',
Request: 'readonly',
Headers: 'readonly',
AbortController: 'readonly',
URLSearchParams: 'readonly',
URL: 'readonly',
performance: 'readonly',
},
},
rules: {
// Relax some rules for tests
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'no-console': 'off',
},
},
// Ignore patterns
{
ignores: [
'dist/**',
'docs/api/**',
'docs/build/**',
'docs/.docusaurus/**',
'node_modules/**',
'coverage/**',
'.mcp-adr-cache/**',
'.mcp-migration-backups/**',
'.tmp/**',
'docs/.vitepress/**',
'scripts/**',
'*.d.ts',
'build/**',
'out/**',
'tmp/**',
'debug_test.js',
],
},
// Prettier integration (must be last to override conflicting rules)
prettierConfig,
];