Skip to content

Commit 4657063

Browse files
committed
config(eslint): 添加浏览器和Web API全局变量配置
- 添加浏览器全局变量如window、document、navigator等 - 添加Vite相关全局变量如import、process等 - 添加Service Worker全局变量如self、caches等 - 添加Web API全局变量如Notification、ServiceWorker等 - 添加Web Storage API全局变量如Storage、StorageEvent等 - 添加WebSocket和Web Workers相关全局变量
1 parent fb4da65 commit 4657063

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

eslint.config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,48 @@ export default [
1919
rules: {
2020
'vue/multi-word-component-names': 'off',
2121
},
22+
},
23+
{
24+
languageOptions: {
25+
globals: {
26+
// Browser globals
27+
window: 'readonly',
28+
document: 'readonly',
29+
navigator: 'readonly',
30+
localStorage: 'readonly',
31+
sessionStorage: 'readonly',
32+
console: 'readonly',
33+
alert: 'readonly',
34+
confirm: 'readonly',
35+
prompt: 'readonly',
36+
setTimeout: 'readonly',
37+
setInterval: 'readonly',
38+
fetch: 'readonly',
39+
XMLHttpRequest: 'readonly',
40+
URL: 'readonly',
41+
URLSearchParams: 'readonly',
42+
atob: 'readonly',
43+
btoa: 'readonly',
44+
// Vite globals
45+
import: 'readonly',
46+
process: 'readonly',
47+
// Service Worker globals
48+
self: 'readonly',
49+
caches: 'readonly',
50+
// Web API
51+
Notification: 'readonly',
52+
ServiceWorker: 'readonly',
53+
PushManager: 'readonly',
54+
PushSubscription: 'readonly',
55+
// Web Storage API
56+
Storage: 'readonly',
57+
StorageEvent: 'readonly',
58+
// Web Socket
59+
WebSocket: 'readonly',
60+
// Web Workers
61+
Worker: 'readonly',
62+
SharedWorker: 'readonly',
63+
},
64+
},
2265
}
2366
]

0 commit comments

Comments
 (0)