From a5ed133bbf0bfd069a2cf9bb982e4e84404f64d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=B6derlund?= Date: Wed, 26 Jun 2024 07:25:54 +0200 Subject: [PATCH] Linter fixes --- src/lib/client/SuperDebug.svelte | 1 + src/lib/client/customValidity.ts | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/client/SuperDebug.svelte b/src/lib/client/SuperDebug.svelte index ad4ff4ae..6ae34f9b 100644 --- a/src/lib/client/SuperDebug.svelte +++ b/src/lib/client/SuperDebug.svelte @@ -277,6 +277,7 @@ return '#}#undefined'; } if (typeof this === 'object' && this[key] instanceof Date) { + // @ts-expect-error Date checking works with isNaN return '#}D#' + (isNaN(this[key]) ? 'Invalid Date' : value); } if (typeof value === 'number') { diff --git a/src/lib/client/customValidity.ts b/src/lib/client/customValidity.ts index 9ffc2715..c7e0201b 100644 --- a/src/lib/client/customValidity.ts +++ b/src/lib/client/customValidity.ts @@ -18,10 +18,8 @@ export function setCustomValidityForm( formElement: HTMLFormElement, errors: ValidationErrors> ) { - for (const el of formElement.querySelectorAll< - HTMLInputElement & HTMLSelectElement & HTMLTextAreaElement & HTMLButtonElement - >('input,select,textarea,button')) { - if (noCustomValidityDataAttribute in el.dataset) { + for (const el of formElement.querySelectorAll('input,select,textarea,button')) { + if (('dataset' in el && noCustomValidityDataAttribute in el.dataset) || !el.name) { continue; }