chore: 导入类型优化 解决eslint报红

This commit is contained in:
dap 2025-01-10 14:12:42 +08:00
parent 9f6bee86f0
commit 0440ac84fd
22 changed files with 75 additions and 55 deletions

View File

@ -1,4 +1,3 @@
export { default as CropperImage } from './src/cropper.vue';
export { default as CropperAvatar } from './src/cropper-avatar.vue'; export { default as CropperAvatar } from './src/cropper-avatar.vue';
export { default as CropperImage } from './src/cropper.vue';
export type { Cropper } from './src/typing'; export type { Cropper } from './src/typing';

View File

@ -1,18 +1,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import { import type { ButtonProps } from 'ant-design-vue';
computed,
type CSSProperties, import type { CSSProperties, PropType } from 'vue';
type PropType,
ref, import { computed, ref, unref, watch, watchEffect } from 'vue';
unref,
watch,
watchEffect,
} from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { $t as t } from '@vben/locales'; import { $t as t } from '@vben/locales';
import { type ButtonProps, message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import cropperModal from './cropper-modal.vue'; import cropperModal from './cropper-modal.vue';

View File

@ -1,7 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { PropType } from 'vue';
import type { CropendResult, Cropper } from './typing'; import type { CropendResult, Cropper } from './typing';
import { type PropType, ref } from 'vue'; import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { $t as t } from '@vben/locales'; import { $t as t } from '@vben/locales';

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { CSSProperties, PropType } from 'vue'; import type { CSSProperties, PropType } from 'vue';
import { computed, onMounted, onUnmounted, ref, unref, useAttrs } from 'vue'; import { computed, onMounted, onUnmounted, ref, unref, useAttrs } from 'vue';
import { useDebounceFn } from '@vueuse/core'; import { useDebounceFn } from '@vueuse/core';

View File

@ -2,19 +2,11 @@
import type { CardSize } from 'ant-design-vue/es/card/Card'; import type { CardSize } from 'ant-design-vue/es/card/Card';
import type { DescriptionsProps } from 'ant-design-vue/es/descriptions'; import type { DescriptionsProps } from 'ant-design-vue/es/descriptions';
import type { CSSProperties, PropType, Slots } from 'vue';
import type { DescInstance, DescItem, DescriptionProps } from './typing'; import type { DescInstance, DescItem, DescriptionProps } from './typing';
import { import { computed, defineComponent, ref, toRefs, unref, useAttrs } from 'vue';
computed,
type CSSProperties,
defineComponent,
type PropType,
ref,
type Slots,
toRefs,
unref,
useAttrs,
} from 'vue';
import { Card, Descriptions } from 'ant-design-vue'; import { Card, Descriptions } from 'ant-design-vue';
import { get, isFunction } from 'lodash-es'; import { get, isFunction } from 'lodash-es';

View File

@ -1,9 +1,10 @@
import type { Recordable } from '@vben/types';
import type { DescriptionsProps } from 'ant-design-vue/es/descriptions'; import type { DescriptionsProps } from 'ant-design-vue/es/descriptions';
import type { JSX } from 'vue/jsx-runtime'; import type { JSX } from 'vue/jsx-runtime';
import type { CSSProperties, VNode } from 'vue'; import type { CSSProperties, VNode } from 'vue';
import type { Recordable } from '@vben/types';
export interface DescItem { export interface DescItem {
labelMinWidth?: number; labelMinWidth?: number;
contentMinWidth?: number; contentMinWidth?: number;

View File

@ -1,4 +1,4 @@
import { type VNode } from 'vue'; import type { VNode } from 'vue';
import { Tag } from 'ant-design-vue'; import { Tag } from 'ant-design-vue';

View File

@ -2,6 +2,10 @@
import type { IPropTypes } from '@tinymce/tinymce-vue/lib/cjs/main/ts/components/EditorPropTypes'; import type { IPropTypes } from '@tinymce/tinymce-vue/lib/cjs/main/ts/components/EditorPropTypes';
import type { Editor as EditorType } from 'tinymce/tinymce'; import type { Editor as EditorType } from 'tinymce/tinymce';
import type { PropType } from 'vue';
import type { UploadResult } from '#/api/core/upload';
import { import {
computed, computed,
nextTick, nextTick,
@ -9,7 +13,6 @@ import {
onBeforeUnmount, onBeforeUnmount,
onDeactivated, onDeactivated,
onMounted, onMounted,
type PropType,
ref, ref,
unref, unref,
useAttrs, useAttrs,
@ -22,7 +25,7 @@ import { buildShortUUID } from '@vben/utils';
import Editor from '@tinymce/tinymce-vue'; import Editor from '@tinymce/tinymce-vue';
import { isNumber } from 'lodash-es'; import { isNumber } from 'lodash-es';
import { uploadApi, type UploadResult } from '#/api/core/upload'; import { uploadApi } from '#/api/core/upload';
import { bindHandlers } from './helper'; import { bindHandlers } from './helper';
import ImgUpload from './img-upload.vue'; import ImgUpload from './img-upload.vue';

View File

@ -4,9 +4,9 @@ const validEvents = new Set([
'onBeforeAddUndo', 'onBeforeAddUndo',
'onBeforeExecCommand', 'onBeforeExecCommand',
'onBeforeGetContent', 'onBeforeGetContent',
'onBeforePaste',
'onBeforeRenderUI', 'onBeforeRenderUI',
'onBeforeSetContent', 'onBeforeSetContent',
'onBeforePaste',
'onBlur', 'onBlur',
'onChange', 'onChange',
'onClearUndos', 'onClearUndos',
@ -42,8 +42,8 @@ const validEvents = new Set([
'onMouseOver', 'onMouseOver',
'onMouseUp', 'onMouseUp',
'onNodeChange', 'onNodeChange',
'onObjectResizeStart',
'onObjectResized', 'onObjectResized',
'onObjectResizeStart',
'onObjectSelected', 'onObjectSelected',
'onPaste', 'onPaste',
'onPostProcess', 'onPostProcess',

View File

@ -3,9 +3,9 @@ import type { CheckboxChangeEvent } from 'ant-design-vue/es/checkbox/interface';
import type { DataNode } from 'ant-design-vue/es/tree'; import type { DataNode } from 'ant-design-vue/es/tree';
import type { CheckInfo } from 'ant-design-vue/es/vc-tree/props'; import type { CheckInfo } from 'ant-design-vue/es/vc-tree/props';
import type { PropType } from 'vue'; import type { PropType, SetupContext } from 'vue';
import { computed, nextTick, onMounted, ref, watch } from 'vue'; import { computed, nextTick, onMounted, ref, useSlots, watch } from 'vue';
import { findGroupParentIds, treeToList } from '@vben/utils'; import { findGroupParentIds, treeToList } from '@vben/utils';
@ -159,6 +159,8 @@ onMounted(async () => {
expandedKeys.value = allKeys.value; expandedKeys.value = allKeys.value;
} }
}); });
const slots = useSlots() as SetupContext['slots'];
</script> </script>
<template> <template>
@ -207,7 +209,7 @@ onMounted(async () => {
@check="handleChecked" @check="handleChecked"
> >
<template <template
v-for="slotName in Object.keys($slots)" v-for="slotName in Object.keys(slots)"
:key="slotName" :key="slotName"
#[slotName]="data" #[slotName]="data"
> >

View File

@ -2,13 +2,16 @@
import type { UploadFile, UploadProps } from 'ant-design-vue'; import type { UploadFile, UploadProps } from 'ant-design-vue';
import type { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface'; import type { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import { uploadApi } from '#/api'; import { ref, toRefs, watch } from 'vue';
import { ossInfo } from '#/api/system/oss';
import { PlusOutlined } from '@ant-design/icons-vue';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { PlusOutlined } from '@ant-design/icons-vue';
import { message, Modal, Upload } from 'ant-design-vue'; import { message, Modal, Upload } from 'ant-design-vue';
import { isArray, isFunction, isObject, isString, uniqueId } from 'lodash-es'; import { isArray, isFunction, isObject, isString, uniqueId } from 'lodash-es';
import { ref, toRefs, watch } from 'vue';
import { uploadApi } from '#/api';
import { ossInfo } from '#/api/system/oss';
import { checkImageFileType, defaultImageAccept } from './helper'; import { checkImageFileType, defaultImageAccept } from './helper';
import { UploadResultStatus } from './typing'; import { UploadResultStatus } from './typing';

View File

@ -15,7 +15,7 @@ export interface FileItem {
percent: number; percent: number;
file: File; file: File;
status?: UploadResultStatus; status?: UploadResultStatus;
response?: { fileName: string; ossId: string; url: string } | Recordable<any>; response?: Recordable<any> | { fileName: string; ossId: string; url: string };
uuid: string; uuid: string;
} }

View File

@ -1,6 +1,7 @@
import { computed, unref } from 'vue';
import type { Ref } from 'vue'; import type { Ref } from 'vue';
import { computed, unref } from 'vue';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
export function useUploadType({ export function useUploadType({

View File

@ -1,17 +1,21 @@
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import type { Locale } from 'ant-design-vue/es/locale'; import type { Locale } from 'ant-design-vue/es/locale';
import type { App } from 'vue'; import type { App } from 'vue';
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import { ref } from 'vue';
import { import {
$t, $t,
setupI18n as coreSetup, setupI18n as coreSetup,
loadLocalesMapFromDir, loadLocalesMapFromDir,
} from '@vben/locales'; } from '@vben/locales';
import { preferences } from '@vben/preferences'; import { preferences } from '@vben/preferences';
import antdEnLocale from 'ant-design-vue/es/locale/en_US'; import antdEnLocale from 'ant-design-vue/es/locale/en_US';
import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN'; import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { ref } from 'vue';
const antdLocale = ref<Locale>(antdDefaultLocale); const antdLocale = ref<Locale>(antdDefaultLocale);
@ -28,7 +32,8 @@ const localesMap = loadLocalesMapFromDir(
*/ */
async function loadMessages(lang: SupportedLanguagesType) { async function loadMessages(lang: SupportedLanguagesType) {
const [appLocaleMessages] = await Promise.all([ const [appLocaleMessages] = await Promise.all([
localesMap[lang](), // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
localesMap[lang]!(),
loadThirdPartyMessage(lang), loadThirdPartyMessage(lang),
]); ]);
return appLocaleMessages.default; return appLocaleMessages.default;

View File

@ -4,13 +4,15 @@ import type {
RouteRecordStringComponent, RouteRecordStringComponent,
} from '@vben/types'; } from '@vben/types';
import type { Menu } from '#/api';
import { generateAccessible } from '@vben/access'; import { generateAccessible } from '@vben/access';
import { preferences } from '@vben/preferences'; import { preferences } from '@vben/preferences';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import { getAllMenusApi, type Menu } from '#/api'; import { getAllMenusApi } from '#/api';
import { BasicLayout, IFrameView } from '#/layouts'; import { BasicLayout, IFrameView } from '#/layouts';
import { $t } from '#/locales'; import { $t } from '#/locales';

View File

@ -1,11 +1,10 @@
import type { TenantOption } from '#/api/core/auth';
import { ref } from 'vue'; import { ref } from 'vue';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { import { tenantList as tenantListApi } from '#/api/core/auth';
tenantList as tenantListApi,
type TenantOption,
} from '#/api/core/auth';
/** /**
* *

View File

@ -1,8 +1,9 @@
import type { ModalFuncProps } from 'ant-design-vue';
import type { Rule } from 'ant-design-vue/es/form'; import type { Rule } from 'ant-design-vue/es/form';
import { reactive } from 'vue'; import { reactive } from 'vue';
import { Alert, Form, Input, Modal, type ModalFuncProps } from 'ant-design-vue'; import { Alert, Form, Input, Modal } from 'ant-design-vue';
import { isFunction } from 'lodash-es'; import { isFunction } from 'lodash-es';
export interface ConfirmModalProps extends Omit<ModalFuncProps, 'visible'> { export interface ConfirmModalProps extends Omit<ModalFuncProps, 'visible'> {

View File

@ -1,6 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginCodeParams, VbenFormSchema } from '@vben/common-ui'; import type { LoginCodeParams, VbenFormSchema } from '@vben/common-ui';
import type { TenantResp } from '#/api';
import { computed, onMounted, ref, useTemplateRef } from 'vue'; import { computed, onMounted, ref, useTemplateRef } from 'vue';
import { AuthenticationCodeLogin, z } from '@vben/common-ui'; import { AuthenticationCodeLogin, z } from '@vben/common-ui';
@ -8,7 +10,7 @@ import { $t } from '@vben/locales';
import { Alert, message } from 'ant-design-vue'; import { Alert, message } from 'ant-design-vue';
import { tenantList, type TenantResp } from '#/api'; import { tenantList } from '#/api';
import { sendSmsCode } from '#/api/core/captcha'; import { sendSmsCode } from '#/api/core/captcha';
import { useAuthStore } from '#/store'; import { useAuthStore } from '#/store';

View File

@ -1,6 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginAndRegisterParams, VbenFormSchema } from '@vben/common-ui'; import type { LoginAndRegisterParams, VbenFormSchema } from '@vben/common-ui';
import type { TenantResp } from '#/api';
import type { CaptchaResponse } from '#/api/core/captcha';
import { computed, onMounted, ref, useTemplateRef } from 'vue'; import { computed, onMounted, ref, useTemplateRef } from 'vue';
import { AuthenticationLogin, z } from '@vben/common-ui'; import { AuthenticationLogin, z } from '@vben/common-ui';
@ -8,8 +11,8 @@ import { $t } from '@vben/locales';
import { omit } from 'lodash-es'; import { omit } from 'lodash-es';
import { tenantList, type TenantResp } from '#/api'; import { tenantList } from '#/api';
import { captchaImage, type CaptchaResponse } from '#/api/core/captcha'; import { captchaImage } from '#/api/core/captcha';
import { useAuthStore } from '#/store'; import { useAuthStore } from '#/store';
import OAuthLogin from './oauth-login.vue'; import OAuthLogin from './oauth-login.vue';

View File

@ -1,7 +1,11 @@
<script setup lang="tsx"> <script setup lang="tsx">
import type { VxeGridProps } from '@vben/plugins/vxe-table';
import type { BindItem } from '../../oauth-common';
import { computed, ref, unref } from 'vue'; import { computed, ref, unref } from 'vue';
import { useVbenVxeGrid, type VxeGridProps } from '@vben/plugins/vxe-table'; import { useVbenVxeGrid } from '@vben/plugins/vxe-table';
import { import {
Alert, Alert,
@ -16,7 +20,7 @@ import {
import { authUnbinding } from '#/api'; import { authUnbinding } from '#/api';
import { socialList } from '#/api/system/social'; import { socialList } from '#/api/system/social';
import { accountBindList, type BindItem } from '../../oauth-common'; import { accountBindList } from '../../oauth-common';
/** /**
* 没有传递action事件则不支持绑定 弹出默认提示 * 没有传递action事件则不支持绑定 弹出默认提示

View File

@ -1,9 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { Recordable } from '@vben/types';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { Popconfirm } from 'ant-design-vue'; import { Popconfirm } from 'ant-design-vue';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { forceLogout2, onlineDeviceList } from '#/api/monitor/online'; import { forceLogout2, onlineDeviceList } from '#/api/monitor/online';
import { columns } from '#/views/monitor/online/data'; import { columns } from '#/views/monitor/online/data';

View File

@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { AuthApi } from '#/api';
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
@ -7,7 +9,7 @@ import { useAccessStore } from '@vben/stores';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { type AuthApi, authCallback } from '#/api'; import { authCallback } from '#/api';
import { useAuthStore } from '#/store'; import { useAuthStore } from '#/store';
import { accountBindList } from '../oauth-common'; import { accountBindList } from '../oauth-common';