From 71ec0cb47a507f13f1dca4150aa652c2f1bd1177 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Thu, 12 Aug 2021 00:00:49 +0800 Subject: [PATCH] fix(form): lint --- src/form/src/Form.tsx | 2 +- src/form/src/FormItem.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/form/src/Form.tsx b/src/form/src/Form.tsx index 6feab9d54..2bed0ef51 100644 --- a/src/form/src/Form.tsx +++ b/src/form/src/Form.tsx @@ -66,7 +66,7 @@ export default defineComponent({ validateCallback?: FormValidateCallback, shouldRuleBeApplied: ApplyRule = () => true ): Promise { - return new Promise((resolve, reject) => { + return await new Promise((resolve, reject) => { const formItemValidationPromises = [] for (const key of keysOf(formItems)) { const formItemInstances = formItems[key] diff --git a/src/form/src/FormItem.tsx b/src/form/src/FormItem.tsx index c1c4ede1b..74367d8ef 100644 --- a/src/form/src/FormItem.tsx +++ b/src/form/src/FormItem.tsx @@ -297,20 +297,20 @@ export default defineComponent({ return shallowClonedRule }) if (!activeRules.length) { - return Promise.resolve({ + return await Promise.resolve({ valid: true }) } const mergedPath = path ?? '__n_no_path__' const validator = new Schema({ [mergedPath]: activeRules as RuleItem[] }) - return new Promise((resolve) => { + return await new Promise((resolve) => { void validator.validate( { [mergedPath]: value }, options, (errors, fields) => { if (errors?.length) { explainsRef.value = errors.map( - (error: ValidateError) => error?.message ?? '' + (error: ValidateError) => error?.message || '' ) validationErroredRef.value = true resolve({