From 1e3cb0c885ab20c3b36b5b7f5fe3e17a997fecbe Mon Sep 17 00:00:00 2001 From: xingyu Date: Mon, 25 Sep 2023 17:32:16 +0800 Subject: [PATCH] fix: eslint --- src/components/Form/src/hooks/useAutoFocus.ts | 2 +- src/components/Form/src/hooks/useForm.ts | 2 +- .../Form/src/hooks/useFormEvents.ts | 2 ++ .../SimpleMenu/src/components/Menu.vue | 2 -- src/components/Table/src/BasicTable.vue | 1 + src/components/Table/src/hooks/useTable.ts | 1 + src/layouts/default/sider/MixSider.vue | 22 +++++++++++-------- src/router/types.ts | 1 + src/store/modules/multipleTab.ts | 1 + src/utils/domUtils.ts | 3 +++ src/utils/index.ts | 3 +++ src/utils/props.ts | 3 +-- 12 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/components/Form/src/hooks/useAutoFocus.ts b/src/components/Form/src/hooks/useAutoFocus.ts index f291d6ce..1e26d24d 100644 --- a/src/components/Form/src/hooks/useAutoFocus.ts +++ b/src/components/Form/src/hooks/useAutoFocus.ts @@ -8,7 +8,7 @@ interface UseAutoFocusContext { isInitedDefault: Ref formElRef: Ref } -export async function useAutoFocus({ getSchema, getProps, formElRef, isInitedDefault }: UseAutoFocusContext) { +export function useAutoFocus({ getSchema, getProps, formElRef, isInitedDefault }: UseAutoFocusContext) { watchEffect(async () => { if (unref(isInitedDefault) || !unref(getProps).autoFocusFirstItem) return diff --git a/src/components/Form/src/hooks/useForm.ts b/src/components/Form/src/hooks/useForm.ts index 85ad707c..0103244a 100644 --- a/src/components/Form/src/hooks/useForm.ts +++ b/src/components/Form/src/hooks/useForm.ts @@ -78,7 +78,7 @@ export function useForm(props?: Props): UseFormReturnType { }, removeSchemaByField: async (field: string | string[]) => { - unref(formRef)?.removeSchemaByField(field) + await unref(formRef)?.removeSchemaByField(field) }, // TODO promisify diff --git a/src/components/Form/src/hooks/useFormEvents.ts b/src/components/Form/src/hooks/useFormEvents.ts index d2ce15c2..984e3e3a 100644 --- a/src/components/Form/src/hooks/useFormEvents.ts +++ b/src/components/Form/src/hooks/useFormEvents.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/require-await */ import type { ComputedRef, Ref } from 'vue' import type { NamePath } from 'ant-design-vue/lib/form/interface' import { nextTick, toRaw, unref } from 'vue' @@ -89,6 +90,7 @@ export function useFormEvents({ const defaultValueObj = schema?.defaultValueObj const fieldKeys = Object.keys(defaultValueObj || {}) if (fieldKeys.length) { + // eslint-disable-next-line array-callback-return fieldKeys.map((field) => { formModel[field] = defaultValueObj![field] }) diff --git a/src/components/SimpleMenu/src/components/Menu.vue b/src/components/SimpleMenu/src/components/Menu.vue index 962eaeb3..5a03c744 100644 --- a/src/components/SimpleMenu/src/components/Menu.vue +++ b/src/components/SimpleMenu/src/components/Menu.vue @@ -6,8 +6,6 @@ import { useDesign } from '@/hooks/web/useDesign' import { propTypes } from '@/utils/propTypes' import mitt from '@/utils/mitt' -defineOptions({ name: 'Menu' }) - const props = defineProps({ theme: propTypes.oneOf(['light', 'dark']).def('light'), activeName: propTypes.oneOfType([propTypes.string, propTypes.number]), diff --git a/src/components/Table/src/BasicTable.vue b/src/components/Table/src/BasicTable.vue index 0e79bd6b..38397f83 100644 --- a/src/components/Table/src/BasicTable.vue +++ b/src/components/Table/src/BasicTable.vue @@ -1,3 +1,4 @@ +