diff --git a/.eslintrc.js b/.eslintrc.js index 43c20ae..eab2aba 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,7 +15,7 @@ module.exports = { 'plugin:vue/vue3-recommended', 'plugin:vue/vue3-strongly-recommended', 'eslint:recommended', - './auto-import-eslint-config.js' + './.eslintrc-auto-import.json' ], parser: 'vue-eslint-parser', parserOptions: { diff --git a/.gitignore b/.gitignore index b54654c..c66a0a6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ node_modules dist* dist-ssr *.local +.eslintrc-auto-import.json public/icons src/assets/sprites/*.* diff --git a/auto-import-eslint-config.js b/auto-import-eslint-config.js deleted file mode 100644 index 51dea85..0000000 --- a/auto-import-eslint-config.js +++ /dev/null @@ -1,56 +0,0 @@ -module.exports = { - globals: { - // lifecycle - onActivated: 'readonly', - onBeforeMount: 'readonly', - onBeforeUnmount: 'readonly', - onBeforeUpdate: 'readonly', - onDeactivated: 'readonly', - onErrorCaptured: 'readonly', - onMounted: 'readonly', - onServerPrefetch: 'readonly', - onUnmounted: 'readonly', - onUpdated: 'readonly', - // reactivity - computed: 'readonly', - customRef: 'readonly', - isReadonly: 'readonly', - isRef: 'readonly', - markRaw: 'readonly', - reactive: 'readonly', - readonly: 'readonly', - ref: 'readonly', - shallowReactive: 'readonly', - shallowReadonly: 'readonly', - shallowRef: 'readonly', - toRaw: 'readonly', - toRef: 'readonly', - toRefs: 'readonly', - triggerRef: 'readonly', - unref: 'readonly', - watch: 'readonly', - watchEffect: 'readonly', - // component - defineComponent: 'readonly', - defineAsyncComponent: 'readonly', - getCurrentInstance: 'readonly', - h: 'readonly', - inject: 'readonly', - nextTick: 'readonly', - provide: 'readonly', - useCssModule: 'readonly', - // other - defineProps: 'readonly', - defineEmits: 'readonly', - defineExpose: 'readonly', - withDefaults: 'readonly', - // vue-router - useRoute: 'readonly', - useRouter: 'readonly', - // element plus - ElMessage: 'readonly', - ElNotification: 'readonly', - ElMessageBox: 'readonly', - ElLoading: 'readonly' - } -} diff --git a/vite/plugins/auto-import.js b/vite/plugins/auto-import.js index 3bead4f..837eaa0 100644 --- a/vite/plugins/auto-import.js +++ b/vite/plugins/auto-import.js @@ -5,8 +5,21 @@ export default function createAutoImport() { return autoImport({ imports: [ 'vue', - 'vue-router' + 'vue-router', + { + 'vue': [ + 'defineProps', + 'defineEmits', + 'defineExpose', + 'withDefaults' + ] + } ], + eslintrc: { + enabled: true, + filepath: './.eslintrc-auto-import.json', + globalsPropValue: true + }, resolvers: [ ElementPlusResolver() ],