From 46570636df39d68d11b807aad643cdd8e2080bf9 Mon Sep 17 00:00:00 2001 From: chenziang <3538995003@qq.com> Date: Wed, 31 Dec 2025 19:55:55 +0800 Subject: [PATCH] =?UTF-8?q?config(eslint):=20=E6=B7=BB=E5=8A=A0=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E5=92=8CWeb=20API=E5=85=A8=E5=B1=80=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加浏览器全局变量如window、document、navigator等 - 添加Vite相关全局变量如import、process等 - 添加Service Worker全局变量如self、caches等 - 添加Web API全局变量如Notification、ServiceWorker等 - 添加Web Storage API全局变量如Storage、StorageEvent等 - 添加WebSocket和Web Workers相关全局变量 --- eslint.config.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/eslint.config.js b/eslint.config.js index 944e82b..dc39e85 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -19,5 +19,48 @@ export default [ rules: { 'vue/multi-word-component-names': 'off', }, + }, + { + languageOptions: { + globals: { + // Browser globals + window: 'readonly', + document: 'readonly', + navigator: 'readonly', + localStorage: 'readonly', + sessionStorage: 'readonly', + console: 'readonly', + alert: 'readonly', + confirm: 'readonly', + prompt: 'readonly', + setTimeout: 'readonly', + setInterval: 'readonly', + fetch: 'readonly', + XMLHttpRequest: 'readonly', + URL: 'readonly', + URLSearchParams: 'readonly', + atob: 'readonly', + btoa: 'readonly', + // Vite globals + import: 'readonly', + process: 'readonly', + // Service Worker globals + self: 'readonly', + caches: 'readonly', + // Web API + Notification: 'readonly', + ServiceWorker: 'readonly', + PushManager: 'readonly', + PushSubscription: 'readonly', + // Web Storage API + Storage: 'readonly', + StorageEvent: 'readonly', + // Web Socket + WebSocket: 'readonly', + // Web Workers + Worker: 'readonly', + SharedWorker: 'readonly', + }, + }, } ]