-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy patheslint.config.js
More file actions
88 lines (87 loc) · 2.34 KB
/
eslint.config.js
File metadata and controls
88 lines (87 loc) · 2.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
import js from '@eslint/js';
export default [
js.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
// Cloudflare Workers globals
addEventListener: 'readonly',
fetch: 'readonly',
Response: 'readonly',
Request: 'readonly',
Headers: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
crypto: 'readonly',
TextEncoder: 'readonly',
TextDecoder: 'readonly',
btoa: 'readonly',
atob: 'readonly',
console: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
// Browser globals for frontend code
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
indexedDB: 'readonly',
IDBKeyRange: 'readonly',
self: 'readonly',
caches: 'readonly',
clients: 'readonly',
registration: 'readonly',
skipWaiting: 'readonly',
// Web APIs
Blob: 'readonly',
File: 'readonly',
FileReader: 'readonly',
FormData: 'readonly',
AbortController: 'readonly',
AbortSignal: 'readonly',
Event: 'readonly',
CustomEvent: 'readonly',
EventTarget: 'readonly',
MessageChannel: 'readonly',
MessagePort: 'readonly',
ReadableStream: 'readonly',
WritableStream: 'readonly',
TransformStream: 'readonly',
// Vitest globals
describe: 'readonly',
it: 'readonly',
test: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly',
vi: 'readonly',
},
},
rules: {
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'no-console': 'off', // Workers use console for logging
'prefer-const': 'error',
'no-var': 'error',
eqeqeq: ['error', 'always'],
curly: ['error', 'all'],
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
'no-return-await': 'error',
'require-await': 'off', // Allow async functions without await
'no-throw-literal': 'error',
'prefer-promise-reject-errors': 'error',
'no-useless-escape': 'off', // Frontend code uses escape sequences in template strings
},
},
{
ignores: ['node_modules/**', 'dist/**', 'coverage/**', '*.min.js', '.wrangler/**'],
},
];