diff --git a/src/process/validation/rules/__tests__/validateAvailableItems.test.ts b/src/process/validation/rules/__tests__/validateAvailableItems.test.ts index 0d8dfcb1..dc8870b9 100644 --- a/src/process/validation/rules/__tests__/validateAvailableItems.test.ts +++ b/src/process/validation/rules/__tests__/validateAvailableItems.test.ts @@ -608,7 +608,7 @@ describe('validateAvailableItems', function () { baz: true, biz: false, new: true, - test: false + test: false, }, }; const context = generateProcessorContext(component, data); @@ -631,7 +631,7 @@ describe('validateAvailableItems', function () { component: { one: true, two: false, - three: true + three: true, }, }; const context = generateProcessorContext(component, data); @@ -639,8 +639,7 @@ describe('validateAvailableItems', function () { context.fetch = () => { return Promise.resolve({ ok: true, - json: () => - Promise.resolve(['one', 'two', 'three']), + json: () => Promise.resolve(['one', 'two', 'three']), }); }; const result = await validateAvailableItems(context); @@ -663,7 +662,7 @@ describe('validateAvailableItems', function () { two: false, three: true, four: true, - five: false + five: false, }, }; const context = generateProcessorContext(component, data); @@ -671,8 +670,7 @@ describe('validateAvailableItems', function () { context.fetch = () => { return Promise.resolve({ ok: true, - json: () => - Promise.resolve(['one', 'two', 'three']), + json: () => Promise.resolve(['one', 'two', 'three']), }); }; const result = await validateAvailableItems(context); diff --git a/src/process/validation/rules/validateAvailableItems.ts b/src/process/validation/rules/validateAvailableItems.ts index f6523fff..55f9d5fd 100644 --- a/src/process/validation/rules/validateAvailableItems.ts +++ b/src/process/validation/rules/validateAvailableItems.ts @@ -28,11 +28,7 @@ function isValidateableSelectComponent(component: any): component is SelectCompo } function isValidateableSelectBoxesComponent(component: any): component is SelectBoxesComponent { - return ( - component && - !!component.validate?.onlyAvailableItems && - component.type === 'selectboxes' - ); + return component && !!component.validate?.onlyAvailableItems && component.type === 'selectboxes'; } function mapDynamicValues>(component: SelectComponent, values: T[]) { @@ -279,11 +275,9 @@ export const validateAvailableItems: RuleFn = async (context: ValidationContext) const values = component.dataSrc === 'url' ? await getAvailableDynamicValues(component, context) - : component.values.map(val => val.value); + : component.values.map((val) => val.value); if (values) { - return difference(Object.keys(value), values).length - ? error - : null; + return difference(Object.keys(value), values).length ? error : null; } } } catch (err: any) { @@ -340,11 +334,9 @@ export const validateAvailableItemsSync: RuleFnSync = (context: ValidationContex return null; } - const values = component.values.map(val => val.value); + const values = component.values.map((val) => val.value); if (values) { - return difference(Object.keys(value), values).length - ? error - : null; + return difference(Object.keys(value), values).length ? error : null; } } } catch (err: any) {