From a9a120cd687f454e704b09e63eb7045e8cb3ebe3 Mon Sep 17 00:00:00 2001 From: Ken Sternberg Date: Wed, 2 Aug 2023 09:09:38 -0700 Subject: [PATCH] web: now passing the precommit phase --- web/src/components/ak-radio-input.ts | 2 ++ web/src/components/stories/ak-radio-input.stories.ts | 11 ++++++----- web/src/elements/forms/Radio.ts | 2 +- web/src/elements/forms/stories/Radio.stories.ts | 9 +++++---- web/src/elements/utils/eventEmitter.ts | 1 + 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/web/src/components/ak-radio-input.ts b/web/src/components/ak-radio-input.ts index 57cfa22c6..8ab39c03a 100644 --- a/web/src/components/ak-radio-input.ts +++ b/web/src/components/ak-radio-input.ts @@ -75,3 +75,5 @@ export class AkRadioInput extends AKElement { }); } } + +export default AkRadioInput; diff --git a/web/src/components/stories/ak-radio-input.stories.ts b/web/src/components/stories/ak-radio-input.stories.ts index 0b6e9dbc8..640c4502b 100644 --- a/web/src/components/stories/ak-radio-input.stories.ts +++ b/web/src/components/stories/ak-radio-input.stories.ts @@ -6,7 +6,7 @@ import { TemplateResult, html } from "lit"; import "../ak-radio-input"; import AkRadioInput from "../ak-radio-input"; -const metadata: Meta = { +const metadata: Meta>> = { title: "Components / Radio Input", component: "ak-radio-input", parameters: { @@ -30,7 +30,7 @@ const container = (testItem: TemplateResult) => margin-top: 1em; } -${testItem} + ${testItem}
    `; @@ -41,14 +41,15 @@ const testOptions = [ ]; export const ButtonWithSuccess = () => { - let result = ""; + const result = ""; + // eslint-disable-next-line @typescript-eslint/no-explicit-any const displayChange = (ev: any) => { console.log(ev.type, ev.target.name, ev.target.value, ev.detail); document.getElementById("radio-message-pad")!.innerText = `Value selected: ${JSON.stringify( ev.target.value, null, - 2 + 2, )}`; }; @@ -60,6 +61,6 @@ export const ButtonWithSuccess = () => { help="This is where you would read the help messages" .options=${testOptions} > -
    ${result}
    ` +
    ${result}
    `, ); }; diff --git a/web/src/elements/forms/Radio.ts b/web/src/elements/forms/Radio.ts index 78687b3a2..432b4ee98 100644 --- a/web/src/elements/forms/Radio.ts +++ b/web/src/elements/forms/Radio.ts @@ -54,7 +54,7 @@ export class Radio extends CustomEmitterElement(AKElement) { // Set the value if it's not set already. Property changes inside the `willUpdate()` method do // not trigger an element update. - willUpdate(changedProperties: Map) { + willUpdate() { if (!this.value) { const maybeDefault = this.options.filter((opt) => opt.default); if (maybeDefault.length > 0) { diff --git a/web/src/elements/forms/stories/Radio.stories.ts b/web/src/elements/forms/stories/Radio.stories.ts index f6b2c1f52..20f32f922 100644 --- a/web/src/elements/forms/stories/Radio.stories.ts +++ b/web/src/elements/forms/stories/Radio.stories.ts @@ -6,6 +6,7 @@ import { TemplateResult, html } from "lit"; import "../Radio"; import Radio from "../Radio"; +// eslint-disable-next-line @typescript-eslint/no-explicit-any const metadata: Meta> = { title: "Elements / Basic Radio", component: "ak-radio", @@ -42,11 +43,11 @@ const testOptions = [ ]; export const BasicRadioElement = () => { - const displayChange = (ev: any) => { + const displayChange = (ev: InputEvent) => { document.getElementById("radio-message-pad")!.innerText = `Value selected: ${JSON.stringify( - ev.target.value, + (ev.target as HTMLInputElement)!.value, null, - 2 + 2, )}`; }; @@ -55,6 +56,6 @@ export const BasicRadioElement = () => { @input=${displayChange} name="ak-test-radio-input" .options=${testOptions} - >` + >`, ); }; diff --git a/web/src/elements/utils/eventEmitter.ts b/web/src/elements/utils/eventEmitter.ts index 121a4507e..a0e082e25 100644 --- a/web/src/elements/utils/eventEmitter.ts +++ b/web/src/elements/utils/eventEmitter.ts @@ -9,6 +9,7 @@ export const isCustomEvent = (v: any): v is CustomEvent => export function CustomEmitterElement>(superclass: T) { return class EmmiterElementHandler extends superclass { + // eslint-disable-next-line @typescript-eslint/no-explicit-any dispatchCustomEvent(eventName: string, detail: any = {}, options = {}) { this.dispatchEvent( new CustomEvent(eventName, {