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 1/2] =?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()], }); }; From bae279ed65f42fd9cea14f5e4860c9c140900c52 Mon Sep 17 00:00:00 2001 From: w <674801810@qq.com> Date: Sat, 29 Apr 2023 12:48:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E4=BD=BF=E7=94=A8vit?= =?UTF-8?q?e-plugin-vue-setup-extend=20=E5=AF=BC=E8=87=B4sourceMap=20?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vite-plugin-vue-setup-extend, SourceMap转换bug一直存在导致调试位置异常, 所以使用vite-plugin-vue-setup-extend-plus替代达到同样目的 --- build/vite/plugins/index.ts | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/vite/plugins/index.ts b/build/vite/plugins/index.ts index 1595839..988704a 100644 --- a/build/vite/plugins/index.ts +++ b/build/vite/plugins/index.ts @@ -6,7 +6,7 @@ import type { PluginOption } from 'vite'; import vue from '@vitejs/plugin-vue'; import vueJsx from '@vitejs/plugin-vue-jsx'; -import vueSetupExtend from 'vite-plugin-vue-setup-extend'; +import vueSetupExtend from 'vite-plugin-vue-setup-extend-plus'; import { ConfigSvgIconsPlugin } from './svgIcons'; import { AutoRegistryComponents } from './component'; import { AutoImportDeps } from './autoImport'; diff --git a/package.json b/package.json index 62741fa..ea3f970 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "vite-plugin-progress": "^0.0.7", "vite-plugin-restart": "^0.3.1", "vite-plugin-svg-icons": "^2.0.1", - "vite-plugin-vue-setup-extend": "^0.4.0", + "vite-plugin-vue-setup-extend-plus": "^0.1.0", "vitest": "^0.30.1", "vue-eslint-parser": "^9.1.1", "vue-tsc": "^1.2.0"