From abe8899f9b78ef5923fac7b5060eb2878f5447a6 Mon Sep 17 00:00:00 2001 From: Wendelin <12148533+wendevlin@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:24:02 +0100 Subject: [PATCH] Update ts-eslint (#23723) * Update ts-eslint * Remove comments * Remove unused ts-ignore * Add undefined generic type instead of unknown * Remove unused undefined type * Fix type issues * Use undefined instead of void for subscribed return type --- build-scripts/eslint.config.mjs | 2 +- cast/src/launcher/layout/hc-cast.ts | 2 +- cast/src/launcher/layout/hc-connect.ts | 4 +- demo/src/stubs/lovelace.ts | 2 +- demo/src/stubs/recorder.ts | 6 +- eslint.config.mjs | 26 ++- hassio/src/components/hassio-upload-backup.ts | 2 +- .../backup/dialog-hassio-backup-upload.ts | 3 +- .../dialogs/backup/dialog-hassio-backup.ts | 3 +- .../dialogs/network/dialog-hassio-network.ts | 3 +- hassio/src/hassio-my-redirect.ts | 2 +- .../src/ingress-view/hassio-ingress-view.ts | 8 +- hassio/src/system/hassio-core-info.ts | 2 +- hassio/src/system/hassio-host-info.ts | 2 +- hassio/src/system/hassio-supervisor-info.ts | 2 +- hassio/src/system/hassio-supervisor-log.ts | 2 +- hassio/src/system/hassio-system.ts | 2 +- .../src/components/landing-page-logs.ts | 2 +- landing-page/src/ha-landing-page.ts | 2 +- package.json | 5 +- rspack.config.cjs | 2 +- src/auth/ha-authorize.ts | 4 +- src/common/array/ensure-array.ts | 5 +- src/common/auth/token_storage.ts | 2 +- src/common/decorators/storage.ts | 2 +- src/common/dom/apply_themes_on_element.ts | 2 +- src/common/util/parse-aspect-ratio.ts | 2 +- src/common/util/select-unit.ts | 2 +- .../buttons/ha-call-service-button.ts | 2 +- .../chart/state-history-chart-line.ts | 19 +- src/components/ha-addon-picker.ts | 2 +- src/components/ha-ansi-to-html.ts | 2 +- src/components/ha-camera-stream.ts | 2 +- .../ha-conversation-agent-picker.ts | 2 +- src/components/ha-file-upload.ts | 2 +- src/components/ha-hls-player.ts | 2 +- src/components/ha-hs-color-picker.ts | 8 +- src/components/ha-icon-picker.ts | 2 +- src/components/ha-language-picker.ts | 2 +- src/components/ha-mount-picker.ts | 2 +- .../ha-push-notifications-toggle.ts | 4 +- .../ha-selector/ha-selector-file.ts | 2 +- src/components/ha-service-control.ts | 2 +- src/components/map/ha-locations-editor.ts | 3 +- src/components/trace/hat-script-graph.ts | 47 +++-- src/components/trace/hat-trace-timeline.ts | 2 +- src/data/application_credential.ts | 2 +- src/data/assist_pipeline.ts | 2 +- src/data/auth.ts | 4 +- src/data/automation.ts | 2 +- src/data/calendar.ts | 8 +- src/data/energy.ts | 6 +- src/data/frontend.ts | 2 +- src/data/hassio/addon.ts | 2 +- src/data/history.ts | 4 +- src/data/recorder.ts | 13 +- src/data/selector.ts | 14 -- src/data/tag.ts | 2 +- src/data/user.ts | 2 +- src/data/zwave_js.ts | 4 +- src/dialogs/area-filter/area-filter-dialog.ts | 3 +- src/dialogs/enter-code/dialog-enter-code.ts | 3 +- src/dialogs/make-dialog-manager.ts | 2 +- .../more-info/controls/more-info-camera.ts | 2 +- src/dialogs/more-info/ha-more-info-dialog.ts | 2 +- src/dialogs/more-info/ha-more-info-history.ts | 3 +- .../voice-assistant-setup-step-local.ts | 2 +- .../voice-assistant-setup-step-pipeline.ts | 2 +- .../voice-assistant-setup-step-success.ts | 2 +- src/external_app/external_auth.ts | 2 +- src/fake_data/provide_hass.ts | 24 +-- src/layouts/home-assistant.ts | 2 +- src/onboarding/ha-onboarding.ts | 6 +- .../calendar/dialog-calendar-event-detail.ts | 2 +- .../calendar/ha-recurrence-rule-editor.ts | 2 +- .../add-automation-element-dialog.ts | 3 +- .../dialog-automation-mode.ts | 3 +- .../dialog-automation-rename.ts | 3 +- .../automation/dialog-new-automation.ts | 3 +- .../config/ha-backup-config-data.ts | 2 +- .../dialogs/dialog-backup-onboarding.ts | 3 +- .../dialog-change-backup-encryption-key.ts | 3 +- .../backup/dialogs/dialog-generate-backup.ts | 1 + .../backup/dialogs/dialog-new-backup.ts | 3 +- .../backup/dialogs/dialog-restore-backup.ts | 1 + .../dialog-set-backup-encryption-key.ts | 3 +- .../dialog-show-backup-encryption-key.ts | 3 +- .../backup/dialogs/dialog-upload-backup.ts | 1 + .../dialogs/show-dialog-upload-backup.ts | 4 +- .../config/core/updates/dialog-join-beta.ts | 3 +- .../config/dashboard/dialog-new-dashboard.ts | 3 +- .../matter/ha-device-info-matter.ts | 2 +- .../mqtt/mqtt-messages.ts | 2 +- .../components/ha-energy-gas-settings.ts | 5 +- .../dialogs/dialog-energy-battery-settings.ts | 3 +- .../dialogs/dialog-energy-device-settings.ts | 3 +- .../dialogs/dialog-energy-gas-settings.ts | 3 +- .../dialog-energy-grid-flow-settings.ts | 3 +- .../dialogs/dialog-energy-solar-settings.ts | 3 +- .../dialogs/dialog-energy-water-settings.ts | 3 +- .../entity-registry-settings-editor.ts | 4 +- .../entities/entity-registry-settings.ts | 2 +- .../hardware/dialog-hardware-available.ts | 3 +- .../ha-config-integration-page.ts | 4 +- .../matter/dialog-matter-add-device.ts | 2 +- .../matter/dialog-matter-manage-fabrics.ts | 4 +- ...dialog-matter-open-commissioning-window.ts | 2 +- .../matter/dialog-matter-ping-node.ts | 2 +- .../matter/dialog-matter-reinterview-node.ts | 2 +- .../mqtt/mqtt-subscribe-card.ts | 2 +- .../thread/dialog-thread-dataset.ts | 3 +- .../thread/thread-config-panel.ts | 2 +- .../zha/dialog-zha-change-channel.ts | 3 +- .../zha/zha-cluster-attributes.ts | 2 +- .../zha/zha-device-binding.ts | 4 +- .../zha/zha-group-binding.ts | 4 +- .../zwave_js/dialog-zwave_js-add-node.ts | 4 +- .../dialog-zwave_js-remove-failed-node.ts | 3 +- .../zwave_js/zwave_js-node-config.ts | 2 +- .../config/labels/dialog-label-detail.ts | 3 +- src/panels/config/labels/ha-config-labels.ts | 2 +- .../config/logs/dialog-system-log-detail.ts | 2 +- src/panels/config/logs/ha-config-logs.ts | 2 +- .../ha-config-lovelace-dashboards.ts | 2 +- .../resources/ha-config-lovelace-resources.ts | 2 +- .../config/person/dialog-person-detail.ts | 1 + src/panels/config/person/ha-config-person.ts | 2 +- src/panels/config/scene/ha-scene-editor.ts | 2 +- src/panels/config/tags/dialog-tag-detail.ts | 3 +- src/panels/config/tags/ha-config-tags.ts | 2 +- src/panels/config/users/ha-config-users.ts | 2 +- .../config/voice-assistants/assist-pref.ts | 2 +- .../voice-assistants/cloud-alexa-pref.ts | 4 +- .../voice-assistants/cloud-google-pref.ts | 4 +- src/panels/config/zone/ha-config-zone.ts | 2 +- src/panels/custom/ha-panel-custom.ts | 2 +- .../action/developer-tools-action.ts | 2 +- src/panels/logbook/ha-logbook.ts | 3 +- src/panels/lovelace/badges/hui-error-badge.ts | 2 +- .../hui-alarm-modes-card-feature.ts | 2 +- .../hui-climate-fan-modes-card-feature.ts | 2 +- .../hui-climate-hvac-modes-card-feature.ts | 2 +- .../hui-climate-preset-modes-card-feature.ts | 2 +- ...ate-swing-horizontal-modes-card-feature.ts | 2 +- .../hui-climate-swing-modes-card-feature.ts | 2 +- .../hui-fan-preset-modes-card-feature.ts | 2 +- .../hui-humidifier-modes-card-feature.ts | 2 +- .../hui-humidifier-toggle-card-feature.ts | 2 +- .../hui-select-options-card-feature.ts | 2 +- ...ter-heater-operation-modes-card-feature.ts | 2 +- .../lovelace/cards/hui-alarm-panel-card.ts | 2 +- src/panels/lovelace/cards/hui-error-card.ts | 2 +- .../lovelace/cards/hui-history-graph-card.ts | 3 +- src/panels/lovelace/cards/hui-map-card.ts | 5 +- .../cards/hui-statistics-graph-card.ts | 2 +- .../lovelace/components/hui-card-options.ts | 2 +- .../create-element/create-element-base.ts | 2 +- .../lovelace/editor/add-entities-to-view.ts | 6 +- .../editor/badge-editor/hui-badge-picker.ts | 4 +- .../editor/card-editor/hui-card-picker.ts | 4 +- .../section-editor/hui-dialog-edit-section.ts | 1 + .../select-view/hui-dialog-select-view.ts | 2 +- src/panels/lovelace/ha-panel-lovelace.ts | 2 +- .../hui-buttons-header-footer.ts | 2 +- .../header-footer/hui-graph-header-footer.ts | 3 +- .../heading-badges/hui-error-heading-badge.ts | 2 +- .../heading-badges/hui-heading-badge.ts | 2 +- src/panels/lovelace/hui-editor.ts | 2 +- src/panels/lovelace/hui-root.ts | 2 +- .../lovelace/special-rows/hui-buttons-row.ts | 2 +- src/panels/lovelace/views/hui-masonry-view.ts | 2 +- .../media-browser/ha-panel-media-browser.ts | 2 +- src/panels/my/ha-panel-my.ts | 2 +- ...state-control-alarm_control_panel-modes.ts | 2 +- .../lock/ha-state-control-lock-toggle.ts | 4 +- src/util/common-translation.ts | 2 +- src/util/hass-call-api.ts | 8 +- yarn.lock | 195 +----------------- 178 files changed, 321 insertions(+), 475 deletions(-) diff --git a/build-scripts/eslint.config.mjs b/build-scripts/eslint.config.mjs index 3b703dc210..6c33f43ba5 100644 --- a/build-scripts/eslint.config.mjs +++ b/build-scripts/eslint.config.mjs @@ -9,7 +9,7 @@ export default [ "import/extensions": "off", "import/no-dynamic-require": "off", "global-require": "off", - "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-require-imports": "off", "prefer-arrow-callback": "off", }, }, diff --git a/cast/src/launcher/layout/hc-cast.ts b/cast/src/launcher/layout/hc-cast.ts index 8a1e66ca1b..c2bae5edb9 100644 --- a/cast/src/launcher/layout/hc-cast.ts +++ b/cast/src/launcher/layout/hc-cast.ts @@ -203,7 +203,7 @@ class HcCast extends LitElement { } this.connection.close(); location.reload(); - } catch (err: any) { + } catch (_err: any) { alert("Unable to log out!"); } } diff --git a/cast/src/launcher/layout/hc-connect.ts b/cast/src/launcher/layout/hc-connect.ts index ae40e3ea38..f736b6c7f0 100644 --- a/cast/src/launcher/layout/hc-connect.ts +++ b/cast/src/launcher/layout/hc-connect.ts @@ -215,7 +215,7 @@ export class HcConnect extends LitElement { let url: URL; try { url = new URL(value); - } catch (err: any) { + } catch (_err: any) { this.error = "Invalid URL"; return; } @@ -288,7 +288,7 @@ export class HcConnect extends LitElement { try { saveTokens(null); location.reload(); - } catch (err: any) { + } catch (_err: any) { alert("Unable to log out!"); } } diff --git a/demo/src/stubs/lovelace.ts b/demo/src/stubs/lovelace.ts index 8712f51a66..e4544a10ef 100644 --- a/demo/src/stubs/lovelace.ts +++ b/demo/src/stubs/lovelace.ts @@ -43,7 +43,7 @@ customElements.whenDefined("hui-root").then(() => { const index = (ev as CustomEvent).detail.index; try { await setDemoConfig(this.hass, this.lovelace!, index); - } catch (err: any) { + } catch (_err: any) { setDemoConfig(this.hass, this.lovelace!, selectedDemoConfigIndex); alert("Failed to switch config :-("); } diff --git a/demo/src/stubs/recorder.ts b/demo/src/stubs/recorder.ts index e5f3adfd89..3acce8b6d7 100644 --- a/demo/src/stubs/recorder.ts +++ b/demo/src/stubs/recorder.ts @@ -15,7 +15,7 @@ import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; const generateMeanStatistics = ( start: Date, end: Date, - // eslint-disable-next-line @typescript-eslint/default-param-last + // eslint-disable-next-line default-param-last period: "5minute" | "hour" | "day" | "month" = "hour", initValue: number, maxDiff: number @@ -52,7 +52,7 @@ const generateMeanStatistics = ( const generateSumStatistics = ( start: Date, end: Date, - // eslint-disable-next-line @typescript-eslint/default-param-last + // eslint-disable-next-line default-param-last period: "5minute" | "hour" | "day" | "month" = "hour", initValue: number, maxDiff: number @@ -89,7 +89,7 @@ const generateSumStatistics = ( const generateCurvedStatistics = ( start: Date, end: Date, - // eslint-disable-next-line @typescript-eslint/default-param-last + // eslint-disable-next-line default-param-last _period: "5minute" | "hour" | "day" | "month" = "hour", initValue: number, maxDiff: number, diff --git a/eslint.config.mjs b/eslint.config.mjs index 89a9ef6050..af3ca7abc9 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -18,8 +18,8 @@ const compat = new FlatCompat({ export default [ ...compat.extends( "airbnb-base", - "airbnb-typescript/base", "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/strict", "plugin:wc/recommended", "plugin:lit/all", "plugin:lit-a11y/recommended", @@ -50,8 +50,6 @@ export default [ ecmaFeatures: { modules: true, }, - - project: "./tsconfig.json", }, }, @@ -148,15 +146,15 @@ export default [ }, ], - "@typescript-eslint/no-unused-vars": "off", - - "unused-imports/no-unused-vars": [ + "@typescript-eslint/no-unused-vars": [ "error", { - vars: "all", - varsIgnorePattern: "^_", - args: "after-used", + args: "all", argsIgnorePattern: "^_", + caughtErrors: "all", + caughtErrorsIgnorePattern: "^_", + destructuredArrayIgnorePattern: "^_", + varsIgnorePattern: "^_", ignoreRestSiblings: true, }, ], @@ -174,6 +172,16 @@ export default [ "lit-a11y/role-has-required-aria-attrs": "error", "@typescript-eslint/consistent-type-imports": "error", "@typescript-eslint/no-import-type-side-effects": "error", + camelcase: "off", + "@typescript-eslint/no-dynamic-delete": "off", + "@typescript-eslint/no-empty-object-type": [ + "error", + { + allowInterfaces: "always", + allowObjectTypes: "always", + }, + ], + "no-use-before-define": "off", }, }, ]; diff --git a/hassio/src/components/hassio-upload-backup.ts b/hassio/src/components/hassio-upload-backup.ts index 236e4657f7..c09b8af823 100644 --- a/hassio/src/components/hassio-upload-backup.ts +++ b/hassio/src/components/hassio-upload-backup.ts @@ -15,7 +15,7 @@ import type { LocalizeFunc } from "../../../src/common/translations/localize"; declare global { interface HASSDomEvents { "backup-uploaded": { backup: HassioBackup }; - "backup-cleared": void; + "backup-cleared": undefined; } } diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts b/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts index dd83c23a7b..d890393c02 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts @@ -28,7 +28,7 @@ export class DialogHassioBackupUpload await this.updateComplete; } - public closeDialog(): void { + public closeDialog() { if (this._dialogParams && !this._dialogParams.onboarding) { if (this._dialogParams.reloadBackup) { this._dialogParams.reloadBackup(); @@ -36,6 +36,7 @@ export class DialogHassioBackupUpload } this._dialogParams = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup.ts b/hassio/src/dialogs/backup/dialog-hassio-backup.ts index 60e7cc2534..b83ee02ad1 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup.ts @@ -77,8 +77,9 @@ class HassioBackupDialog fireEvent(this, "dialog-closed", { dialog: this.localName }); } - public closeDialog(): void { + public closeDialog() { this._dialog?.close(); + return true; } private _localize(key: BackupOrRestoreKey) { diff --git a/hassio/src/dialogs/network/dialog-hassio-network.ts b/hassio/src/dialogs/network/dialog-hassio-network.ts index 7e28eff969..fc9e1acf3f 100644 --- a/hassio/src/dialogs/network/dialog-hassio-network.ts +++ b/hassio/src/dialogs/network/dialog-hassio-network.ts @@ -82,10 +82,11 @@ export class DialogHassioNetwork await this.updateComplete; } - public closeDialog(): void { + public closeDialog() { this._params = undefined; this._processing = false; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/hassio/src/hassio-my-redirect.ts b/hassio/src/hassio-my-redirect.ts index 019823083f..12f311038e 100644 --- a/hassio/src/hassio-my-redirect.ts +++ b/hassio/src/hassio-my-redirect.ts @@ -92,7 +92,7 @@ class HassioMyRedirect extends LitElement { let url: string; try { url = this._createRedirectUrl(redirect); - } catch (err: any) { + } catch (_err: any) { this._error = this.supervisor.localize("my.error"); return; } diff --git a/hassio/src/ingress-view/hassio-ingress-view.ts b/hassio/src/ingress-view/hassio-ingress-view.ts index b969a37b9f..6f81fe6c87 100644 --- a/hassio/src/ingress-view/hassio-ingress-view.ts +++ b/hassio/src/ingress-view/hassio-ingress-view.ts @@ -158,7 +158,7 @@ class HassioIngressView extends LitElement { try { addon = await fetchHassioAddonInfo(this.hass, addonSlug); - } catch (err: any) { + } catch (_err: any) { await this.updateComplete; await showAlertDialog(this, { text: @@ -219,7 +219,7 @@ class HassioIngressView extends LitElement { }); this._fetchData(addonSlug); return; - } catch (e) { + } catch (_err) { await showAlertDialog(this, { text: this.supervisor.localize("ingress.error_starting_addon") || @@ -264,7 +264,7 @@ class HassioIngressView extends LitElement { try { session = await createSessionPromise; - } catch (err: any) { + } catch (_err: any) { if (this._sessionKeepAlive) { clearInterval(this._sessionKeepAlive); } @@ -285,7 +285,7 @@ class HassioIngressView extends LitElement { this._sessionKeepAlive = window.setInterval(async () => { try { await validateHassioSession(this.hass, session); - } catch (err: any) { + } catch (_err: any) { session = await createHassioSession(this.hass); } }, 60000); diff --git a/hassio/src/system/hassio-core-info.ts b/hassio/src/system/hassio-core-info.ts index be00774d54..a49fd63a0a 100644 --- a/hassio/src/system/hassio-core-info.ts +++ b/hassio/src/system/hassio-core-info.ts @@ -33,7 +33,7 @@ class HassioCoreInfo extends LitElement { @state() private _metrics?: HassioStats; - protected render(): TemplateResult | void { + protected render(): TemplateResult | undefined { const metrics = [ { description: this.supervisor.localize("system.core.cpu_usage"), diff --git a/hassio/src/system/hassio-host-info.ts b/hassio/src/system/hassio-host-info.ts index 6ae9e7ee64..d393f44299 100644 --- a/hassio/src/system/hassio-host-info.ts +++ b/hassio/src/system/hassio-host-info.ts @@ -49,7 +49,7 @@ class HassioHostInfo extends LitElement { @property({ attribute: false }) public supervisor!: Supervisor; - protected render(): TemplateResult | void { + protected render(): TemplateResult | undefined { const primaryIpAddress = this.supervisor.host.features.includes("network") ? this._primaryIpAddress(this.supervisor.network!) : ""; diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts index 15fb03d4dd..2cf23b8909 100644 --- a/hassio/src/system/hassio-supervisor-info.ts +++ b/hassio/src/system/hassio-supervisor-info.ts @@ -44,7 +44,7 @@ class HassioSupervisorInfo extends LitElement { @state() private _metrics?: HassioStats; - protected render(): TemplateResult | void { + protected render(): TemplateResult | undefined { const metrics = [ { description: this.supervisor.localize("system.supervisor.cpu_usage"), diff --git a/hassio/src/system/hassio-supervisor-log.ts b/hassio/src/system/hassio-supervisor-log.ts index 91b2a9a19e..ce8702dd51 100644 --- a/hassio/src/system/hassio-supervisor-log.ts +++ b/hassio/src/system/hassio-supervisor-log.ts @@ -65,7 +65,7 @@ class HassioSupervisorLog extends LitElement { await this._loadData(); } - protected render(): TemplateResult | void { + protected render(): TemplateResult | undefined { return html` ${this._error diff --git a/hassio/src/system/hassio-system.ts b/hassio/src/system/hassio-system.ts index 0eacf50f12..643b9f3530 100644 --- a/hassio/src/system/hassio-system.ts +++ b/hassio/src/system/hassio-system.ts @@ -23,7 +23,7 @@ class HassioSystem extends LitElement { @property({ attribute: false }) public route!: Route; - protected render(): TemplateResult | void { + protected render(): TemplateResult | undefined { return html` = T extends undefined */ export function ensureArray(value: undefined): undefined; export function ensureArray(value: null): null; -export function ensureArray(value: T | T[]): NonNullUndefined[]; -export function ensureArray(value: T | readonly T[]): NonNullUndefined[]; +export function ensureArray( + value: T | T[] | readonly T[] +): NonNullUndefined[]; export function ensureArray(value) { if (value === undefined || value === null || Array.isArray(value)) { return value; diff --git a/src/common/auth/token_storage.ts b/src/common/auth/token_storage.ts index 5bcd7a64f2..3610f6b089 100644 --- a/src/common/auth/token_storage.ts +++ b/src/common/auth/token_storage.ts @@ -66,7 +66,7 @@ export function loadTokens() { } else { tokenCache.tokens = null; } - } catch (err: any) { + } catch (_err: any) { tokenCache.tokens = null; } } diff --git a/src/common/decorators/storage.ts b/src/common/decorators/storage.ts index c8e26212c0..a461ceb285 100644 --- a/src/common/decorators/storage.ts +++ b/src/common/decorators/storage.ts @@ -87,7 +87,7 @@ class StorageClass { } else { this.storage.setItem(storageKey, JSON.stringify(value)); } - } catch (err: any) { + } catch (_err: any) { // Safari in private mode doesn't allow localstorage } finally { if (this._listeners[storageKey]) { diff --git a/src/common/dom/apply_themes_on_element.ts b/src/common/dom/apply_themes_on_element.ts index 4ae79e0020..336f8cd756 100644 --- a/src/common/dom/apply_themes_on_element.ts +++ b/src/common/dom/apply_themes_on_element.ts @@ -186,7 +186,7 @@ const processTheme = ( const prefixedRgbKey = `--${rgbKey}`; styles[prefixedRgbKey] = rgbValue; keys[prefixedRgbKey] = ""; - } catch (err: any) { + } catch (_err: any) { continue; } } diff --git a/src/common/util/parse-aspect-ratio.ts b/src/common/util/parse-aspect-ratio.ts index bda41448db..1b3cd3c7c3 100644 --- a/src/common/util/parse-aspect-ratio.ts +++ b/src/common/util/parse-aspect-ratio.ts @@ -25,7 +25,7 @@ export default function parseAspectRatio(input: string) { return arr.length === 1 ? { w: parseOrThrow(arr[0]), h: 1 } : { w: parseOrThrow(arr[0]), h: parseOrThrow(arr[1]) }; - } catch (err: any) { + } catch (_err: any) { // Ignore the error } return null; diff --git a/src/common/util/select-unit.ts b/src/common/util/select-unit.ts index 48d18c70fb..edf2cf364c 100644 --- a/src/common/util/select-unit.ts +++ b/src/common/util/select-unit.ts @@ -19,7 +19,7 @@ const SECS_PER_HOUR = SECS_PER_MIN * 60; // Adapted from https://github.com/formatjs/formatjs/blob/186cef62f980ec66252ee232f438a42d0b51b9f9/packages/intl-utils/src/diff.ts export function selectUnit( from: Date | number, - // eslint-disable-next-line @typescript-eslint/default-param-last + // eslint-disable-next-line default-param-last to: Date | number = Date.now(), locale: FrontendLocaleData, thresholds: Partial = {} diff --git a/src/components/buttons/ha-call-service-button.ts b/src/components/buttons/ha-call-service-button.ts index b90e35b6b9..1476ebcffc 100644 --- a/src/components/buttons/ha-call-service-button.ts +++ b/src/components/buttons/ha-call-service-button.ts @@ -61,7 +61,7 @@ class HaCallServiceButton extends LitElement { this.progress = false; progressElement.actionSuccess(); eventData.success = true; - } catch (e) { + } catch (_err) { this.progress = false; progressElement.actionError(); eventData.success = false; diff --git a/src/components/chart/state-history-chart-line.ts b/src/components/chart/state-history-chart-line.ts index e2113b7478..672d956401 100644 --- a/src/components/chart/state-history-chart-line.ts +++ b/src/components/chart/state-history-chart-line.ts @@ -301,7 +301,7 @@ export class StateHistoryChartLine extends LitElement { prevValues = datavalues; }; - const addDataSet = (nameY: string, fill = false, color?: string) => { + const addDataSet = (nameY: string, color?: string, fill = false) => { if (!color) { color = getGraphColorByIndex(colorIndex, computedStyles); colorIndex++; @@ -359,8 +359,8 @@ export class StateHistoryChartLine extends LitElement { if (hasHeat) { addDataSet( `${this.hass.localize("ui.card.climate.heating", { name: name })}`, - true, - computedStyles.getPropertyValue("--state-climate-heat-color") + computedStyles.getPropertyValue("--state-climate-heat-color"), + true ); // The "heating" series uses steppedArea to shade the area below the current // temperature when the thermostat is calling for heat. @@ -368,8 +368,8 @@ export class StateHistoryChartLine extends LitElement { if (hasCool) { addDataSet( `${this.hass.localize("ui.card.climate.cooling", { name: name })}`, - true, - computedStyles.getPropertyValue("--state-climate-cool-color") + computedStyles.getPropertyValue("--state-climate-cool-color"), + true ); // The "cooling" series uses steppedArea to shade the area below the current // temperature when the thermostat is calling for heat. @@ -468,22 +468,23 @@ export class StateHistoryChartLine extends LitElement { `${this.hass.localize("ui.card.humidifier.humidifying", { name: name, })}`, - true, - computedStyles.getPropertyValue("--state-humidifier-on-color") + computedStyles.getPropertyValue("--state-humidifier-on-color"), + true ); } else if (hasDrying) { addDataSet( `${this.hass.localize("ui.card.humidifier.drying", { name: name, })}`, - true, - computedStyles.getPropertyValue("--state-humidifier-on-color") + computedStyles.getPropertyValue("--state-humidifier-on-color"), + true ); } else { addDataSet( `${this.hass.localize("ui.card.humidifier.on_entity", { name: name, })}`, + undefined, true ); } diff --git a/src/components/ha-addon-picker.ts b/src/components/ha-addon-picker.ts index 116b774d71..80889bbe13 100644 --- a/src/components/ha-addon-picker.ts +++ b/src/components/ha-addon-picker.ts @@ -98,7 +98,7 @@ class HaAddonPicker extends LitElement { "ui.components.addon-picker.error.no_supervisor" ); } - } catch (err: any) { + } catch (_err: any) { this._error = this.hass.localize( "ui.components.addon-picker.error.fetch_addons" ); diff --git a/src/components/ha-ansi-to-html.ts b/src/components/ha-ansi-to-html.ts index 78617ab9be..852d8c8239 100644 --- a/src/components/ha-ansi-to-html.ts +++ b/src/components/ha-ansi-to-html.ts @@ -34,7 +34,7 @@ export class HaAnsiToHtml extends LitElement { @litState() private _filter = ""; - protected render(): TemplateResult | void { + protected render(): TemplateResult { return html`
`;
   }
 
diff --git a/src/components/ha-camera-stream.ts b/src/components/ha-camera-stream.ts
index 4fe9b9d302..92e54fe780 100644
--- a/src/components/ha-camera-stream.ts
+++ b/src/components/ha-camera-stream.ts
@@ -166,7 +166,7 @@ export class HaCameraStream extends LitElement {
         this.clientWidth,
         this.clientHeight
       );
-    } catch (err: any) {
+    } catch (_err: any) {
       // poster url is optional
       this._posterUrl = undefined;
     }
diff --git a/src/components/ha-conversation-agent-picker.ts b/src/components/ha-conversation-agent-picker.ts
index 8e421f8f6e..e7116b1f80 100644
--- a/src/components/ha-conversation-agent-picker.ts
+++ b/src/components/ha-conversation-agent-picker.ts
@@ -142,7 +142,7 @@ export class HaConversationAgentPicker extends LitElement {
       this._configEntry = (
         await getConfigEntry(this.hass, regEntry.config_entry_id)
       ).config_entry;
-    } catch (err) {
+    } catch (_err) {
       this._configEntry = undefined;
     }
   }
diff --git a/src/components/ha-file-upload.ts b/src/components/ha-file-upload.ts
index 06937d5c82..dcc22f6974 100644
--- a/src/components/ha-file-upload.ts
+++ b/src/components/ha-file-upload.ts
@@ -15,7 +15,7 @@ import { bytesToString } from "../util/bytes-to-string";
 declare global {
   interface HASSDomEvents {
     "file-picked": { files: File[] };
-    "files-cleared": void;
+    "files-cleared": undefined;
   }
 }
 
diff --git a/src/components/ha-hls-player.ts b/src/components/ha-hls-player.ts
index f1f7a27e8e..62035fea6c 100644
--- a/src/components/ha-hls-player.ts
+++ b/src/components/ha-hls-player.ts
@@ -186,7 +186,7 @@ class HaHLSPlayer extends LitElement {
       let base_url: string;
       try {
         base_url = new URL(this._url).href;
-      } catch (error) {
+      } catch (_error) {
         base_url = new URL(this._url, window.location.href).href;
       }
       playlist_url = new URL(match[3], base_url).href;
diff --git a/src/components/ha-hs-color-picker.ts b/src/components/ha-hs-color-picker.ts
index 24f8c79110..3f50dbbcc7 100644
--- a/src/components/ha-hs-color-picker.ts
+++ b/src/components/ha-hs-color-picker.ts
@@ -57,12 +57,12 @@ function adjustRgb(
 
 function drawColorWheel(
   ctx: CanvasRenderingContext2D,
-  colorBrightness = 255,
   wv?: number,
   cw?: number,
   ww?: number,
   minKelvin?: number,
-  maxKelvin?: number
+  maxKelvin?: number,
+  colorBrightness = 255
 ) {
   const radius = ctx.canvas.width / 2;
 
@@ -160,12 +160,12 @@ class HaHsColorPicker extends LitElement {
     const ctx = this._canvas.getContext("2d")!;
     drawColorWheel(
       ctx,
-      this.colorBrightness,
       this.wv,
       this.cw,
       this.ww,
       this.minKelvin,
-      this.maxKelvin
+      this.maxKelvin,
+      this.colorBrightness
     );
   }
 
diff --git a/src/components/ha-icon-picker.ts b/src/components/ha-icon-picker.ts
index 77ceb6aba1..3ca8703b1e 100644
--- a/src/components/ha-icon-picker.ts
+++ b/src/components/ha-icon-picker.ts
@@ -60,7 +60,7 @@ const loadCustomIconItems = async (iconsetPrefix: string) => {
       keywords: icon.keywords ?? [],
     }));
     return customIconItems;
-  } catch (e) {
+  } catch (_err) {
     // eslint-disable-next-line no-console
     console.warn(`Unable to load icon list for ${iconsetPrefix} iconset`);
     return [];
diff --git a/src/components/ha-language-picker.ts b/src/components/ha-language-picker.ts
index f25f7d4814..b128393085 100644
--- a/src/components/ha-language-picker.ts
+++ b/src/components/ha-language-picker.ts
@@ -97,7 +97,7 @@ export class HaLanguagePicker extends LitElement {
                 type: "language",
                 fallback: "code",
               }).of(lang)!;
-            } catch (err) {
+            } catch (_err) {
               label = lang;
             }
           }
diff --git a/src/components/ha-mount-picker.ts b/src/components/ha-mount-picker.ts
index 61a1585b99..7dfc1495a6 100644
--- a/src/components/ha-mount-picker.ts
+++ b/src/components/ha-mount-picker.ts
@@ -146,7 +146,7 @@ class HaMountPicker extends LitElement {
           "ui.components.mount-picker.error.no_supervisor"
         );
       }
-    } catch (err: any) {
+    } catch (_err: any) {
       this._error = this.hass.localize(
         "ui.components.mount-picker.error.fetch_mounts"
       );
diff --git a/src/components/ha-push-notifications-toggle.ts b/src/components/ha-push-notifications-toggle.ts
index 98a9231b5c..495cdd5483 100644
--- a/src/components/ha-push-notifications-toggle.ts
+++ b/src/components/ha-push-notifications-toggle.ts
@@ -50,7 +50,7 @@ class HaPushNotificationsToggle extends LitElement {
         this._loading = false;
         this._pushChecked = !!subscription;
       });
-    } catch (err) {
+    } catch (_err) {
       // We don't set loading to `false` so we remain disabled
     }
   }
@@ -96,7 +96,7 @@ class HaPushNotificationsToggle extends LitElement {
       let applicationServerKey: Uint8Array | null;
       try {
         applicationServerKey = await getAppKey(this.hass);
-      } catch (ex) {
+      } catch (_err) {
         applicationServerKey = null;
       }
 
diff --git a/src/components/ha-selector/ha-selector-file.ts b/src/components/ha-selector/ha-selector-file.ts
index 21ce3bb551..8bac633fc5 100644
--- a/src/components/ha-selector/ha-selector-file.ts
+++ b/src/components/ha-selector/ha-selector-file.ts
@@ -85,7 +85,7 @@ export class HaFileSelector extends LitElement {
     this._busy = true;
     try {
       await removeFile(this.hass, this.value!);
-    } catch (err) {
+    } catch (_err) {
       // Not ideal if removal fails, but will be cleaned up later
     } finally {
       this._busy = false;
diff --git a/src/components/ha-service-control.ts b/src/components/ha-service-control.ts
index 5dd4222b23..57c5620ec9 100644
--- a/src/components/ha-service-control.ts
+++ b/src/components/ha-service-control.ts
@@ -859,7 +859,7 @@ export class HaServiceControl extends LitElement {
     this._manifest = undefined;
     try {
       this._manifest = await fetchIntegrationManifest(this.hass, integration);
-    } catch (err: any) {
+    } catch (_err: any) {
       // Ignore if loading manifest fails. Probably bad JSON in manifest
     }
   }
diff --git a/src/components/map/ha-locations-editor.ts b/src/components/map/ha-locations-editor.ts
index 0c46d79ffd..9e08a3b068 100644
--- a/src/components/map/ha-locations-editor.ts
+++ b/src/components/map/ha-locations-editor.ts
@@ -69,7 +69,8 @@ export class HaLocationsEditor extends LitElement {
 
   private Leaflet?: LeafletModuleType;
 
-  private _loadPromise: Promise;
+  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
+  private _loadPromise: Promise;
 
   constructor() {
     super();
diff --git a/src/components/trace/hat-script-graph.ts b/src/components/trace/hat-script-graph.ts
index 1bc7f057c1..dd24c88cfd 100644
--- a/src/components/trace/hat-script-graph.ts
+++ b/src/components/trace/hat-script-graph.ts
@@ -202,7 +202,7 @@ export class HatScriptGraph extends LitElement {
                     .notEnabled=${disabled || config.enabled === false}
                   >
                   ${branch.sequence !== null
-                    ? ensureArray(branch.sequence).map((action, j) =>
+                    ? ensureArray(branch.sequence).map((action, j) =>
                         this._renderActionNode(
                           action,
                           `${branchPath}/sequence/${j}`,
@@ -218,13 +218,14 @@ export class HatScriptGraph extends LitElement {
         
${config.default !== null - ? ensureArray(config.default)?.map((action, i) => - this._renderActionNode( - action, - `${path}/default/${i}`, - false, - disabled || config.enabled === false - ) + ? ensureArray(config.default)?.map( + (action, i) => + this._renderActionNode( + action, + `${path}/default/${i}`, + false, + disabled || config.enabled === false + ) ) : ""}
@@ -278,7 +279,7 @@ export class HatScriptGraph extends LitElement { .notEnabled=${disabled || config.enabled === false} nofocus >${ensureArray(config.else).map((action, j) => + >${ensureArray(config.else).map((action, j) => this._renderActionNode( action, `${path}/else/${j}`, @@ -296,7 +297,7 @@ export class HatScriptGraph extends LitElement { .notEnabled=${disabled || config.enabled === false} nofocus > - ${ensureArray(config.then ?? []).map((action, j) => + ${ensureArray(config.then ?? []).map((action, j) => this._renderActionNode( action, `${path}/then/${j}`, @@ -403,7 +404,7 @@ export class HatScriptGraph extends LitElement { .badge=${repeats > 1 ? repeats : undefined} >
- ${ensureArray(node.repeat.sequence).map((action, i) => + ${ensureArray(node.repeat.sequence).map((action, i) => this._renderActionNode( action, `${path}/repeat/sequence/${i}`, @@ -526,17 +527,18 @@ export class HatScriptGraph extends LitElement { slot="head" nofocus > - ${ensureArray(node.parallel).map((action, i) => + ${ensureArray(node.parallel).map((action, i) => "sequence" in action ? html`
- ${ensureArray((action as ManualScriptConfig).sequence).map( - (sAction, j) => - this._renderActionNode( - sAction, - `${path}/parallel/${i}/sequence/${j}`, - false, - disabled || node.enabled === false - ) + ${ensureArray( + (action as ManualScriptConfig).sequence + ).map((sAction, j) => + this._renderActionNode( + sAction, + `${path}/parallel/${i}/sequence/${j}`, + false, + disabled || node.enabled === false + ) )}
` : this._renderActionNode( @@ -601,8 +603,9 @@ export class HatScriptGraph extends LitElement { )}` : ""} ${"sequence" in this.trace.config - ? html`${ensureArray(this.trace.config.sequence).map((action, i) => - this._renderActionNode(action, `sequence/${i}`, i === 0) + ? html`${ensureArray(this.trace.config.sequence).map( + (action, i) => + this._renderActionNode(action, `sequence/${i}`, i === 0) )}` : ""}
diff --git a/src/components/trace/hat-trace-timeline.ts b/src/components/trace/hat-trace-timeline.ts index 0552074560..cfffbce232 100644 --- a/src/components/trace/hat-trace-timeline.ts +++ b/src/components/trace/hat-trace-timeline.ts @@ -266,7 +266,7 @@ class ActionRenderer { let data; try { data = getDataFromPath(this.trace.config, path); - } catch (err: any) { + } catch (_err: any) { this._renderEntry( path, this.hass.localize( diff --git a/src/data/application_credential.ts b/src/data/application_credential.ts index 8792d40b0b..ac7b36b5be 100644 --- a/src/data/application_credential.ts +++ b/src/data/application_credential.ts @@ -58,7 +58,7 @@ export const deleteApplicationCredential = async ( hass: HomeAssistant, applicationCredentialsId: string ) => - hass.callWS({ + hass.callWS({ type: "application_credentials/delete", application_credentials_id: applicationCredentialsId, }); diff --git a/src/data/assist_pipeline.ts b/src/data/assist_pipeline.ts index c978d48820..d8cff2e741 100644 --- a/src/data/assist_pipeline.ts +++ b/src/data/assist_pipeline.ts @@ -366,7 +366,7 @@ export const setAssistPipelinePreferred = ( }); export const deleteAssistPipeline = (hass: HomeAssistant, pipelineId: string) => - hass.callWS({ + hass.callWS({ type: "assist_pipeline/pipeline/delete", pipeline_id: pipelineId, }); diff --git a/src/data/auth.ts b/src/data/auth.ts index 05de154548..28840ec811 100644 --- a/src/data/auth.ts +++ b/src/data/auth.ts @@ -132,7 +132,7 @@ export const adminChangePassword = ( userId: string, password: string ) => - hass.callWS({ + hass.callWS({ type: "config/auth_provider/homeassistant/admin_change_password", user_id: userId, password, @@ -143,7 +143,7 @@ export const adminChangeUsername = ( userId: string, username: string ) => - hass.callWS({ + hass.callWS({ type: "config/auth_provider/homeassistant/admin_change_username", user_id: userId, username, diff --git a/src/data/automation.ts b/src/data/automation.ts index 49d23f069f..f00246ea58 100644 --- a/src/data/automation.ts +++ b/src/data/automation.ts @@ -366,7 +366,7 @@ export const saveAutomationConfig = ( hass: HomeAssistant, id: string, config: AutomationConfig -) => hass.callApi("POST", `config/automation/config/${id}`, config); +) => hass.callApi("POST", `config/automation/config/${id}`, config); export const normalizeAutomationConfig = < T extends Partial | AutomationConfig, diff --git a/src/data/calendar.ts b/src/data/calendar.ts index 85efa30686..17dcf48587 100644 --- a/src/data/calendar.ts +++ b/src/data/calendar.ts @@ -81,7 +81,7 @@ export const fetchCalendarEvents = async ( try { // eslint-disable-next-line no-await-in-loop result = await promise; - } catch (err) { + } catch (_err) { errors.push(calendars[idx].entity_id); continue; } @@ -154,7 +154,7 @@ export const createCalendarEvent = ( entityId: string, event: CalendarEventMutableParams ) => - hass.callWS({ + hass.callWS({ type: "calendar/event/create", entity_id: entityId, event: event, @@ -168,7 +168,7 @@ export const updateCalendarEvent = ( recurrence_id?: string, recurrence_range?: RecurrenceRange ) => - hass.callWS({ + hass.callWS({ type: "calendar/event/update", entity_id: entityId, uid, @@ -184,7 +184,7 @@ export const deleteCalendarEvent = ( recurrence_id?: string, recurrence_range?: RecurrenceRange ) => - hass.callWS({ + hass.callWS({ type: "calendar/event/delete", entity_id: entityId, uid, diff --git a/src/data/energy.ts b/src/data/energy.ts index 61802bb399..201d3c2386 100644 --- a/src/data/energy.ts +++ b/src/data/energy.ts @@ -756,8 +756,8 @@ export type EnergyGasUnitClass = (typeof energyGasUnitClass)[number]; export const getEnergyGasUnitClass = ( prefs: EnergyPreferences, - statisticsMetaData: Record = {}, - excludeSource?: string + excludeSource?: string, + statisticsMetaData: Record = {} ): EnergyGasUnitClass | undefined => { for (const source of prefs.energy_sources) { if (source.type !== "gas") { @@ -783,7 +783,7 @@ export const getEnergyGasUnit = ( prefs: EnergyPreferences, statisticsMetaData: Record = {} ): string | undefined => { - const unitClass = getEnergyGasUnitClass(prefs, statisticsMetaData); + const unitClass = getEnergyGasUnitClass(prefs, undefined, statisticsMetaData); if (unitClass === undefined) { return undefined; } diff --git a/src/data/frontend.ts b/src/data/frontend.ts index b8119a1ee4..d0217993d5 100644 --- a/src/data/frontend.ts +++ b/src/data/frontend.ts @@ -35,7 +35,7 @@ export const saveFrontendUserData = async < key: UserDataKey, value: FrontendUserData[UserDataKey] ): Promise => - conn.sendMessagePromise({ + conn.sendMessagePromise({ type: "frontend/set_user_data", key, value, diff --git a/src/data/hassio/addon.ts b/src/data/hassio/addon.ts index b5fe6970e1..07fd2eefd1 100644 --- a/src/data/hassio/addon.ts +++ b/src/data/hassio/addon.ts @@ -390,7 +390,7 @@ export const rebuildLocalAddon = async ( slug: string ): Promise => { if (atLeastVersion(hass.config.version, 2021, 2, 4)) { - return hass.callWS({ + return hass.callWS({ type: "supervisor/api", endpoint: `/addons/${slug}/rebuild`, method: "post", diff --git a/src/data/history.ts b/src/data/history.ts index 0d7497a4f0..4506097e54 100644 --- a/src/data/history.ts +++ b/src/data/history.ts @@ -237,9 +237,9 @@ export const subscribeHistoryStatesTimeWindow = ( callbackFunction: (data: HistoryStates) => void, hoursToShow: number, entityIds: string[], + noAttributes?: boolean, minimalResponse = true, - significantChangesOnly = true, - noAttributes?: boolean + significantChangesOnly = true ): Promise<() => Promise> => { const params = { type: "history/stream", diff --git a/src/data/recorder.ts b/src/data/recorder.ts index e8ca206747..b1d29c6e1c 100644 --- a/src/data/recorder.ts +++ b/src/data/recorder.ts @@ -109,7 +109,7 @@ export interface StatisticsUnitConfiguration { volume?: "L" | "gal" | "ft³" | "m³"; } -const statisticTypes = [ +const _statisticTypes = [ "change", "last_reset", "max", @@ -118,7 +118,7 @@ const statisticTypes = [ "state", "sum", ] as const; -export type StatisticsTypes = (typeof statisticTypes)[number][]; +export type StatisticsTypes = (typeof _statisticTypes)[number][]; export interface StatisticsValidationResults { [statisticId: string]: StatisticsValidationResult[]; @@ -152,6 +152,7 @@ export const fetchStatistics = ( startTime: Date, endTime?: Date, statistic_ids?: string[], + // eslint-disable-next-line default-param-last period: "5minute" | "hour" | "day" | "week" | "month" = "hour", units?: StatisticsUnitConfiguration, types?: StatisticsTypes @@ -206,14 +207,14 @@ export const updateStatisticsMetadata = ( statistic_id: string, unit_of_measurement: string | null ) => - hass.callWS({ + hass.callWS({ type: "recorder/update_statistics_metadata", statistic_id, unit_of_measurement, }); export const clearStatistics = (hass: HomeAssistant, statistic_ids: string[]) => - hass.callWS({ + hass.callWS({ type: "recorder/clear_statistics", statistic_ids, }); @@ -295,7 +296,7 @@ export const adjustStatisticsSum = ( adjustment_unit_of_measurement: string | null ): Promise => { const start_time_iso = new Date(start_time).toISOString(); - return hass.callWS({ + return hass.callWS({ type: "recorder/adjust_sum_statistics", statistic_id, start_time: start_time_iso, @@ -334,4 +335,4 @@ export const isExternalStatistic = (statisticsId: string): boolean => statisticsId.includes(":"); export const updateStatisticsIssues = (hass: HomeAssistant) => - hass.callWS({ type: "recorder/update_statistics_issues" }); + hass.callWS({ type: "recorder/update_statistics_issues" }); diff --git a/src/data/selector.ts b/src/data/selector.ts index 2514e176f7..59f14165c8 100644 --- a/src/data/selector.ts +++ b/src/data/selector.ts @@ -74,7 +74,6 @@ export type Selector = | BackupLocationSelector; export interface ActionSelector { - // eslint-disable-next-line @typescript-eslint/ban-types action: {} | null; } @@ -94,7 +93,6 @@ export interface AreaSelector { } export interface AreaFilterSelector { - // eslint-disable-next-line @typescript-eslint/ban-types area_filter: {} | null; } @@ -106,7 +104,6 @@ export interface AttributeSelector { } export interface BooleanSelector { - // eslint-disable-next-line @typescript-eslint/ban-types boolean: {} | null; } @@ -119,7 +116,6 @@ export interface ButtonToggleSelector { } export interface ColorRGBSelector { - // eslint-disable-next-line @typescript-eslint/ban-types color_rgb: {} | null; } @@ -134,7 +130,6 @@ export interface ColorTempSelector { } export interface ConditionSelector { - // eslint-disable-next-line @typescript-eslint/ban-types condition: {} | null; } @@ -164,12 +159,10 @@ export interface CountrySelector { } export interface DateSelector { - // eslint-disable-next-line @typescript-eslint/ban-types date: {} | null; } export interface DateTimeSelector { - // eslint-disable-next-line @typescript-eslint/ban-types datetime: {} | null; } @@ -309,7 +302,6 @@ export interface LocationSelectorValue { } export interface MediaSelector { - // eslint-disable-next-line @typescript-eslint/ban-types media: {} | null; } @@ -327,7 +319,6 @@ export interface MediaSelectorValue { } export interface NavigationSelector { - // eslint-disable-next-line @typescript-eslint/ban-types navigation: {} | null; } @@ -343,7 +334,6 @@ export interface NumberSelector { } export interface ObjectSelector { - // eslint-disable-next-line @typescript-eslint/ban-types object: {} | null; } @@ -372,7 +362,6 @@ export interface SelectSelector { } export interface SelectorSelector { - // eslint-disable-next-line @typescript-eslint/ban-types selector: {} | null; } @@ -385,7 +374,6 @@ export interface StateSelector { } export interface BackupLocationSelector { - // eslint-disable-next-line @typescript-eslint/ban-types backup_location: {} | null; } @@ -434,7 +422,6 @@ export interface TargetSelector { } export interface TemplateSelector { - // eslint-disable-next-line @typescript-eslint/ban-types template: {} | null; } @@ -446,7 +433,6 @@ export interface TimeSelector { } export interface TriggerSelector { - // eslint-disable-next-line @typescript-eslint/ban-types trigger: {} | null; } diff --git a/src/data/tag.ts b/src/data/tag.ts index 297712db0d..ee61a97ad4 100644 --- a/src/data/tag.ts +++ b/src/data/tag.ts @@ -51,7 +51,7 @@ export const updateTag = async ( }); export const deleteTag = async (hass: HomeAssistant, tagId: string) => - hass.callWS({ + hass.callWS({ type: "tag/delete", tag_id: tagId, }); diff --git a/src/data/user.ts b/src/data/user.ts index 6c9d5e4c88..6b7f6809fd 100644 --- a/src/data/user.ts +++ b/src/data/user.ts @@ -63,7 +63,7 @@ export const updateUser = async ( }); export const deleteUser = async (hass: HomeAssistant, userId: string) => - hass.callWS({ + hass.callWS({ type: "config/auth/delete", user_id: userId, }); diff --git a/src/data/zwave_js.ts b/src/data/zwave_js.ts index 6f203b6658..981426a013 100644 --- a/src/data/zwave_js.ts +++ b/src/data/zwave_js.ts @@ -501,11 +501,11 @@ export const subscribeAddZwaveNode = ( hass: HomeAssistant, entry_id: string, callbackFunction: (message: any) => void, - inclusion_strategy: InclusionStrategy = InclusionStrategy.Default, qr_provisioning_information?: QRProvisioningInformation, qr_code_string?: string, planned_provisioning_entry?: PlannedProvisioningEntry, - dsk?: string + dsk?: string, + inclusion_strategy: InclusionStrategy = InclusionStrategy.Default ): Promise => hass.connection.subscribeMessage((message) => callbackFunction(message), { type: "zwave_js/add_node", diff --git a/src/dialogs/area-filter/area-filter-dialog.ts b/src/dialogs/area-filter/area-filter-dialog.ts index 68b2b2ae2d..56fce665b3 100644 --- a/src/dialogs/area-filter/area-filter-dialog.ts +++ b/src/dialogs/area-filter/area-filter-dialog.ts @@ -39,11 +39,12 @@ export class DialogAreaFilter this._areas = allAreas.concat().sort(areaCompare(this.hass!.areas, order)); } - public closeDialog(): void { + public closeDialog() { this._dialogParams = undefined; this._hidden = []; this._areas = []; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } private _submit(): void { diff --git a/src/dialogs/enter-code/dialog-enter-code.ts b/src/dialogs/enter-code/dialog-enter-code.ts index 646ae9373b..75986b6c06 100644 --- a/src/dialogs/enter-code/dialog-enter-code.ts +++ b/src/dialogs/enter-code/dialog-enter-code.ts @@ -46,10 +46,11 @@ export class DialogEnterCode await this.updateComplete; } - public closeDialog(): void { + public closeDialog() { this._dialogParams = undefined; this._showClearButton = false; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } private _submit(): void { diff --git a/src/dialogs/make-dialog-manager.ts b/src/dialogs/make-dialog-manager.ts index 1c0f954a14..f34d22c310 100644 --- a/src/dialogs/make-dialog-manager.ts +++ b/src/dialogs/make-dialog-manager.ts @@ -22,7 +22,7 @@ declare global { export interface HassDialog extends HTMLElement { showDialog(params: T); - closeDialog?: () => boolean | void; + closeDialog?: () => boolean; } interface ShowDialogParams { diff --git a/src/dialogs/more-info/controls/more-info-camera.ts b/src/dialogs/more-info/controls/more-info-camera.ts index 0a9a6e6339..57c7d53211 100644 --- a/src/dialogs/more-info/controls/more-info-camera.ts +++ b/src/dialogs/more-info/controls/more-info-camera.ts @@ -78,7 +78,7 @@ class MoreInfoCamera extends LitElement { const blob = await result.blob(); const url = window.URL.createObjectURL(blob); fileDownload(url, filename); - } catch (err) { + } catch (_err) { this._waiting = false; button.actionError(); showToast(this, { diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index c37e337aa3..bbed61f31c 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -126,7 +126,7 @@ export class MoreInfoDialog extends LitElement { this.hass, this._entityId ); - } catch (e) { + } catch (_e) { this._entry = null; } } diff --git a/src/dialogs/more-info/ha-more-info-history.ts b/src/dialogs/more-info/ha-more-info-history.ts index 1afcf59f86..68ef6dfc05 100644 --- a/src/dialogs/more-info/ha-more-info-history.ts +++ b/src/dialogs/more-info/ha-more-info-history.ts @@ -48,7 +48,7 @@ export class MoreInfoHistory extends LitElement { private _interval?: number; - private _subscribed?: Promise<(() => Promise) | void>; + private _subscribed?: Promise<(() => Promise) | undefined>; private _error?: string; @@ -239,6 +239,7 @@ export class MoreInfoHistory extends LitElement { ).catch((err) => { this._subscribed = undefined; this._error = err; + return undefined; }); this._setRedrawTimer(); } diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts index 9791fc00b5..2f482e770d 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts @@ -368,7 +368,7 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement { let i = 1; while ( pipelines.pipelines.find( - // eslint-disable-next-line @typescript-eslint/no-loop-func + // eslint-disable-next-line no-loop-func (pipeline) => pipeline.name === pipelineName ) ) { diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts index 7306fb1d00..ddab2e8c03 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts @@ -262,7 +262,7 @@ export class HaVoiceAssistantSetupStepPipeline extends LitElement { let i = 1; while ( pipelines.pipelines.find( - // eslint-disable-next-line @typescript-eslint/no-loop-func + // eslint-disable-next-line no-loop-func (pipeline) => pipeline.name === pipelineName ) ) { diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts index 7cf4ed8869..d6416e312d 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts @@ -234,7 +234,7 @@ export class HaVoiceAssistantSetupStepSuccess extends LitElement { const result = await getTranslation(null, pipeline.language, false); this._announce(result.data["ui.dialogs.tts-try.message_example"]); return; - } catch (e) { + } catch (_e) { // ignore fallback to user language } } diff --git a/src/external_app/external_auth.ts b/src/external_app/external_auth.ts index 4bcefac41d..b47e62ed19 100644 --- a/src/external_app/external_auth.ts +++ b/src/external_app/external_auth.ts @@ -72,7 +72,7 @@ export class ExternalAuth extends Auth { try { await this._tokenCallbackPromise; return; - } catch (err: any) { + } catch (_err: any) { // _tokenCallbackPromise is in a rejected state // Clear the _tokenCallbackPromise and go on refreshing access token this._tokenCallbackPromise = undefined; diff --git a/src/fake_data/provide_hass.ts b/src/fake_data/provide_hass.ts index f64e915523..a0767d88c4 100644 --- a/src/fake_data/provide_hass.ts +++ b/src/fake_data/provide_hass.ts @@ -151,23 +151,15 @@ export const provideHass = ( restResponses.push([path, callback]); } - mockAPI( - /states\/.+/, - ( - // @ts-ignore - method, - path, - parameters - ) => { - const [domain, objectId] = path.substr(7).split(".", 2); - if (!domain || !objectId) { - return; - } - addEntities( - getEntity(domain, objectId, parameters.state, parameters.attributes) - ); + mockAPI(/states\/.+/, (_method, path, parameters) => { + const [domain, objectId] = path.substr(7).split(".", 2); + if (!domain || !objectId) { + return; } - ); + addEntities( + getEntity(domain, objectId, parameters.state, parameters.attributes) + ); + }); const localLanguage = getLocalLanguage(); const noop = () => undefined; diff --git a/src/layouts/home-assistant.ts b/src/layouts/home-assistant.ts index ab42380634..03a0cd2fbe 100644 --- a/src/layouts/home-assistant.ts +++ b/src/layouts/home-assistant.ts @@ -246,7 +246,7 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) { const { auth, conn } = result; this._haVersion = conn.haVersion; this.initializeHass(auth, conn); - } catch (err: any) { + } catch (_err: any) { this._renderInitInfo(true); } } diff --git a/src/onboarding/ha-onboarding.ts b/src/onboarding/ha-onboarding.ts index 5c82e575d8..25012234ba 100644 --- a/src/onboarding/ha-onboarding.ts +++ b/src/onboarding/ha-onboarding.ts @@ -323,7 +323,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) { } this._steps = steps; - } catch (err: any) { + } catch (_err: any) { alert("Something went wrong loading onboarding, try refreshing"); } } @@ -370,7 +370,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) { saveTokens, }); await this._connectHass(auth); - } catch (err: any) { + } catch (_err: any) { alert("Ah snap, something went wrong!"); location.reload(); } finally { @@ -486,7 +486,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) { "selectedLanguage", JSON.stringify(language) ); - } catch (err: any) { + } catch (_err: any) { // Ignore } } diff --git a/src/panels/calendar/dialog-calendar-event-detail.ts b/src/panels/calendar/dialog-calendar-event-detail.ts index 278aff9d22..4644b74fa3 100644 --- a/src/panels/calendar/dialog-calendar-event-detail.ts +++ b/src/panels/calendar/dialog-calendar-event-detail.ts @@ -132,7 +132,7 @@ class DialogCalendarEventDetail extends LitElement { return html`
${ruleText}
`; } return html`
Cannot convert recurrence rule
`; - } catch (e) { + } catch (_e) { return "Error while processing the rule"; } } diff --git a/src/panels/calendar/ha-recurrence-rule-editor.ts b/src/panels/calendar/ha-recurrence-rule-editor.ts index 20868b35cb..f5aa8c76cf 100644 --- a/src/panels/calendar/ha-recurrence-rule-editor.ts +++ b/src/panels/calendar/ha-recurrence-rule-editor.ts @@ -138,7 +138,7 @@ export class RecurrenceRuleEditor extends LitElement { let rrule: Partial | undefined; try { rrule = RRule.parseString(this.value); - } catch (ex) { + } catch (_err) { // unsupported rrule string this._freq = undefined; return; diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index 6496a5da63..4e9920d086 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -126,7 +126,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { ).matches; } - public closeDialog(): void { + public closeDialog() { if (this._params) { fireEvent(this, "dialog-closed", { dialog: this.localName }); } @@ -138,6 +138,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { this._filter = ""; this._manifests = undefined; this._domains = undefined; + return true; } private _getGroups = ( diff --git a/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts b/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts index 25fdfaa7bf..fb04d3262b 100644 --- a/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts +++ b/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts @@ -45,13 +45,14 @@ class DialogAutomationMode extends LitElement implements HassDialog { : undefined; } - public closeDialog(): void { + public closeDialog() { this._params.onClose(); if (this._opened) { fireEvent(this, "dialog-closed", { dialog: this.localName }); } this._opened = false; + return true; } protected render() { diff --git a/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts b/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts index d484b75278..177c957402 100644 --- a/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts +++ b/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts @@ -72,7 +72,7 @@ class DialogAutomationRename extends LitElement implements HassDialog { ]; } - public closeDialog(): void { + public closeDialog() { this._params.onClose(); if (this._opened) { @@ -80,6 +80,7 @@ class DialogAutomationRename extends LitElement implements HassDialog { } this._opened = false; this._visibleOptionals = []; + return true; } protected _renderOptionalChip(id: string, label: string) { diff --git a/src/panels/config/automation/dialog-new-automation.ts b/src/panels/config/automation/dialog-new-automation.ts index 02694132ca..8429515308 100644 --- a/src/panels/config/automation/dialog-new-automation.ts +++ b/src/panels/config/automation/dialog-new-automation.ts @@ -61,11 +61,12 @@ class DialogNewAutomation extends LitElement implements HassDialog { }); } - public closeDialog(): void { + public closeDialog() { if (this._opened) { fireEvent(this, "dialog-closed", { dialog: this.localName }); } this._opened = false; + return true; } private _processedBlueprints = memoizeOne((blueprints?: Blueprints) => { diff --git a/src/panels/config/backup/components/config/ha-backup-config-data.ts b/src/panels/config/backup/components/config/ha-backup-config-data.ts index 23786dc258..345ff8449e 100644 --- a/src/panels/config/backup/components/config/ha-backup-config-data.ts +++ b/src/panels/config/backup/components/config/ha-backup-config-data.ts @@ -55,7 +55,7 @@ export type BackupConfigData = { declare global { interface HASSDomEvents { - "backup-addons-fetched": void; + "backup-addons-fetched": undefined; } } diff --git a/src/panels/config/backup/dialogs/dialog-backup-onboarding.ts b/src/panels/config/backup/dialogs/dialog-backup-onboarding.ts index 3944e1316e..68f73df823 100644 --- a/src/panels/config/backup/dialogs/dialog-backup-onboarding.ts +++ b/src/panels/config/backup/dialogs/dialog-backup-onboarding.ts @@ -116,7 +116,7 @@ class DialogBackupOnboarding extends LitElement implements HassDialog { this._opened = true; } - public closeDialog(): void { + public closeDialog() { if (this._params!.cancel) { this._params!.cancel(); } @@ -127,6 +127,7 @@ class DialogBackupOnboarding extends LitElement implements HassDialog { this._step = undefined; this._config = undefined; this._params = undefined; + return true; } private get _firstStep(): Step { diff --git a/src/panels/config/backup/dialogs/dialog-change-backup-encryption-key.ts b/src/panels/config/backup/dialogs/dialog-change-backup-encryption-key.ts index e140c4528e..9c55bbfe6e 100644 --- a/src/panels/config/backup/dialogs/dialog-change-backup-encryption-key.ts +++ b/src/panels/config/backup/dialogs/dialog-change-backup-encryption-key.ts @@ -48,7 +48,7 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog { this._newEncryptionKey = generateEncryptionKey(); } - public closeDialog(): void { + public closeDialog() { if (this._params!.cancel) { this._params!.cancel(); } @@ -59,6 +59,7 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog { this._step = undefined; this._params = undefined; this._newEncryptionKey = undefined; + return true; } private _done() { diff --git a/src/panels/config/backup/dialogs/dialog-generate-backup.ts b/src/panels/config/backup/dialogs/dialog-generate-backup.ts index 9334d7e191..d0ffe909eb 100644 --- a/src/panels/config/backup/dialogs/dialog-generate-backup.ts +++ b/src/panels/config/backup/dialogs/dialog-generate-backup.ts @@ -115,6 +115,7 @@ class DialogGenerateBackup extends LitElement implements HassDialog { public closeDialog() { this._dialog?.close(); + return true; } private _previousStep() { diff --git a/src/panels/config/backup/dialogs/dialog-new-backup.ts b/src/panels/config/backup/dialogs/dialog-new-backup.ts index 7b608fba33..82927c07a8 100644 --- a/src/panels/config/backup/dialogs/dialog-new-backup.ts +++ b/src/panels/config/backup/dialogs/dialog-new-backup.ts @@ -31,8 +31,9 @@ class DialogNewBackup extends LitElement implements HassDialog { this._params = params; } - public closeDialog(): void { + public closeDialog() { this._dialog?.close(); + return true; } private _dialogClosed() { diff --git a/src/panels/config/backup/dialogs/dialog-restore-backup.ts b/src/panels/config/backup/dialogs/dialog-restore-backup.ts index 2620cf5ec5..55e1621482 100644 --- a/src/panels/config/backup/dialogs/dialog-restore-backup.ts +++ b/src/panels/config/backup/dialogs/dialog-restore-backup.ts @@ -90,6 +90,7 @@ class DialogRestoreBackup extends LitElement implements HassDialog { public closeDialog() { this._dialog?.close(); + return true; } private _dialogClosed() { diff --git a/src/panels/config/backup/dialogs/dialog-set-backup-encryption-key.ts b/src/panels/config/backup/dialogs/dialog-set-backup-encryption-key.ts index 03ed6c0b87..de0c3e7004 100644 --- a/src/panels/config/backup/dialogs/dialog-set-backup-encryption-key.ts +++ b/src/panels/config/backup/dialogs/dialog-set-backup-encryption-key.ts @@ -48,7 +48,7 @@ class DialogSetBackupEncryptionKey extends LitElement implements HassDialog { this._newEncryptionKey = generateEncryptionKey(); } - public closeDialog(): void { + public closeDialog() { if (this._params!.cancel) { this._params!.cancel(); } @@ -59,6 +59,7 @@ class DialogSetBackupEncryptionKey extends LitElement implements HassDialog { this._step = undefined; this._params = undefined; this._newEncryptionKey = undefined; + return true; } private _done() { diff --git a/src/panels/config/backup/dialogs/dialog-show-backup-encryption-key.ts b/src/panels/config/backup/dialogs/dialog-show-backup-encryption-key.ts index 283d4fc082..9a5bda4bbf 100644 --- a/src/panels/config/backup/dialogs/dialog-show-backup-encryption-key.ts +++ b/src/panels/config/backup/dialogs/dialog-show-backup-encryption-key.ts @@ -32,9 +32,10 @@ class DialogShowBackupEncryptionKey extends LitElement implements HassDialog { this._params = params; } - public closeDialog(): void { + public closeDialog() { this._params = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } private _closeDialog() { diff --git a/src/panels/config/backup/dialogs/dialog-upload-backup.ts b/src/panels/config/backup/dialogs/dialog-upload-backup.ts index 09574357ab..7356f9df34 100644 --- a/src/panels/config/backup/dialogs/dialog-upload-backup.ts +++ b/src/panels/config/backup/dialogs/dialog-upload-backup.ts @@ -65,6 +65,7 @@ export class DialogUploadBackup public closeDialog() { this._dialog?.close(); + return true; } private _formValid() { diff --git a/src/panels/config/backup/dialogs/show-dialog-upload-backup.ts b/src/panels/config/backup/dialogs/show-dialog-upload-backup.ts index 6482af7803..bc5dd53671 100644 --- a/src/panels/config/backup/dialogs/show-dialog-upload-backup.ts +++ b/src/panels/config/backup/dialogs/show-dialog-upload-backup.ts @@ -11,7 +11,7 @@ export const showUploadBackupDialog = ( element: HTMLElement, params: UploadBackupDialogParams ) => - new Promise((resolve) => { + new Promise((resolve) => { const origCancel = params.cancel; const origSubmit = params.submit; fireEvent(element, "show-dialog", { @@ -26,7 +26,7 @@ export const showUploadBackupDialog = ( } }, submit: () => { - resolve(); + resolve(undefined); if (origSubmit) { origSubmit(); } diff --git a/src/panels/config/core/updates/dialog-join-beta.ts b/src/panels/config/core/updates/dialog-join-beta.ts index 7b4d7381c5..120ee48a9e 100644 --- a/src/panels/config/core/updates/dialog-join-beta.ts +++ b/src/panels/config/core/updates/dialog-join-beta.ts @@ -25,9 +25,10 @@ export class DialogJoinBeta this._dialogParams = dialogParams; } - public closeDialog(): void { + public closeDialog() { this._dialogParams = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/dashboard/dialog-new-dashboard.ts b/src/panels/config/dashboard/dialog-new-dashboard.ts index 41aa27f013..2207efdadf 100644 --- a/src/panels/config/dashboard/dialog-new-dashboard.ts +++ b/src/panels/config/dashboard/dialog-new-dashboard.ts @@ -45,12 +45,13 @@ class DialogNewDashboard extends LitElement implements HassDialog { this._params = params; } - public closeDialog(): void { + public closeDialog() { if (this._opened) { fireEvent(this, "dialog-closed", { dialog: this.localName }); } this._opened = false; this._params = undefined; + return true; } protected render() { diff --git a/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts b/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts index 59a9205da9..c5f76bbb8a 100644 --- a/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts +++ b/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts @@ -41,7 +41,7 @@ export class HaDeviceInfoMatter extends SubscribeMixin(LitElement) { this.hass, this.device.id ); - } catch (err: any) { + } catch (_err: any) { this._nodeDiagnostics = undefined; } } diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts index 4e6801b1b7..be65215bf9 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts @@ -113,7 +113,7 @@ class MQTTMessages extends LitElement { if (typeof payload === "string") { try { o = JSON.parse(payload); - } catch (err: any) { + } catch (_err: any) { o = null; } } diff --git a/src/panels/config/energy/components/ha-energy-gas-settings.ts b/src/panels/config/energy/components/ha-energy-gas-settings.ts index 463a0bb2ec..e3be87f220 100644 --- a/src/panels/config/energy/components/ha-energy-gas-settings.ts +++ b/src/panels/config/energy/components/ha-energy-gas-settings.ts @@ -135,6 +135,7 @@ export class EnergyGasSettings extends LitElement { showEnergySettingsGasDialog(this, { allowedGasUnitClass: getEnergyGasUnitClass( this.preferences, + undefined, this.statsMetadata ), gas_sources: this.preferences.energy_sources.filter( @@ -157,8 +158,8 @@ export class EnergyGasSettings extends LitElement { source: { ...origSource }, allowedGasUnitClass: getEnergyGasUnitClass( this.preferences, - this.statsMetadata, - origSource.stat_energy_from + origSource.stat_energy_from, + this.statsMetadata ), metadata: this.statsMetadata?.[origSource.stat_energy_from], gas_sources: this.preferences.energy_sources.filter( diff --git a/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts index 17db58d004..745713ad85 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts @@ -58,12 +58,13 @@ export class DialogEnergyBatterySettings ); } - public closeDialog(): void { + public closeDialog() { this._params = undefined; this._source = undefined; this._error = undefined; this._excludeList = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts index 3852ea6038..b58f5f4c46 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts @@ -49,12 +49,13 @@ export class DialogEnergyDeviceSettings .filter((id) => id !== this._device?.stat_consumption); } - public closeDialog(): void { + public closeDialog() { this._params = undefined; this._device = undefined; this._error = undefined; this._excludeList = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts index c680e0c78a..7cbaf1eb3d 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts @@ -83,13 +83,14 @@ export class DialogEnergyGasSettings .filter((id) => id !== this._source?.stat_energy_from); } - public closeDialog(): void { + public closeDialog() { this._params = undefined; this._source = undefined; this._pickedDisplayUnit = undefined; this._error = undefined; this._excludeList = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts index 4564d009da..dedc4ffb9a 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts @@ -100,13 +100,14 @@ export class DialogEnergyGridFlowSettings ].filter((id) => id !== initialSourceId); } - public closeDialog(): void { + public closeDialog() { this._params = undefined; this._source = undefined; this._pickedDisplayUnit = undefined; this._error = undefined; this._excludeList = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts index c261337a76..cc63e33b2f 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts @@ -66,12 +66,13 @@ export class DialogEnergySolarSettings .filter((id) => id !== this._source?.stat_energy_from); } - public closeDialog(): void { + public closeDialog() { this._params = undefined; this._source = undefined; this._error = undefined; this._excludeList = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/energy/dialogs/dialog-energy-water-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-water-settings.ts index 0fe89688b2..85a857219e 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-water-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-water-settings.ts @@ -75,13 +75,14 @@ export class DialogEnergyWaterSettings .filter((id) => id !== this._source?.stat_energy_from); } - public closeDialog(): void { + public closeDialog() { this._params = undefined; this._source = undefined; this._error = undefined; this._pickedDisplayUnit = undefined; this._excludeList = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/entities/entity-registry-settings-editor.ts b/src/panels/config/entities/entity-registry-settings-editor.ts index 44c1e04d99..a1dd3777ab 100644 --- a/src/panels/config/entities/entity-registry-settings-editor.ts +++ b/src/panels/config/entities/entity-registry-settings-editor.ts @@ -1160,7 +1160,7 @@ export class EntityRegistrySettingsEditor extends LitElement { ); showMoreInfoDialog(parent, { entityId: entry.entity_id }); close = false; - } catch (err) { + } catch (_err) { // ignore } } @@ -1226,7 +1226,7 @@ export class EntityRegistrySettingsEditor extends LitElement { ); showMoreInfoDialog(parent, { entityId: entry.entity_id }); close = false; - } catch (err) { + } catch (_err) { // ignore } } diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index a4e98a7fd4..26dc31f7a4 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -71,7 +71,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { this._helperConfigEntry = configEntry; } // eslint-disable-next-line no-empty - } catch (err) {} + } catch (_err) {} } protected render() { diff --git a/src/panels/config/hardware/dialog-hardware-available.ts b/src/panels/config/hardware/dialog-hardware-available.ts index 0509bef4bb..328374f579 100644 --- a/src/panels/config/hardware/dialog-hardware-available.ts +++ b/src/panels/config/hardware/dialog-hardware-available.ts @@ -61,9 +61,10 @@ class DialogHardwareAvailable extends LitElement implements HassDialog { } } - public closeDialog(): void { + public closeDialog() { this._hardware = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index 65968928ca..a01b1e015b 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -1039,7 +1039,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { this.hass, this.domain ); - } catch (err: any) { + } catch (_err: any) { // No issue, as diagnostics are not required } } @@ -1310,7 +1310,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { try { return (await fetchApplicationCredentialsConfigEntry(this.hass, entryId)) .application_credentials_id; - } catch (err: any) { + } catch (_err: any) { // We won't prompt the user to remove credentials return null; } diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts index a5d2fb8ede..b4ce0b7e68 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts @@ -120,7 +120,7 @@ class DialogMatterAddDevice extends LitElement { try { this._step = "commissioning"; await commissionMatterDevice(this.hass, code); - } catch (err) { + } catch (_err) { showToast(this, { message: this.hass.localize( "ui.dialogs.matter-add-device.add_device_failed" diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts index 9e81f43926..59126094f8 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts @@ -96,7 +96,7 @@ class DialogMatterManageFabrics extends LitElement { this.hass, this.device_id ); - } catch (err: any) { + } catch (_err: any) { this._nodeDiagnostics = undefined; } } @@ -127,7 +127,7 @@ class DialogMatterManageFabrics extends LitElement { try { await removeMatterFabric(this.hass, this.device_id!, fabric.fabric_index); this._fetchNodeDetails(); - } catch (err: any) { + } catch (_err: any) { showAlertDialog(this, { title: this.hass.localize( "ui.panel.config.matter.manage_fabrics.remove_fabric_failed_header", diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts index 3b54ce9aa8..c338bb8d95 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts @@ -172,7 +172,7 @@ class DialogMatterOpenCommissioningWindow extends LitElement { this.hass, this.device_id! ); - } catch (e) { + } catch (_e) { this._status = "failed"; } } diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts index dff0a6a89c..6cd2f9e42b 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts @@ -143,7 +143,7 @@ class DialogMatterPingNode extends LitElement { } this._pingResultEntries = pingResultEntries; - } catch (err) { + } catch (_err) { this._status = "failed"; } } diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts index eecf994a66..fb23ec0b57 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts @@ -133,7 +133,7 @@ class DialogMatterReinterviewNode extends LitElement { try { await interviewMatterNode(this.hass, this.device_id!); this._status = "finished"; - } catch (err) { + } catch (_err) { this._status = "failed"; } } diff --git a/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts b/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts index 93ed666da7..55aeca816e 100644 --- a/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts +++ b/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts @@ -170,7 +170,7 @@ class MqttSubscribeCard extends LitElement { if (this._json_format) { try { payload = JSON.stringify(JSON.parse(message.payload), null, 4); - } catch (err: any) { + } catch (_err: any) { payload = message.payload; } } else { diff --git a/src/panels/config/integrations/integration-panels/thread/dialog-thread-dataset.ts b/src/panels/config/integrations/integration-panels/thread/dialog-thread-dataset.ts index 4b2d8028bb..55ce8af7d3 100644 --- a/src/panels/config/integrations/integration-panels/thread/dialog-thread-dataset.ts +++ b/src/panels/config/integrations/integration-panels/thread/dialog-thread-dataset.ts @@ -18,9 +18,10 @@ class DialogThreadDataset extends LitElement implements HassDialog { this._params = params; } - public closeDialog(): void { + public closeDialog() { this._params = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts b/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts index 5308c367fa..90b69dc114 100644 --- a/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts +++ b/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts @@ -446,7 +446,7 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) { } try { this._otbrInfo = await getOTBRInfo(this.hass); - } catch (err) { + } catch (_err) { this._otbrInfo = undefined; } } diff --git a/src/panels/config/integrations/integration-panels/zha/dialog-zha-change-channel.ts b/src/panels/config/integrations/integration-panels/zha/dialog-zha-change-channel.ts index 2e5cafb7ac..fe1980e466 100644 --- a/src/panels/config/integrations/integration-panels/zha/dialog-zha-change-channel.ts +++ b/src/panels/config/integrations/integration-panels/zha/dialog-zha-change-channel.ts @@ -50,10 +50,11 @@ class DialogZHAChangeChannel extends LitElement implements HassDialog { this._newChannel = "auto"; } - public closeDialog(): void { + public closeDialog() { this._params = undefined; this._newChannel = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render(): TemplateResult | typeof nothing { diff --git a/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts b/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts index 6cd8a3acd8..709d1e0db6 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts @@ -212,7 +212,7 @@ export class ZHAClusterAttributes extends LitElement { this._attributeValue = await readAttributeValue(this.hass, data); forwardHaptic("success"); button.actionSuccess(); - } catch (err: any) { + } catch (_err: any) { forwardHaptic("failure"); button.actionError(); } finally { diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts index 466cfbc49e..9f532f868d 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts @@ -95,7 +95,7 @@ export class ZHADeviceBindingControl extends LitElement { try { await bindDevices(this.hass, this.device.ieee, this._deviceToBind.ieee); button.actionSuccess(); - } catch (err: any) { + } catch (_err: any) { button.actionError(); } finally { this._bindingOperationInProgress = false; @@ -116,7 +116,7 @@ export class ZHADeviceBindingControl extends LitElement { this._deviceToBind.ieee ); button.actionSuccess(); - } catch (err: any) { + } catch (_err: any) { button.actionError(); } finally { this._bindingOperationInProgress = false; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts b/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts index 33547286d1..38465b27b3 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts @@ -130,7 +130,7 @@ export class ZHAGroupBindingControl extends LitElement { ); this._zhaClustersDataTable.clearSelection(); button.actionSuccess(); - } catch (err: any) { + } catch (_err: any) { button.actionError(); } finally { this._bindingOperationInProgress = false; @@ -153,7 +153,7 @@ export class ZHAGroupBindingControl extends LitElement { ); this._zhaClustersDataTable.clearSelection(); button.actionSuccess(); - } catch (err: any) { + } catch (_err: any) { button.actionError(); } finally { this._bindingOperationInProgress = false; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts index c7a3ccddca..fd74444f7b 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts @@ -849,11 +849,11 @@ class DialogZWaveJSAddNode extends LitElement { } } }, - this._inclusionStrategy, qrProvisioningInformation, undefined, undefined, - dsk + dsk, + this._inclusionStrategy ).catch((err) => { this._error = err.message; this._status = "failed"; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts index 9224871b37..2732d0778c 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts @@ -25,7 +25,7 @@ class DialogZWaveJSRemoveFailedNode extends LitElement { @state() private _node?: ZWaveJSRemovedNode; - private _subscribed?: Promise; + private _subscribed?: Promise; public disconnectedCallback(): void { super.disconnectedCallback(); @@ -166,6 +166,7 @@ class DialogZWaveJSRemoveFailedNode extends LitElement { ).catch((error) => { this._status = "failed"; this._error = error; + return undefined; }); } diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts index 6859413fe2..5855f0aeb3 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts @@ -543,7 +543,7 @@ class ZWaveJSNodeConfig extends LitElement { await this._fetchData(); progressButton.actionSuccess(); - } catch (err: any) { + } catch (_err: any) { fireEvent(this, "hass-notification", { message: this.hass.localize( "ui.panel.config.zwave_js.node_config.reset_to_default.dialog.text_error" diff --git a/src/panels/config/labels/dialog-label-detail.ts b/src/panels/config/labels/dialog-label-detail.ts index d1ec77c2e3..8832808501 100644 --- a/src/panels/config/labels/dialog-label-detail.ts +++ b/src/panels/config/labels/dialog-label-detail.ts @@ -64,10 +64,11 @@ class DialogLabelDetail } }; - public closeDialog(): void { + public closeDialog() { this._params = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); document.body.removeEventListener("keydown", this._handleKeyPress); + return true; } protected render() { diff --git a/src/panels/config/labels/ha-config-labels.ts b/src/panels/config/labels/ha-config-labels.ts index b97cb8c5bd..004cdefb72 100644 --- a/src/panels/config/labels/ha-config-labels.ts +++ b/src/panels/config/labels/ha-config-labels.ts @@ -338,7 +338,7 @@ export class HaConfigLabels extends LitElement { (label) => label.label_id !== selectedLabel.label_id ); return true; - } catch (err: any) { + } catch (_err: any) { return false; } } diff --git a/src/panels/config/logs/dialog-system-log-detail.ts b/src/panels/config/logs/dialog-system-log-detail.ts index b31a49ca14..30c469de0a 100644 --- a/src/panels/config/logs/dialog-system-log-detail.ts +++ b/src/panels/config/logs/dialog-system-log-detail.ts @@ -195,7 +195,7 @@ class DialogSystemLogDetail extends LitElement { private async _fetchManifest(integration: string) { try { this._manifest = await fetchIntegrationManifest(this.hass, integration); - } catch (err: any) { + } catch (_err: any) { // Ignore if loading manifest fails. Probably bad JSON in manifest } } diff --git a/src/panels/config/logs/ha-config-logs.ts b/src/panels/config/logs/ha-config-logs.ts index 9443be0f06..4492fa07b5 100644 --- a/src/panels/config/logs/ha-config-logs.ts +++ b/src/panels/config/logs/ha-config-logs.ts @@ -221,7 +221,7 @@ export class HaConfigLogs extends LitElement { name: addon.name, })), ]; - } catch (err) { + } catch (_err) { // Ignore, nothing the user can do anyway } } diff --git a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts index 4169145d11..d1e0f7e866 100644 --- a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts +++ b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts @@ -453,7 +453,7 @@ export class HaConfigLovelaceDashboards extends LitElement { (res) => res !== dashboard ); return true; - } catch (err: any) { + } catch (_err: any) { return false; } }, diff --git a/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts b/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts index 436ea07d5c..73a7847f91 100644 --- a/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts +++ b/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts @@ -284,7 +284,7 @@ export class HaConfigLovelaceRescources extends LitElement { confirm: () => location.reload(), }); return true; - } catch (err: any) { + } catch (_err: any) { return false; } }; diff --git a/src/panels/config/person/dialog-person-detail.ts b/src/panels/config/person/dialog-person-detail.ts index a8c9d2638f..e1de5e1baa 100644 --- a/src/panels/config/person/dialog-person-detail.ts +++ b/src/panels/config/person/dialog-person-detail.ts @@ -115,6 +115,7 @@ class DialogPersonDetail extends LitElement implements HassDialog { } this._params = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/person/ha-config-person.ts b/src/panels/config/person/ha-config-person.ts index 04c87b1c21..72a2c39a3c 100644 --- a/src/panels/config/person/ha-config-person.ts +++ b/src/panels/config/person/ha-config-person.ts @@ -268,7 +268,7 @@ export class HaConfigPerson extends LitElement { (ent) => ent !== entry ); return true; - } catch (err: any) { + } catch (_err: any) { return false; } }, diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts index 23eaea4601..57159669b8 100644 --- a/src/panels/config/scene/ha-scene-editor.ts +++ b/src/panels/config/scene/ha-scene-editor.ts @@ -1152,7 +1152,7 @@ export class HaSceneEditor extends PreventUnsavedMixin( scene = this.scenes.find( (entity: SceneEntity) => entity.attributes.id === id ); - } catch (err) { + } catch (_err) { // We do nothing. } finally { this._scenesSet = undefined; diff --git a/src/panels/config/tags/dialog-tag-detail.ts b/src/panels/config/tags/dialog-tag-detail.ts index 85fe776460..9f853dfef0 100644 --- a/src/panels/config/tags/dialog-tag-detail.ts +++ b/src/panels/config/tags/dialog-tag-detail.ts @@ -45,9 +45,10 @@ class DialogTagDetail } } - public closeDialog(): void { + public closeDialog() { this._params = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/config/tags/ha-config-tags.ts b/src/panels/config/tags/ha-config-tags.ts index 055ca230a5..6bbcc4d76a 100644 --- a/src/panels/config/tags/ha-config-tags.ts +++ b/src/panels/config/tags/ha-config-tags.ts @@ -327,7 +327,7 @@ export class HaConfigTags extends SubscribeMixin(LitElement) { await deleteTag(this.hass, selectedTag.id); this._tags = this._tags.filter((tag) => tag.id !== selectedTag.id); return true; - } catch (err: any) { + } catch (_err: any) { return false; } } diff --git a/src/panels/config/users/ha-config-users.ts b/src/panels/config/users/ha-config-users.ts index 111563c138..a93e481d2d 100644 --- a/src/panels/config/users/ha-config-users.ts +++ b/src/panels/config/users/ha-config-users.ts @@ -271,7 +271,7 @@ export class HaConfigUsers extends LitElement { await deleteUser(this.hass!, entry!.id); this._users = this._users!.filter((ent) => ent !== entry); return true; - } catch (err: any) { + } catch (_err: any) { return false; } }, diff --git a/src/panels/config/voice-assistants/assist-pref.ts b/src/panels/config/voice-assistants/assist-pref.ts index c719cd4564..5406745e0d 100644 --- a/src/panels/config/voice-assistants/assist-pref.ts +++ b/src/panels/config/voice-assistants/assist-pref.ts @@ -266,7 +266,7 @@ export class AssistPref extends LitElement { } try { await setExposeNewEntities(this.hass, "conversation", toggle.checked); - } catch (err: any) { + } catch (_err: any) { toggle.checked = !toggle.checked; } } diff --git a/src/panels/config/voice-assistants/cloud-alexa-pref.ts b/src/panels/config/voice-assistants/cloud-alexa-pref.ts index cdf03fee30..89237c0f5a 100644 --- a/src/panels/config/voice-assistants/cloud-alexa-pref.ts +++ b/src/panels/config/voice-assistants/cloud-alexa-pref.ts @@ -210,7 +210,7 @@ export class CloudAlexaPref extends LitElement { } try { await setExposeNewEntities(this.hass, "cloud.alexa", toggle.checked); - } catch (err: any) { + } catch (_err: any) { toggle.checked = !toggle.checked; } } @@ -220,7 +220,7 @@ export class CloudAlexaPref extends LitElement { try { await updateCloudPref(this.hass!, { alexa_enabled: toggle.checked! }); fireEvent(this, "ha-refresh-cloud-status"); - } catch (err: any) { + } catch (_err: any) { toggle.checked = !toggle.checked; } } diff --git a/src/panels/config/voice-assistants/cloud-google-pref.ts b/src/panels/config/voice-assistants/cloud-google-pref.ts index ae3eddd408..f268829988 100644 --- a/src/panels/config/voice-assistants/cloud-google-pref.ts +++ b/src/panels/config/voice-assistants/cloud-google-pref.ts @@ -271,7 +271,7 @@ export class CloudGooglePref extends LitElement { "cloud.google_assistant", toggle.checked ); - } catch (err: any) { + } catch (_err: any) { toggle.checked = !toggle.checked; } } @@ -281,7 +281,7 @@ export class CloudGooglePref extends LitElement { try { await updateCloudPref(this.hass, { google_enabled: toggle.checked! }); fireEvent(this, "ha-refresh-cloud-status"); - } catch (err: any) { + } catch (_err: any) { toggle.checked = !toggle.checked; } } diff --git a/src/panels/config/zone/ha-config-zone.ts b/src/panels/config/zone/ha-config-zone.ts index b59152a4fc..935a32787f 100644 --- a/src/panels/config/zone/ha-config-zone.ts +++ b/src/panels/config/zone/ha-config-zone.ts @@ -522,7 +522,7 @@ export class HaConfigZone extends SubscribeMixin(LitElement) { this._map?.fitMap(); } return true; - } catch (err: any) { + } catch (_err: any) { return false; } } diff --git a/src/panels/custom/ha-panel-custom.ts b/src/panels/custom/ha-panel-custom.ts index 708f8f1fb7..e7eaf5442e 100644 --- a/src/panels/custom/ha-panel-custom.ts +++ b/src/panels/custom/ha-panel-custom.ts @@ -31,7 +31,7 @@ export class HaPanelCustom extends ReactiveElement { @property({ attribute: false }) public panel!: CustomPanelInfo; - private _setProperties?: (props: Record) => void | undefined; + private _setProperties?: (props: Record) => void; protected createRenderRoot() { return this; diff --git a/src/panels/developer-tools/action/developer-tools-action.ts b/src/panels/developer-tools/action/developer-tools-action.ts index 5098dfc716..30047c43b8 100644 --- a/src/panels/developer-tools/action/developer-tools-action.ts +++ b/src/panels/developer-tools/action/developer-tools-action.ts @@ -577,7 +577,7 @@ class HaPanelDevAction extends LitElement { let value: any = ""; try { value = load(field.example); - } catch (err: any) { + } catch (_err: any) { value = this.hass.localize( `component.${domain}.services.${serviceName}.fields.${field.key}.example` diff --git a/src/panels/logbook/ha-logbook.ts b/src/panels/logbook/ha-logbook.ts index 0246670182..022b4ccb80 100644 --- a/src/panels/logbook/ha-logbook.ts +++ b/src/panels/logbook/ha-logbook.ts @@ -76,7 +76,7 @@ export class HaLogbook extends LitElement { @state() private _error?: string; - private _subscribed?: Promise<(() => Promise) | void>; + private _subscribed?: Promise<(() => Promise) | undefined>; private _liveUpdatesEnabled = true; @@ -309,6 +309,7 @@ export class HaLogbook extends LitElement { ).catch((err) => { this._subscribed = undefined; this._error = err; + return undefined; }); return true; } diff --git a/src/panels/lovelace/badges/hui-error-badge.ts b/src/panels/lovelace/badges/hui-error-badge.ts index 449521f2f5..c9eadc224f 100644 --- a/src/panels/lovelace/badges/hui-error-badge.ts +++ b/src/panels/lovelace/badges/hui-error-badge.ts @@ -37,7 +37,7 @@ export class HuiErrorBadge extends LitElement implements LovelaceBadge { if (this._config!.origConfig) { try { dumped = dump(this._config!.origConfig); - } catch (err: any) { + } catch (_err: any) { dumped = `[Error dumping ${this._config!.origConfig}]`; } } diff --git a/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts index 271f776b54..6aec00c670 100644 --- a/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts @@ -89,7 +89,7 @@ class HuiAlarmModeCardFeature try { await this._setMode(mode); - } catch (err) { + } catch (_err) { this._currentMode = oldMode; } } diff --git a/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts index dbe00c68d2..8cfc665de6 100644 --- a/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts @@ -98,7 +98,7 @@ class HuiClimateFanModesCardFeature try { await this._setMode(fanMode); - } catch (err) { + } catch (_err) { this._currentFanMode = oldFanMode; } } diff --git a/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts index a4d7c15a48..08619e18dd 100644 --- a/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts @@ -96,7 +96,7 @@ class HuiClimateHvacModesCardFeature try { await this._setMode(mode); - } catch (err) { + } catch (_err) { this._currentHvacMode = oldMode; } } diff --git a/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts index 1e6d6ad02c..825115cbaa 100644 --- a/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts @@ -100,7 +100,7 @@ class HuiClimatePresetModesCardFeature try { await this._setMode(presetMode); - } catch (err) { + } catch (_err) { this._currentPresetMode = oldPresetMode; } } diff --git a/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts index fdf242434e..136d38d142 100644 --- a/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts @@ -104,7 +104,7 @@ class HuiClimateSwingHorizontalModesCardFeature try { await this._setMode(swingHorizontalMode); - } catch (err) { + } catch (_err) { this._currentSwingHorizontalMode = oldSwingHorizontalMode; } } diff --git a/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts index 24c909d269..e381e741b4 100644 --- a/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts @@ -100,7 +100,7 @@ class HuiClimateSwingModesCardFeature try { await this._setMode(swingMode); - } catch (err) { + } catch (_err) { this._currentSwingMode = oldSwingMode; } } diff --git a/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts index 85eb6ea3de..83a6c6b603 100644 --- a/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts @@ -97,7 +97,7 @@ class HuiFanPresetModesCardFeature try { await this._setMode(presetMode); - } catch (err) { + } catch (_err) { this._currentPresetMode = oldPresetMode; } } diff --git a/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts index 0ed087278f..4cb01b0c2a 100644 --- a/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts @@ -98,7 +98,7 @@ class HuiHumidifierModesCardFeature try { await this._setMode(mode); - } catch (err) { + } catch (_err) { this._currentMode = oldMode; } } diff --git a/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts b/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts index 090164b27b..dd5ced0a59 100644 --- a/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts @@ -66,7 +66,7 @@ class HuiHumidifierToggleCardFeature try { await this._setState(newState); - } catch (err) { + } catch (_err) { this._currentState = oldState; } } diff --git a/src/panels/lovelace/card-features/hui-select-options-card-feature.ts b/src/panels/lovelace/card-features/hui-select-options-card-feature.ts index e7edd3e50f..3c5619557b 100644 --- a/src/panels/lovelace/card-features/hui-select-options-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-select-options-card-feature.ts @@ -90,7 +90,7 @@ class HuiSelectOptionsCardFeature try { await this._setOption(option); - } catch (err) { + } catch (_err) { this._currentOption = oldOption; } } diff --git a/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts index 96491049ac..78457c53c4 100644 --- a/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts @@ -84,7 +84,7 @@ class HuiWaterHeaterOperationModeCardFeature try { await this._setMode(mode); - } catch (err) { + } catch (_err) { this._currentOperationMode = oldMode; } } diff --git a/src/panels/lovelace/cards/hui-alarm-panel-card.ts b/src/panels/lovelace/cards/hui-alarm-panel-card.ts index ed71bf763d..5ab9b68801 100644 --- a/src/panels/lovelace/cards/hui-alarm-panel-card.ts +++ b/src/panels/lovelace/cards/hui-alarm-panel-card.ts @@ -204,7 +204,7 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard { } } ); - } catch (e) { + } catch (_e) { this._entry = null; } } diff --git a/src/panels/lovelace/cards/hui-error-card.ts b/src/panels/lovelace/cards/hui-error-card.ts index 7afe89a1b1..779bf3a5d7 100644 --- a/src/panels/lovelace/cards/hui-error-card.ts +++ b/src/panels/lovelace/cards/hui-error-card.ts @@ -33,7 +33,7 @@ export class HuiErrorCard extends LitElement implements LovelaceCard { if (this._config.origConfig) { try { dumped = dump(this._config.origConfig); - } catch (err: any) { + } catch (_err: any) { dumped = `[Error dumping ${this._config.origConfig}]`; } } diff --git a/src/panels/lovelace/cards/hui-history-graph-card.ts b/src/panels/lovelace/cards/hui-history-graph-card.ts index 1e9b2f54f1..08aa541e25 100644 --- a/src/panels/lovelace/cards/hui-history-graph-card.ts +++ b/src/panels/lovelace/cards/hui-history-graph-card.ts @@ -55,7 +55,7 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard { private _interval?: number; - private _subscribed?: Promise<(() => Promise) | void>; + private _subscribed?: Promise<(() => Promise) | undefined>; public getCardSize(): number { return this._config?.title ? 2 : 0 + 2 * (this._entityIds?.length || 1); @@ -143,6 +143,7 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard { ).catch((err) => { this._subscribed = undefined; this._error = err; + return undefined; }); await this._fetchStatistics(sensorNumericDeviceClasses); diff --git a/src/panels/lovelace/cards/hui-map-card.ts b/src/panels/lovelace/cards/hui-map-card.ts index 9d051456b2..d6b1141722 100644 --- a/src/panels/lovelace/cards/hui-map-card.ts +++ b/src/panels/lovelace/cards/hui-map-card.ts @@ -72,7 +72,7 @@ class HuiMapCard extends LitElement implements LovelaceCard { @state() private _error?: { code: string; message: string }; - private _subscribed?: Promise<(() => Promise) | void>; + private _subscribed?: Promise<(() => Promise) | undefined>; public setConfig(config: MapCardConfig): void { if (!config) { @@ -260,7 +260,7 @@ class HuiMapCard extends LitElement implements LovelaceCard { } this._stateHistory = combinedHistory; }, - this._config!.hours_to_show! ?? DEFAULT_HOURS_TO_SHOW, + this._config!.hours_to_show ?? DEFAULT_HOURS_TO_SHOW, (this._configEntities || []).map((entity) => entity.entity)!, false, false, @@ -268,6 +268,7 @@ class HuiMapCard extends LitElement implements LovelaceCard { ).catch((err) => { this._subscribed = undefined; this._error = err; + return undefined; }); } diff --git a/src/panels/lovelace/cards/hui-statistics-graph-card.ts b/src/panels/lovelace/cards/hui-statistics-graph-card.ts index cc7e8a6c4b..80bdad61fb 100644 --- a/src/panels/lovelace/cards/hui-statistics-graph-card.ts +++ b/src/panels/lovelace/cards/hui-statistics-graph-card.ts @@ -345,7 +345,7 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard { this._statistics![id] = statistics[id]; } }); - } catch (err) { + } catch (_err) { this._statistics = undefined; } } diff --git a/src/panels/lovelace/components/hui-card-options.ts b/src/panels/lovelace/components/hui-card-options.ts index db9f9eff2f..d27c21d9ca 100644 --- a/src/panels/lovelace/components/hui-card-options.ts +++ b/src/panels/lovelace/components/hui-card-options.ts @@ -407,7 +407,7 @@ export class HuiCardOptions extends LitElement { text: this.hass!.localize("ui.common.undo"), }, }); - } catch (err: any) { + } catch (_err: any) { this.lovelace.showToast({ message: this.hass!.localize( "ui.panel.lovelace.editor.move_card.error" diff --git a/src/panels/lovelace/create-element/create-element-base.ts b/src/panels/lovelace/create-element/create-element-base.ts index 5b01ff4193..8cf097f775 100644 --- a/src/panels/lovelace/create-element/create-element-base.ts +++ b/src/panels/lovelace/create-element/create-element-base.ts @@ -217,7 +217,7 @@ const _lazyCreate = ( fireEvent(element, "ll-upgrade"); // @ts-ignore element.setConfig(config); - } catch (err: any) { + } catch (_err: any) { // We let it rebuild and the error will be handled by _createElement fireEvent(element, "ll-rebuild"); } diff --git a/src/panels/lovelace/editor/add-entities-to-view.ts b/src/panels/lovelace/editor/add-entities-to-view.ts index 51d3a9696c..39b8d4152c 100644 --- a/src/panels/lovelace/editor/add-entities-to-view.ts +++ b/src/panels/lovelace/editor/add-entities-to-view.ts @@ -42,7 +42,7 @@ export const addEntitiesToLovelaceView = async ( if (mainLovelaceMode === "storage") { try { lovelaceConfig = await fetchConfig(hass.connection, null, false); - } catch (err: any) { + } catch (_err: any) { // default dashboard is in generated mode } } @@ -59,7 +59,7 @@ export const addEntitiesToLovelaceView = async ( ); urlPath = storageDash.url_path; break; - } catch (err: any) { + } catch (_err: any) { // dashboard is in generated mode } } @@ -98,7 +98,7 @@ export const addEntitiesToLovelaceView = async ( saveConfig: async (newConfig: LovelaceConfig): Promise => { try { await saveConfig(hass!, null, newConfig); - } catch (err: any) { + } catch (_err: any) { alert(hass.localize("ui.panel.lovelace.add_entities.saving_failed")); } }, diff --git a/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts b/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts index 986b1f2984..74fb1ecd4d 100644 --- a/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts +++ b/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts @@ -393,7 +393,7 @@ export class HuiBadgePicker extends LitElement { let newBadgeEl: LovelaceBadge; try { newBadgeEl = this._tryCreateBadgeElement(config); - } catch (err: any) { + } catch (_err: any) { return; } if (badgeElToReplace.parentElement) { @@ -431,7 +431,7 @@ export class HuiBadgePicker extends LitElement { if (showElement) { try { element = this._tryCreateBadgeElement(badgeConfig); - } catch (err: any) { + } catch (_err: any) { element = undefined; } } diff --git a/src/panels/lovelace/editor/card-editor/hui-card-picker.ts b/src/panels/lovelace/editor/card-editor/hui-card-picker.ts index a1e2894bb2..d127d17a47 100644 --- a/src/panels/lovelace/editor/card-editor/hui-card-picker.ts +++ b/src/panels/lovelace/editor/card-editor/hui-card-picker.ts @@ -401,7 +401,7 @@ export class HuiCardPicker extends LitElement { let newCardEl: LovelaceCard; try { newCardEl = this._tryCreateCardElement(config); - } catch (err: any) { + } catch (_err: any) { return; } if (cardElToReplace.parentElement) { @@ -436,7 +436,7 @@ export class HuiCardPicker extends LitElement { if (showElement) { try { element = this._tryCreateCardElement(cardConfig); - } catch (err: any) { + } catch (_err: any) { element = undefined; } } diff --git a/src/panels/lovelace/editor/section-editor/hui-dialog-edit-section.ts b/src/panels/lovelace/editor/section-editor/hui-dialog-edit-section.ts index e529bd689d..ecbd75f17d 100644 --- a/src/panels/lovelace/editor/section-editor/hui-dialog-edit-section.ts +++ b/src/panels/lovelace/editor/section-editor/hui-dialog-edit-section.ts @@ -77,6 +77,7 @@ export class HuiDialogEditSection this._config = undefined; this._currTab = TABS[0]; fireEvent(this, "dialog-closed", { dialog: this.localName }); + return true; } protected render() { diff --git a/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts b/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts index a483b4cc32..1117a11952 100644 --- a/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts +++ b/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts @@ -178,7 +178,7 @@ export class HuiDialogSelectView extends LitElement { urlPath, false )) as LovelaceConfig; - } catch (err: any) { + } catch (_err: any) { this._config = undefined; } } diff --git a/src/panels/lovelace/ha-panel-lovelace.ts b/src/panels/lovelace/ha-panel-lovelace.ts index ed7b473719..eaf0d05ba5 100644 --- a/src/panels/lovelace/ha-panel-lovelace.ts +++ b/src/panels/lovelace/ha-panel-lovelace.ts @@ -115,7 +115,7 @@ export class LovelacePanel extends LitElement { ); } - protected render(): TemplateResult | void { + protected render(): TemplateResult | undefined { const panelState = this._panelState; if (panelState === "loaded") { diff --git a/src/panels/lovelace/header-footer/hui-buttons-header-footer.ts b/src/panels/lovelace/header-footer/hui-buttons-header-footer.ts index 3824866842..589981a798 100644 --- a/src/panels/lovelace/header-footer/hui-buttons-header-footer.ts +++ b/src/panels/lovelace/header-footer/hui-buttons-header-footer.ts @@ -49,7 +49,7 @@ export class HuiButtonsHeaderFooter ); } - protected render(): TemplateResult | void { + protected render(): TemplateResult | undefined { return html` ${this.type === "footer" ? html`` diff --git a/src/panels/lovelace/header-footer/hui-graph-header-footer.ts b/src/panels/lovelace/header-footer/hui-graph-header-footer.ts index e9c5878ec2..7a13840939 100644 --- a/src/panels/lovelace/header-footer/hui-graph-header-footer.ts +++ b/src/panels/lovelace/header-footer/hui-graph-header-footer.ts @@ -67,7 +67,7 @@ export class HuiGraphHeaderFooter private _interval?: number; - private _subscribed?: Promise<(() => Promise) | void>; + private _subscribed?: Promise<(() => Promise) | undefined>; public getCardSize(): number { return 3; @@ -170,6 +170,7 @@ export class HuiGraphHeaderFooter ).catch((err) => { this._subscribed = undefined; this._error = err; + return undefined; }); this._setRedrawTimer(); } diff --git a/src/panels/lovelace/heading-badges/hui-error-heading-badge.ts b/src/panels/lovelace/heading-badges/hui-error-heading-badge.ts index ced1175db1..8d41fd8ad5 100644 --- a/src/panels/lovelace/heading-badges/hui-error-heading-badge.ts +++ b/src/panels/lovelace/heading-badges/hui-error-heading-badge.ts @@ -37,7 +37,7 @@ export class HuiErrorHeadingBadge extends LitElement implements LovelaceBadge { if (this._config!.origConfig) { try { dumped = dump(this._config!.origConfig); - } catch (err: any) { + } catch (_err: any) { dumped = `[Error dumping ${this._config!.origConfig}]`; } } diff --git a/src/panels/lovelace/heading-badges/hui-heading-badge.ts b/src/panels/lovelace/heading-badges/hui-heading-badge.ts index 3cc1c25a38..3f7c74b048 100644 --- a/src/panels/lovelace/heading-badges/hui-heading-badge.ts +++ b/src/panels/lovelace/heading-badges/hui-heading-badge.ts @@ -125,7 +125,7 @@ export class HuiHeadingBadge extends ReactiveElement { if (this.hass) { this._element.hass = this.hass; } - } catch (e: any) { + } catch (_e: any) { this._element = undefined; this._elementConfig = undefined; } diff --git a/src/panels/lovelace/hui-editor.ts b/src/panels/lovelace/hui-editor.ts index 476cb2f1bf..166b1055c2 100644 --- a/src/panels/lovelace/hui-editor.ts +++ b/src/panels/lovelace/hui-editor.ts @@ -47,7 +47,7 @@ class LovelaceFullConfigEditor extends LitElement { @state() private _changed?: boolean; - protected render(): TemplateResult | void { + protected render(): TemplateResult | undefined { return html` { tillNextRender = undefined; start = undefined; diff --git a/src/panels/media-browser/ha-panel-media-browser.ts b/src/panels/media-browser/ha-panel-media-browser.ts index c930481751..c12d5d65da 100644 --- a/src/panels/media-browser/ha-panel-media-browser.ts +++ b/src/panels/media-browser/ha-panel-media-browser.ts @@ -274,7 +274,7 @@ class PanelMediaBrowser extends LitElement { item.media_content_id, item.media_content_type ); - } catch (err) { + } catch (_err) { this._player.hideResolvingNewMediaPicked(); } return; diff --git a/src/panels/my/ha-panel-my.ts b/src/panels/my/ha-panel-my.ts index f1d7f4c8c3..db68c52244 100644 --- a/src/panels/my/ha-panel-my.ts +++ b/src/panels/my/ha-panel-my.ts @@ -374,7 +374,7 @@ class HaPanelMy extends LitElement { let url: string; try { url = this._createRedirectUrl(); - } catch (err: any) { + } catch (_err: any) { this._error = "url_error"; return; } diff --git a/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts b/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts index 47773abc49..ebbc8cddb1 100644 --- a/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts +++ b/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts @@ -60,7 +60,7 @@ export class HaStateControlAlarmControlPanelModes extends LitElement { try { await this._setMode(mode); - } catch (err) { + } catch (_err) { this._currentMode = oldMode; } } diff --git a/src/state-control/lock/ha-state-control-lock-toggle.ts b/src/state-control/lock/ha-state-control-lock-toggle.ts index 9589050c9d..5e0996d9a8 100644 --- a/src/state-control/lock/ha-state-control-lock-toggle.ts +++ b/src/state-control/lock/ha-state-control-lock-toggle.ts @@ -50,7 +50,7 @@ export class HaStateControlLockToggle extends LitElement { this._isOn = true; try { await this._callService(true); - } catch (err) { + } catch (_err) { this._isOn = false; } } @@ -59,7 +59,7 @@ export class HaStateControlLockToggle extends LitElement { this._isOn = false; try { await this._callService(false); - } catch (err) { + } catch (_err) { this._isOn = true; } } diff --git a/src/util/common-translation.ts b/src/util/common-translation.ts index 105da9b977..263fba9bb9 100644 --- a/src/util/common-translation.ts +++ b/src/util/common-translation.ts @@ -113,7 +113,7 @@ export function getLocalLanguage() { return language; } } - } catch (err: any) { + } catch (_err: any) { // Ignore parsing error. } } diff --git a/src/util/hass-call-api.ts b/src/util/hass-call-api.ts index b52876b594..80370abf8b 100644 --- a/src/util/hass-call-api.ts +++ b/src/util/hass-call-api.ts @@ -8,8 +8,8 @@ export const handleFetchPromise = async ( try { response = await fetchPromise; - } catch (err: any) { - // eslint-disable-next-line @typescript-eslint/no-throw-literal + } catch (_err: any) { + // eslint-disable-next-line no-throw-literal throw { error: "Request error", status_code: undefined, @@ -25,7 +25,7 @@ export const handleFetchPromise = async ( try { body = await response.json(); } catch (err: any) { - // eslint-disable-next-line @typescript-eslint/no-throw-literal + // eslint-disable-next-line no-throw-literal throw { error: "Unable to parse JSON response", status_code: err.status, @@ -37,7 +37,7 @@ export const handleFetchPromise = async ( } if (!response.ok) { - // eslint-disable-next-line @typescript-eslint/no-throw-literal + // eslint-disable-next-line no-throw-literal throw { error: `Response error: ${response.status}`, status_code: response.status, diff --git a/yarn.lock b/yarn.lock index 12fdb0870a..d52e97e7c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5424,29 +5424,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/eslint-plugin@npm:7.18.0" - dependencies: - "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:7.18.0" - "@typescript-eslint/type-utils": "npm:7.18.0" - "@typescript-eslint/utils": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" - graphemer: "npm:^1.4.0" - ignore: "npm:^5.3.1" - natural-compare: "npm:^1.4.0" - ts-api-utils: "npm:^1.3.0" - peerDependencies: - "@typescript-eslint/parser": ^7.0.0 - eslint: ^8.56.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 10/6ee4c61f145dc05f0a567b8ac01b5399ef9c75f58bc6e9a3ffca8927b15e2be2d4c3fd32a2c1a7041cc0848fdeadac30d9cb0d3bcd3835d301847a88ffd19c4d - languageName: node - linkType: hard - "@typescript-eslint/eslint-plugin@npm:8.19.1": version: 8.19.1 resolution: "@typescript-eslint/eslint-plugin@npm:8.19.1" @@ -5468,24 +5445,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/parser@npm:7.18.0" - dependencies: - "@typescript-eslint/scope-manager": "npm:7.18.0" - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/typescript-estree": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" - debug: "npm:^4.3.4" - peerDependencies: - eslint: ^8.56.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 10/36b00e192a96180220ba100fcce3c777fc3e61a6edbdead4e6e75a744d9f0cbe3fabb5f1c94a31cce6b28a4e4d5de148098eec01296026c3c8e16f7f0067cb1e - languageName: node - linkType: hard - "@typescript-eslint/parser@npm:8.19.1": version: 8.19.1 resolution: "@typescript-eslint/parser@npm:8.19.1" @@ -5502,16 +5461,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/scope-manager@npm:7.18.0" - dependencies: - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" - checksum: 10/9eb2ae5d69d9f723e706c16b2b97744fc016996a5473bed596035ac4d12429b3d24e7340a8235d704efa57f8f52e1b3b37925ff7c2e3384859d28b23a99b8bcc - languageName: node - linkType: hard - "@typescript-eslint/scope-manager@npm:8.19.1, @typescript-eslint/scope-manager@npm:^8.1.0": version: 8.19.1 resolution: "@typescript-eslint/scope-manager@npm:8.19.1" @@ -5522,23 +5471,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/type-utils@npm:7.18.0" - dependencies: - "@typescript-eslint/typescript-estree": "npm:7.18.0" - "@typescript-eslint/utils": "npm:7.18.0" - debug: "npm:^4.3.4" - ts-api-utils: "npm:^1.3.0" - peerDependencies: - eslint: ^8.56.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 10/bcc7958a4ecdddad8c92e17265175773e7dddf416a654c1a391e69cb16e43960b39d37b6ffa349941bf3635e050f0ca7cd8f56ec9dd774168f2bbe7afedc9676 - languageName: node - linkType: hard - "@typescript-eslint/type-utils@npm:8.19.1": version: 8.19.1 resolution: "@typescript-eslint/type-utils@npm:8.19.1" @@ -5554,13 +5486,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/types@npm:7.18.0" - checksum: 10/0e30c73a3cc3c67dd06360a5a12fd12cee831e4092750eec3d6c031bdc4feafcb0ab1d882910a73e66b451a4f6e1dd015e9e2c4d45bf6bf716a474e5d123ddf0 - languageName: node - linkType: hard - "@typescript-eslint/types@npm:8.19.1": version: 8.19.1 resolution: "@typescript-eslint/types@npm:8.19.1" @@ -5568,25 +5493,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/typescript-estree@npm:7.18.0" - dependencies: - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" - debug: "npm:^4.3.4" - globby: "npm:^11.1.0" - is-glob: "npm:^4.0.3" - minimatch: "npm:^9.0.4" - semver: "npm:^7.6.0" - ts-api-utils: "npm:^1.3.0" - peerDependenciesMeta: - typescript: - optional: true - checksum: 10/b01e66235a91aa4439d02081d4a5f8b4a7cf9cb24f26b334812f657e3c603493e5f41e5c1e89cf4efae7d64509fa1f73affc16afc5e15cb7f83f724577c82036 - languageName: node - linkType: hard - "@typescript-eslint/typescript-estree@npm:8.19.1": version: 8.19.1 resolution: "@typescript-eslint/typescript-estree@npm:8.19.1" @@ -5605,20 +5511,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/utils@npm:7.18.0" - dependencies: - "@eslint-community/eslint-utils": "npm:^4.4.0" - "@typescript-eslint/scope-manager": "npm:7.18.0" - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/typescript-estree": "npm:7.18.0" - peerDependencies: - eslint: ^8.56.0 - checksum: 10/f43fedb4f4d2e3836bdf137889449063a55c0ece74fdb283929cd376197b992313be8ef4df920c1c801b5c3076b92964c84c6c3b9b749d263b648d0011f5926e - languageName: node - linkType: hard - "@typescript-eslint/utils@npm:8.19.1, @typescript-eslint/utils@npm:^8.1.0": version: 8.19.1 resolution: "@typescript-eslint/utils@npm:8.19.1" @@ -5634,16 +5526,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/visitor-keys@npm:7.18.0" - dependencies: - "@typescript-eslint/types": "npm:7.18.0" - eslint-visitor-keys: "npm:^3.4.3" - checksum: 10/b7cfe6fdeae86c507357ac6b2357813c64fb2fbf1aaf844393ba82f73a16e2599b41981b34200d9fc7765d70bc3a8181d76b503051e53f04bcb7c9afef637eab - languageName: node - linkType: hard - "@typescript-eslint/visitor-keys@npm:8.19.1": version: 8.19.1 resolution: "@typescript-eslint/visitor-keys@npm:8.19.1" @@ -6578,13 +6460,6 @@ __metadata: languageName: node linkType: hard -"array-union@npm:^2.1.0": - version: 2.1.0 - resolution: "array-union@npm:2.1.0" - checksum: 10/5bee12395cba82da674931df6d0fea23c4aa4660cb3b338ced9f828782a65caa232573e6bf3968f23e0c5eb301764a382cef2f128b170a9dc59de0e36c39f98d - languageName: node - linkType: hard - "array.prototype.findlastindex@npm:^1.2.5": version: 1.2.5 resolution: "array.prototype.findlastindex@npm:1.2.5" @@ -8084,15 +7959,6 @@ __metadata: languageName: node linkType: hard -"dir-glob@npm:^3.0.1": - version: 3.0.1 - resolution: "dir-glob@npm:3.0.1" - dependencies: - path-type: "npm:^4.0.0" - checksum: 10/fa05e18324510d7283f55862f3161c6759a3f2f8dbce491a2fc14c8324c498286c54282c1f0e933cb930da8419b30679389499b919122952a4f8592362ef4615 - languageName: node - linkType: hard - "dns-packet@npm:^5.2.2": version: 5.6.1 resolution: "dns-packet@npm:5.6.1" @@ -8718,7 +8584,7 @@ __metadata: languageName: node linkType: hard -"eslint-config-airbnb-base@npm:15.0.0, eslint-config-airbnb-base@npm:^15.0.0": +"eslint-config-airbnb-base@npm:15.0.0": version: 15.0.0 resolution: "eslint-config-airbnb-base@npm:15.0.0" dependencies: @@ -8733,19 +8599,6 @@ __metadata: languageName: node linkType: hard -"eslint-config-airbnb-typescript@npm:18.0.0": - version: 18.0.0 - resolution: "eslint-config-airbnb-typescript@npm:18.0.0" - dependencies: - eslint-config-airbnb-base: "npm:^15.0.0" - peerDependencies: - "@typescript-eslint/eslint-plugin": ^7.0.0 - "@typescript-eslint/parser": ^7.0.0 - eslint: ^8.56.0 - checksum: 10/b913670baf3aa457aa1d514ea63813e76f2232a7efdb149ce96cecb10d836cadea6776a304529f1ae371d2e721479540461e89735bdde85a949e2bf62eb3187c - languageName: node - linkType: hard - "eslint-config-prettier@npm:9.1.0": version: 9.1.0 resolution: "eslint-config-prettier@npm:9.1.0" @@ -9315,7 +9168,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.2, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.2": +"fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.2, fast-glob@npm:^3.3.2": version: 3.3.2 resolution: "fast-glob@npm:3.3.2" dependencies: @@ -9973,20 +9826,6 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11.1.0": - version: 11.1.0 - resolution: "globby@npm:11.1.0" - dependencies: - array-union: "npm:^2.1.0" - dir-glob: "npm:^3.0.1" - fast-glob: "npm:^3.2.9" - ignore: "npm:^5.2.0" - merge2: "npm:^1.4.1" - slash: "npm:^3.0.0" - checksum: 10/288e95e310227bbe037076ea81b7c2598ccbc3122d87abc6dab39e1eec309aa14f0e366a98cdc45237ffcfcbad3db597778c0068217dcb1950fef6249104e1b1 - languageName: node - linkType: hard - "globby@npm:^14.0.2": version: 14.0.2 resolution: "globby@npm:14.0.2" @@ -10345,8 +10184,8 @@ __metadata: "@types/tar": "npm:6.1.13" "@types/ua-parser-js": "npm:0.7.39" "@types/webspeechapi": "npm:0.0.29" - "@typescript-eslint/eslint-plugin": "npm:7.18.0" - "@typescript-eslint/parser": "npm:7.18.0" + "@typescript-eslint/eslint-plugin": "npm:8.19.1" + "@typescript-eslint/parser": "npm:8.19.1" "@vaadin/combo-box": "npm:24.6.1" "@vaadin/vaadin-themable-mixin": "npm:24.6.1" "@vibrant/color": "npm:4.0.0" @@ -10374,7 +10213,6 @@ __metadata: element-internals-polyfill: "npm:1.3.12" eslint: "npm:9.18.0" eslint-config-airbnb-base: "npm:15.0.0" - eslint-config-airbnb-typescript: "npm:18.0.0" eslint-config-prettier: "npm:9.1.0" eslint-import-resolver-webpack: "npm:0.13.10" eslint-plugin-import: "npm:2.31.0" @@ -12292,7 +12130,7 @@ __metadata: languageName: node linkType: hard -"merge2@npm:^1.3.0, merge2@npm:^1.4.1": +"merge2@npm:^1.3.0": version: 1.4.1 resolution: "merge2@npm:1.4.1" checksum: 10/7268db63ed5169466540b6fb947aec313200bcf6d40c5ab722c22e242f651994619bcd85601602972d3c85bd2cc45a358a4c61937e9f11a061919a1da569b0c2 @@ -13339,13 +13177,6 @@ __metadata: languageName: node linkType: hard -"path-type@npm:^4.0.0": - version: 4.0.0 - resolution: "path-type@npm:4.0.0" - checksum: 10/5b1e2daa247062061325b8fdbfd1fb56dde0a448fb1455453276ea18c60685bdad23a445dc148cf87bc216be1573357509b7d4060494a6fd768c7efad833ee45 - languageName: node - linkType: hard - "path-type@npm:^5.0.0": version: 5.0.0 resolution: "path-type@npm:5.0.0" @@ -14611,13 +14442,6 @@ __metadata: languageName: node linkType: hard -"slash@npm:^3.0.0": - version: 3.0.0 - resolution: "slash@npm:3.0.0" - checksum: 10/94a93fff615f25a999ad4b83c9d5e257a7280c90a32a7cb8b4a87996e4babf322e469c42b7f649fd5796edd8687652f3fb452a86dc97a816f01113183393f11c - languageName: node - linkType: hard - "slash@npm:^5.1.0": version: 5.1.0 resolution: "slash@npm:5.1.0" @@ -15592,15 +15416,6 @@ __metadata: languageName: node linkType: hard -"ts-api-utils@npm:^1.3.0": - version: 1.4.3 - resolution: "ts-api-utils@npm:1.4.3" - peerDependencies: - typescript: ">=4.2.0" - checksum: 10/713c51e7392323305bd4867422ba130fbf70873ef6edbf80ea6d7e9c8f41eeeb13e40e8e7fe7cd321d74e4864777329797077268c9f570464303a1723f1eed39 - languageName: node - linkType: hard - "ts-api-utils@npm:^2.0.0": version: 2.0.0 resolution: "ts-api-utils@npm:2.0.0"