mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-19 10:57:19 +00:00
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
This commit is contained in:
parent
922cd72be4
commit
abe8899f9b
@ -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",
|
||||
},
|
||||
},
|
||||
|
@ -203,7 +203,7 @@ class HcCast extends LitElement {
|
||||
}
|
||||
this.connection.close();
|
||||
location.reload();
|
||||
} catch (err: any) {
|
||||
} catch (_err: any) {
|
||||
alert("Unable to log out!");
|
||||
}
|
||||
}
|
||||
|
@ -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!");
|
||||
}
|
||||
}
|
||||
|
@ -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 :-(");
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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) {
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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"),
|
||||
|
@ -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!)
|
||||
: "";
|
||||
|
@ -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"),
|
||||
|
@ -65,7 +65,7 @@ class HassioSupervisorLog extends LitElement {
|
||||
await this._loadData();
|
||||
}
|
||||
|
||||
protected render(): TemplateResult | void {
|
||||
protected render(): TemplateResult | undefined {
|
||||
return html`
|
||||
<ha-card outlined>
|
||||
${this._error
|
||||
|
@ -23,7 +23,7 @@ class HassioSystem extends LitElement {
|
||||
|
||||
@property({ attribute: false }) public route!: Route;
|
||||
|
||||
protected render(): TemplateResult | void {
|
||||
protected render(): TemplateResult | undefined {
|
||||
return html`
|
||||
<hass-tabs-subpage
|
||||
.hass=${this.hass}
|
||||
|
@ -230,7 +230,7 @@ class LandingPageLogs extends LitElement {
|
||||
this._startLogStream();
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
// ignore and continue with observer logs
|
||||
}
|
||||
this._loadObserverLogs();
|
||||
|
@ -126,7 +126,7 @@ class HaLandingPage extends LandingPageBaseElement {
|
||||
"selectedLanguage",
|
||||
JSON.stringify(language)
|
||||
);
|
||||
} catch (err: any) {
|
||||
} catch (_err: any) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
@ -184,8 +184,8 @@
|
||||
"@types/tar": "6.1.13",
|
||||
"@types/ua-parser-js": "0.7.39",
|
||||
"@types/webspeechapi": "0.0.29",
|
||||
"@typescript-eslint/eslint-plugin": "7.18.0",
|
||||
"@typescript-eslint/parser": "7.18.0",
|
||||
"@typescript-eslint/eslint-plugin": "8.19.1",
|
||||
"@typescript-eslint/parser": "8.19.1",
|
||||
"@vitest/coverage-v8": "2.1.8",
|
||||
"babel-loader": "9.2.1",
|
||||
"babel-plugin-template-html-minifier": "4.1.0",
|
||||
@ -193,7 +193,6 @@
|
||||
"del": "8.0.0",
|
||||
"eslint": "9.18.0",
|
||||
"eslint-config-airbnb-base": "15.0.0",
|
||||
"eslint-config-airbnb-typescript": "18.0.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-import-resolver-webpack": "0.13.10",
|
||||
"eslint-plugin-import": "2.31.0",
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
// Needs to remain CommonJS until eslint-import-resolver-webpack supports ES modules
|
||||
const rspack = require("./build-scripts/rspack.cjs");
|
||||
const env = require("./build-scripts/env.cjs");
|
||||
|
@ -232,7 +232,7 @@ export class HaAuthorize extends litLocalizeLiteMixin(LitElement) {
|
||||
|
||||
try {
|
||||
url = new URL(this.redirectUri);
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
this._error = "Invalid redirect URI";
|
||||
return;
|
||||
}
|
||||
@ -328,7 +328,7 @@ export class HaAuthorize extends litLocalizeLiteMixin(LitElement) {
|
||||
|
||||
try {
|
||||
window.localStorage.setItem("selectedLanguage", JSON.stringify(language));
|
||||
} catch (err: any) {
|
||||
} catch (_err: any) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,9 @@ type NonNullUndefined<T> = T extends undefined
|
||||
*/
|
||||
export function ensureArray(value: undefined): undefined;
|
||||
export function ensureArray(value: null): null;
|
||||
export function ensureArray<T>(value: T | T[]): NonNullUndefined<T>[];
|
||||
export function ensureArray<T>(value: T | readonly T[]): NonNullUndefined<T>[];
|
||||
export function ensureArray<T>(
|
||||
value: T | T[] | readonly T[]
|
||||
): NonNullUndefined<T>[];
|
||||
export function ensureArray(value) {
|
||||
if (value === undefined || value === null || Array.isArray(value)) {
|
||||
return value;
|
||||
|
@ -66,7 +66,7 @@ export function loadTokens() {
|
||||
} else {
|
||||
tokenCache.tokens = null;
|
||||
}
|
||||
} catch (err: any) {
|
||||
} catch (_err: any) {
|
||||
tokenCache.tokens = null;
|
||||
}
|
||||
}
|
||||
|
@ -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]) {
|
||||
|
@ -186,7 +186,7 @@ const processTheme = (
|
||||
const prefixedRgbKey = `--${rgbKey}`;
|
||||
styles[prefixedRgbKey] = rgbValue;
|
||||
keys[prefixedRgbKey] = "";
|
||||
} catch (err: any) {
|
||||
} catch (_err: any) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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<Thresholds> = {}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
|
@ -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"
|
||||
);
|
||||
|
@ -34,7 +34,7 @@ export class HaAnsiToHtml extends LitElement {
|
||||
|
||||
@litState() private _filter = "";
|
||||
|
||||
protected render(): TemplateResult | void {
|
||||
protected render(): TemplateResult {
|
||||
return html`<pre class=${classMap({ wrap: !this.wrapDisabled })}></pre>`;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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 [];
|
||||
|
@ -97,7 +97,7 @@ export class HaLanguagePicker extends LitElement {
|
||||
type: "language",
|
||||
fallback: "code",
|
||||
}).of(lang)!;
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
label = lang;
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,8 @@ export class HaLocationsEditor extends LitElement {
|
||||
|
||||
private Leaflet?: LeafletModuleType;
|
||||
|
||||
private _loadPromise: Promise<boolean | void>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
||||
private _loadPromise: Promise<boolean | undefined | void>;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -202,7 +202,7 @@ export class HatScriptGraph extends LitElement {
|
||||
.notEnabled=${disabled || config.enabled === false}
|
||||
></hat-graph-node>
|
||||
${branch.sequence !== null
|
||||
? ensureArray(branch.sequence).map((action, j) =>
|
||||
? ensureArray<Action>(branch.sequence).map((action, j) =>
|
||||
this._renderActionNode(
|
||||
action,
|
||||
`${branchPath}/sequence/${j}`,
|
||||
@ -218,13 +218,14 @@ export class HatScriptGraph extends LitElement {
|
||||
<div ?track=${trackDefault}>
|
||||
<hat-graph-spacer ?track=${trackDefault}></hat-graph-spacer>
|
||||
${config.default !== null
|
||||
? ensureArray(config.default)?.map((action, i) =>
|
||||
this._renderActionNode(
|
||||
action,
|
||||
`${path}/default/${i}`,
|
||||
false,
|
||||
disabled || config.enabled === false
|
||||
)
|
||||
? ensureArray<Action | undefined>(config.default)?.map(
|
||||
(action, i) =>
|
||||
this._renderActionNode(
|
||||
action,
|
||||
`${path}/default/${i}`,
|
||||
false,
|
||||
disabled || config.enabled === false
|
||||
)
|
||||
)
|
||||
: ""}
|
||||
</div>
|
||||
@ -278,7 +279,7 @@ export class HatScriptGraph extends LitElement {
|
||||
.notEnabled=${disabled || config.enabled === false}
|
||||
nofocus
|
||||
></hat-graph-node
|
||||
>${ensureArray(config.else).map((action, j) =>
|
||||
>${ensureArray<Action>(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
|
||||
></hat-graph-node>
|
||||
${ensureArray(config.then ?? []).map((action, j) =>
|
||||
${ensureArray<Action>(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}
|
||||
></hat-graph-node>
|
||||
<div ?track=${trace}>
|
||||
${ensureArray(node.repeat.sequence).map((action, i) =>
|
||||
${ensureArray<Action>(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
|
||||
></hat-graph-node>
|
||||
${ensureArray(node.parallel).map((action, i) =>
|
||||
${ensureArray<Action>(node.parallel).map((action, i) =>
|
||||
"sequence" in action
|
||||
? html`<div ?track=${path in this.trace.trace}>
|
||||
${ensureArray((action as ManualScriptConfig).sequence).map(
|
||||
(sAction, j) =>
|
||||
this._renderActionNode(
|
||||
sAction,
|
||||
`${path}/parallel/${i}/sequence/${j}`,
|
||||
false,
|
||||
disabled || node.enabled === false
|
||||
)
|
||||
${ensureArray<Action>(
|
||||
(action as ManualScriptConfig).sequence
|
||||
).map((sAction, j) =>
|
||||
this._renderActionNode(
|
||||
sAction,
|
||||
`${path}/parallel/${i}/sequence/${j}`,
|
||||
false,
|
||||
disabled || node.enabled === false
|
||||
)
|
||||
)}
|
||||
</div>`
|
||||
: 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<Action>(this.trace.config.sequence).map(
|
||||
(action, i) =>
|
||||
this._renderActionNode(action, `sequence/${i}`, i === 0)
|
||||
)}`
|
||||
: ""}
|
||||
</div>
|
||||
|
@ -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(
|
||||
|
@ -58,7 +58,7 @@ export const deleteApplicationCredential = async (
|
||||
hass: HomeAssistant,
|
||||
applicationCredentialsId: string
|
||||
) =>
|
||||
hass.callWS<void>({
|
||||
hass.callWS<undefined>({
|
||||
type: "application_credentials/delete",
|
||||
application_credentials_id: applicationCredentialsId,
|
||||
});
|
||||
|
@ -366,7 +366,7 @@ export const setAssistPipelinePreferred = (
|
||||
});
|
||||
|
||||
export const deleteAssistPipeline = (hass: HomeAssistant, pipelineId: string) =>
|
||||
hass.callWS<void>({
|
||||
hass.callWS<undefined>({
|
||||
type: "assist_pipeline/pipeline/delete",
|
||||
pipeline_id: pipelineId,
|
||||
});
|
||||
|
@ -132,7 +132,7 @@ export const adminChangePassword = (
|
||||
userId: string,
|
||||
password: string
|
||||
) =>
|
||||
hass.callWS<void>({
|
||||
hass.callWS<undefined>({
|
||||
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<void>({
|
||||
hass.callWS<undefined>({
|
||||
type: "config/auth_provider/homeassistant/admin_change_username",
|
||||
user_id: userId,
|
||||
username,
|
||||
|
@ -366,7 +366,7 @@ export const saveAutomationConfig = (
|
||||
hass: HomeAssistant,
|
||||
id: string,
|
||||
config: AutomationConfig
|
||||
) => hass.callApi<void>("POST", `config/automation/config/${id}`, config);
|
||||
) => hass.callApi<undefined>("POST", `config/automation/config/${id}`, config);
|
||||
|
||||
export const normalizeAutomationConfig = <
|
||||
T extends Partial<AutomationConfig> | AutomationConfig,
|
||||
|
@ -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<void>({
|
||||
hass.callWS<undefined>({
|
||||
type: "calendar/event/create",
|
||||
entity_id: entityId,
|
||||
event: event,
|
||||
@ -168,7 +168,7 @@ export const updateCalendarEvent = (
|
||||
recurrence_id?: string,
|
||||
recurrence_range?: RecurrenceRange
|
||||
) =>
|
||||
hass.callWS<void>({
|
||||
hass.callWS<undefined>({
|
||||
type: "calendar/event/update",
|
||||
entity_id: entityId,
|
||||
uid,
|
||||
@ -184,7 +184,7 @@ export const deleteCalendarEvent = (
|
||||
recurrence_id?: string,
|
||||
recurrence_range?: RecurrenceRange
|
||||
) =>
|
||||
hass.callWS<void>({
|
||||
hass.callWS<undefined>({
|
||||
type: "calendar/event/delete",
|
||||
entity_id: entityId,
|
||||
uid,
|
||||
|
@ -756,8 +756,8 @@ export type EnergyGasUnitClass = (typeof energyGasUnitClass)[number];
|
||||
|
||||
export const getEnergyGasUnitClass = (
|
||||
prefs: EnergyPreferences,
|
||||
statisticsMetaData: Record<string, StatisticsMetaData> = {},
|
||||
excludeSource?: string
|
||||
excludeSource?: string,
|
||||
statisticsMetaData: Record<string, StatisticsMetaData> = {}
|
||||
): 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, StatisticsMetaData> = {}
|
||||
): string | undefined => {
|
||||
const unitClass = getEnergyGasUnitClass(prefs, statisticsMetaData);
|
||||
const unitClass = getEnergyGasUnitClass(prefs, undefined, statisticsMetaData);
|
||||
if (unitClass === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ export const saveFrontendUserData = async <
|
||||
key: UserDataKey,
|
||||
value: FrontendUserData[UserDataKey]
|
||||
): Promise<void> =>
|
||||
conn.sendMessagePromise<void>({
|
||||
conn.sendMessagePromise<undefined>({
|
||||
type: "frontend/set_user_data",
|
||||
key,
|
||||
value,
|
||||
|
@ -390,7 +390,7 @@ export const rebuildLocalAddon = async (
|
||||
slug: string
|
||||
): Promise<void> => {
|
||||
if (atLeastVersion(hass.config.version, 2021, 2, 4)) {
|
||||
return hass.callWS<void>({
|
||||
return hass.callWS<undefined>({
|
||||
type: "supervisor/api",
|
||||
endpoint: `/addons/${slug}/rebuild`,
|
||||
method: "post",
|
||||
|
@ -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<void>> => {
|
||||
const params = {
|
||||
type: "history/stream",
|
||||
|
@ -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<void>({
|
||||
hass.callWS<undefined>({
|
||||
type: "recorder/update_statistics_metadata",
|
||||
statistic_id,
|
||||
unit_of_measurement,
|
||||
});
|
||||
|
||||
export const clearStatistics = (hass: HomeAssistant, statistic_ids: string[]) =>
|
||||
hass.callWS<void>({
|
||||
hass.callWS<undefined>({
|
||||
type: "recorder/clear_statistics",
|
||||
statistic_ids,
|
||||
});
|
||||
@ -295,7 +296,7 @@ export const adjustStatisticsSum = (
|
||||
adjustment_unit_of_measurement: string | null
|
||||
): Promise<void> => {
|
||||
const start_time_iso = new Date(start_time).toISOString();
|
||||
return hass.callWS({
|
||||
return hass.callWS<undefined>({
|
||||
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<undefined>({ type: "recorder/update_statistics_issues" });
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ export const updateTag = async (
|
||||
});
|
||||
|
||||
export const deleteTag = async (hass: HomeAssistant, tagId: string) =>
|
||||
hass.callWS<void>({
|
||||
hass.callWS<undefined>({
|
||||
type: "tag/delete",
|
||||
tag_id: tagId,
|
||||
});
|
||||
|
@ -63,7 +63,7 @@ export const updateUser = async (
|
||||
});
|
||||
|
||||
export const deleteUser = async (hass: HomeAssistant, userId: string) =>
|
||||
hass.callWS<void>({
|
||||
hass.callWS<undefined>({
|
||||
type: "config/auth/delete",
|
||||
user_id: userId,
|
||||
});
|
||||
|
@ -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<UnsubscribeFunc> =>
|
||||
hass.connection.subscribeMessage((message) => callbackFunction(message), {
|
||||
type: "zwave_js/add_node",
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -22,7 +22,7 @@ declare global {
|
||||
export interface HassDialog<T = HASSDomEvents[ValidHassDomEvent]>
|
||||
extends HTMLElement {
|
||||
showDialog(params: T);
|
||||
closeDialog?: () => boolean | void;
|
||||
closeDialog?: () => boolean;
|
||||
}
|
||||
|
||||
interface ShowDialogParams<T> {
|
||||
|
@ -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, {
|
||||
|
@ -126,7 +126,7 @@ export class MoreInfoDialog extends LitElement {
|
||||
this.hass,
|
||||
this._entityId
|
||||
);
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
this._entry = null;
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ export class MoreInfoHistory extends LitElement {
|
||||
|
||||
private _interval?: number;
|
||||
|
||||
private _subscribed?: Promise<(() => Promise<void>) | void>;
|
||||
private _subscribed?: Promise<(() => Promise<void>) | 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();
|
||||
}
|
||||
|
@ -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
|
||||
)
|
||||
) {
|
||||
|
@ -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
|
||||
)
|
||||
) {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class DialogCalendarEventDetail extends LitElement {
|
||||
return html`<div id="text">${ruleText}</div>`;
|
||||
}
|
||||
return html`<div id="text">Cannot convert recurrence rule</div>`;
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
return "Error while processing the rule";
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ export class RecurrenceRuleEditor extends LitElement {
|
||||
let rrule: Partial<Options> | undefined;
|
||||
try {
|
||||
rrule = RRule.parseString(this.value);
|
||||
} catch (ex) {
|
||||
} catch (_err) {
|
||||
// unsupported rrule string
|
||||
this._freq = undefined;
|
||||
return;
|
||||
|
@ -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 = (
|
||||
|
@ -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() {
|
||||
|
@ -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) {
|
||||
|
@ -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) => {
|
||||
|
@ -55,7 +55,7 @@ export type BackupConfigData = {
|
||||
|
||||
declare global {
|
||||
interface HASSDomEvents {
|
||||
"backup-addons-fetched": void;
|
||||
"backup-addons-fetched": undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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() {
|
||||
|
@ -115,6 +115,7 @@ class DialogGenerateBackup extends LitElement implements HassDialog {
|
||||
|
||||
public closeDialog() {
|
||||
this._dialog?.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
private _previousStep() {
|
||||
|
@ -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() {
|
||||
|
@ -90,6 +90,7 @@ class DialogRestoreBackup extends LitElement implements HassDialog {
|
||||
|
||||
public closeDialog() {
|
||||
this._dialog?.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
private _dialogClosed() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -65,6 +65,7 @@ export class DialogUploadBackup
|
||||
|
||||
public closeDialog() {
|
||||
this._dialog?.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
private _formValid() {
|
||||
|
@ -11,7 +11,7 @@ export const showUploadBackupDialog = (
|
||||
element: HTMLElement,
|
||||
params: UploadBackupDialogParams
|
||||
) =>
|
||||
new Promise<void | null>((resolve) => {
|
||||
new Promise<undefined | null>((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();
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -41,7 +41,7 @@ export class HaDeviceInfoMatter extends SubscribeMixin(LitElement) {
|
||||
this.hass,
|
||||
this.device.id
|
||||
);
|
||||
} catch (err: any) {
|
||||
} catch (_err: any) {
|
||||
this._nodeDiagnostics = undefined;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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(
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user