From 8372de6ecad11031a82105402767e9e3a960225a Mon Sep 17 00:00:00 2001 From: w <674801810@qq.com> Date: Sat, 29 Apr 2023 11:14:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E5=BC=95=E5=85=A5unplugin-auto-impo?= =?UTF-8?q?rt=20=E7=9A=84api,=E5=9C=A8=E7=BC=96=E8=BE=91=E5=99=A8=E7=BA=A2?= =?UTF-8?q?=E8=89=B2=E6=8A=A5=E9=94=99=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改编辑器引入unplugin-auto-import 的api,在编辑器红色报错提示 --- .eslintrc-auto-import.json | 79 ++++++++++++++++++++++++++++++++ .eslintrc.js | 1 + build/vite/plugins/autoImport.ts | 3 ++ 3 files changed, 83 insertions(+) create mode 100644 .eslintrc-auto-import.json diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json new file mode 100644 index 0000000..6ac6d78 --- /dev/null +++ b/.eslintrc-auto-import.json @@ -0,0 +1,79 @@ +{ + "globals": { + "Component": true, + "ComponentPublicInstance": true, + "ComputedRef": true, + "EffectScope": true, + "InjectionKey": true, + "PropType": true, + "Ref": true, + "VNode": true, + "acceptHMRUpdate": true, + "computed": true, + "createApp": true, + "createPinia": true, + "customRef": true, + "defineAsyncComponent": true, + "defineComponent": true, + "defineStore": true, + "effectScope": true, + "getActivePinia": true, + "getCurrentInstance": true, + "getCurrentScope": true, + "h": true, + "inject": true, + "isProxy": true, + "isReactive": true, + "isReadonly": true, + "isRef": true, + "mapActions": true, + "mapGetters": true, + "mapState": true, + "mapStores": true, + "mapWritableState": true, + "markRaw": true, + "nextTick": true, + "onActivated": true, + "onBeforeMount": true, + "onBeforeRouteLeave": true, + "onBeforeRouteUpdate": true, + "onBeforeUnmount": true, + "onBeforeUpdate": true, + "onDeactivated": true, + "onErrorCaptured": true, + "onMounted": true, + "onRenderTracked": true, + "onRenderTriggered": true, + "onScopeDispose": true, + "onServerPrefetch": true, + "onUnmounted": true, + "onUpdated": true, + "provide": true, + "reactive": true, + "readonly": true, + "ref": true, + "resolveComponent": true, + "setActivePinia": true, + "setMapStoreSuffix": true, + "shallowReactive": true, + "shallowReadonly": true, + "shallowRef": true, + "storeToRefs": true, + "toRaw": true, + "toRef": true, + "toRefs": true, + "triggerRef": true, + "unref": true, + "useAttrs": true, + "useCssModule": true, + "useCssVars": true, + "useLink": true, + "useRoute": true, + "useRouter": true, + "useSlots": true, + "watch": true, + "watchEffect": true, + "watchPostEffect": true, + "watchSyncEffect": true + } +} \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index cb65caf..4e47066 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -13,6 +13,7 @@ module.exports = { 'eslint:recommended', '@vue/eslint-config-typescript', '@vue/eslint-config-prettier/skip-formatting', + './.eslintrc-auto-import.json', ], rules: { 'vue/script-setup-uses-vars': 'error', diff --git a/build/vite/plugins/autoImport.ts b/build/vite/plugins/autoImport.ts index 033ad86..1592182 100644 --- a/build/vite/plugins/autoImport.ts +++ b/build/vite/plugins/autoImport.ts @@ -17,6 +17,9 @@ export const AutoImportDeps = () => { '@vueuse/core': [], }, ], + eslintrc: { + enabled: true, + }, resolvers: [VarletUIResolver(), VantResolver()], }); };