diff --git a/cast/src/receiver/layout/hc-lovelace.ts b/cast/src/receiver/layout/hc-lovelace.ts index 7591f55121d2..87cc165d9774 100644 --- a/cast/src/receiver/layout/hc-lovelace.ts +++ b/cast/src/receiver/layout/hc-lovelace.ts @@ -25,9 +25,9 @@ class HcLovelace extends LitElement { @property({ attribute: false }) public lovelaceConfig!: LovelaceConfig; - @property() public viewPath?: string | number | null; + @property({ attribute: false }) public viewPath?: string | number | null; - @property() public urlPath: string | null = null; + @property({ attribute: false }) public urlPath: string | null = null; protected render(): TemplateResult { const index = this._viewIndex; diff --git a/cast/src/receiver/layout/hc-main.ts b/cast/src/receiver/layout/hc-main.ts index cd7c81fa334a..958d94ccccf7 100644 --- a/cast/src/receiver/layout/hc-main.ts +++ b/cast/src/receiver/layout/hc-main.ts @@ -144,10 +144,10 @@ export class HcMain extends HassElement { } if (senderId) { - this.sendMessage(senderId, status); + this._sendMessage(senderId, status); } else { for (const sender of castContext.getSenders()) { - this.sendMessage(sender.id, status); + this._sendMessage(sender.id, status); } } } @@ -164,10 +164,10 @@ export class HcMain extends HassElement { }; if (senderId) { - this.sendMessage(senderId, error); + this._sendMessage(senderId, error); } else { for (const sender of castContext.getSenders()) { - this.sendMessage(sender.id, error); + this._sendMessage(sender.id, error); } } } @@ -394,7 +394,7 @@ export class HcMain extends HassElement { } } - private sendMessage(senderId: string, response: any) { + private _sendMessage(senderId: string, response: any) { castContext.sendCustomMessage(CAST_NS, senderId, response); } } diff --git a/eslint.config.mjs b/eslint.config.mjs index 4bc8a57fc3c4..34169498b060 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -7,10 +7,10 @@ import { fileURLToPath } from "node:url"; import js from "@eslint/js"; import { FlatCompat } from "@eslint/eslintrc"; -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); +const _filename = fileURLToPath(import.meta.url); +const _dirname = path.dirname(_filename); const compat = new FlatCompat({ - baseDirectory: __dirname, + baseDirectory: _dirname, recommendedConfig: js.configs.recommended, allConfig: js.configs.all, }); @@ -115,12 +115,21 @@ export default [ "@typescript-eslint/naming-convention": [ "warn", + { + selector: ["objectLiteralProperty", "objectLiteralMethod"], + format: null, + }, { selector: ["variable"], format: ["camelCase", "snake_case", "UPPER_CASE"], leadingUnderscore: "allow", trailingUnderscore: "allow", }, + { + selector: ["variable"], + modifiers: ["exported"], + format: ["camelCase", "PascalCase", "UPPER_CASE"], + }, { selector: "typeLike", format: ["PascalCase"], diff --git a/gallery/src/components/demo-black-white-row.ts b/gallery/src/components/demo-black-white-row.ts index d043136abba7..fd4fef13f6b1 100644 --- a/gallery/src/components/demo-black-white-row.ts +++ b/gallery/src/components/demo-black-white-row.ts @@ -9,6 +9,7 @@ import "../../../src/components/ha-card"; @customElement("demo-black-white-row") class DemoBlackWhiteRow extends LitElement { + // eslint-disable-next-line lit/no-native-attributes @property() title!: string; @property() value?: any; diff --git a/gallery/src/components/demo-card.ts b/gallery/src/components/demo-card.ts index 968b7cb273e4..50234d11515f 100644 --- a/gallery/src/components/demo-card.ts +++ b/gallery/src/components/demo-card.ts @@ -18,7 +18,7 @@ class DemoCard extends LitElement { @property({ attribute: false }) public config!: DemoCardConfig; - @property({ type: Boolean }) public showConfig = false; + @property({ attribute: false, type: Boolean }) public showConfig = false; @state() private _size?: number; diff --git a/gallery/src/components/demo-cards.ts b/gallery/src/components/demo-cards.ts index 5571e1c09f25..655b38a68a32 100644 --- a/gallery/src/components/demo-cards.ts +++ b/gallery/src/components/demo-cards.ts @@ -44,11 +44,11 @@ class DemoCards extends LitElement { `; } - _showConfigToggled(ev) { + private _showConfigToggled(ev) { this._showConfig = ev.target.checked; } - _darkThemeToggled(ev) { + private _darkThemeToggled(ev) { applyThemesOnElement(this._container, { themes: {} } as any, "default", { dark: ev.target.checked, }); diff --git a/gallery/src/components/demo-more-info.ts b/gallery/src/components/demo-more-info.ts index c1dd5d091eb8..fb0ab5ff5e63 100644 --- a/gallery/src/components/demo-more-info.ts +++ b/gallery/src/components/demo-more-info.ts @@ -10,9 +10,9 @@ import type { HomeAssistant } from "../../../src/types"; class DemoMoreInfo extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public entityId!: string; + @property({ attribute: false }) public entityId!: string; - @property({ type: Boolean }) public showConfig = false; + @property({ attribute: false, type: Boolean }) public showConfig = false; render() { const state = this._getState(this.entityId, this.hass.states); diff --git a/gallery/src/components/demo-more-infos.ts b/gallery/src/components/demo-more-infos.ts index 19f16cf8cf82..a6191040a667 100644 --- a/gallery/src/components/demo-more-infos.ts +++ b/gallery/src/components/demo-more-infos.ts @@ -58,11 +58,11 @@ class DemoMoreInfos extends LitElement { } `; - _showConfigToggled(ev) { + private _showConfigToggled(ev) { this._showConfig = ev.target.checked; } - _darkThemeToggled(ev) { + private _darkThemeToggled(ev) { applyThemesOnElement( this.shadowRoot!.querySelector("#container"), { diff --git a/gallery/src/ha-gallery.ts b/gallery/src/ha-gallery.ts index 1f079497a059..d1043815a220 100644 --- a/gallery/src/ha-gallery.ts +++ b/gallery/src/ha-gallery.ts @@ -182,7 +182,7 @@ class HaGallery extends LitElement { } } - _menuTapped() { + private _menuTapped() { this._drawer.open = !this._drawer.open; } diff --git a/gallery/src/pages/automation/editor-action.ts b/gallery/src/pages/automation/editor-action.ts index 6d07e7f4438e..cf40c4ce7c74 100644 --- a/gallery/src/pages/automation/editor-action.ts +++ b/gallery/src/pages/automation/editor-action.ts @@ -63,11 +63,6 @@ class DemoHaAutomationEditorAction extends LitElement { } protected render(): TemplateResult { - const valueChanged = (ev) => { - const sampleIdx = ev.target.sampleIdx; - this.data[sampleIdx] = ev.detail.value; - this.requestUpdate(); - }; return html`
@@ -92,7 +87,7 @@ class DemoHaAutomationEditorAction extends LitElement { .actions=${this.data[sampleIdx]} .sampleIdx=${sampleIdx} .disabled=${this._disabled} - @value-changed=${valueChanged} + @value-changed=${this._handleValueChange} > ` )} @@ -102,6 +97,12 @@ class DemoHaAutomationEditorAction extends LitElement { `; } + private _handleValueChange(ev) { + const sampleIdx = ev.target.sampleIdx; + this.data[sampleIdx] = ev.detail.value; + this.requestUpdate(); + } + private _handleOptionChange(ev) { this[`_${ev.target.name}`] = ev.target.checked; } diff --git a/gallery/src/pages/automation/editor-condition.ts b/gallery/src/pages/automation/editor-condition.ts index 22f83d774478..883ff642ce64 100644 --- a/gallery/src/pages/automation/editor-condition.ts +++ b/gallery/src/pages/automation/editor-condition.ts @@ -103,11 +103,6 @@ export class DemoAutomationEditorCondition extends LitElement { } protected render(): TemplateResult { - const valueChanged = (ev) => { - const sampleIdx = ev.target.sampleIdx; - this.data[sampleIdx] = ev.detail.value; - this.requestUpdate(); - }; return html`
@@ -132,7 +127,7 @@ export class DemoAutomationEditorCondition extends LitElement { .conditions=${this.data[sampleIdx]} .sampleIdx=${sampleIdx} .disabled=${this._disabled} - @value-changed=${valueChanged} + @value-changed=${this._handleValueChange} > ` )} @@ -142,6 +137,12 @@ export class DemoAutomationEditorCondition extends LitElement { `; } + private _handleValueChange(ev) { + const sampleIdx = ev.target.sampleIdx; + this.data[sampleIdx] = ev.detail.value; + this.requestUpdate(); + } + private _handleOptionChange(ev) { this[`_${ev.target.name}`] = ev.target.checked; } diff --git a/gallery/src/pages/automation/editor-trigger.ts b/gallery/src/pages/automation/editor-trigger.ts index e9558c01e9f7..2feb661a308c 100644 --- a/gallery/src/pages/automation/editor-trigger.ts +++ b/gallery/src/pages/automation/editor-trigger.ts @@ -149,11 +149,6 @@ export class DemoAutomationEditorTrigger extends LitElement { } protected render(): TemplateResult { - const valueChanged = (ev) => { - const sampleIdx = ev.target.sampleIdx; - this.data[sampleIdx] = ev.detail.value; - this.requestUpdate(); - }; return html`
@@ -178,7 +173,7 @@ export class DemoAutomationEditorTrigger extends LitElement { .triggers=${this.data[sampleIdx]} .sampleIdx=${sampleIdx} .disabled=${this._disabled} - @value-changed=${valueChanged} + @value-changed=${this._handleValueChange} > ` )} @@ -188,6 +183,12 @@ export class DemoAutomationEditorTrigger extends LitElement { `; } + private _handleValueChange(ev) { + const sampleIdx = ev.target.sampleIdx; + this.data[sampleIdx] = ev.detail.value; + this.requestUpdate(); + } + private _handleOptionChange(ev) { this[`_${ev.target.name}`] = ev.target.checked; } diff --git a/gallery/src/pages/automation/trace.ts b/gallery/src/pages/automation/trace.ts index 573ab49be0d8..86fac502a903 100644 --- a/gallery/src/pages/automation/trace.ts +++ b/gallery/src/pages/automation/trace.ts @@ -31,9 +31,8 @@ export class DemoAutomationTrace extends LitElement { { - this._selected = { ...this._selected, [idx]: ev.detail.path }; - }} + @graph-node-selected=${this._handleGraphNodeSelected} + .sampleIdx=${idx} > { - this._selected = { - ...this._selected, - [idx]: ev.detail.value, - }; - }} + @value-changed=${this._handleTimelineValueChanged} + .sampleIdx=${idx} >
@@ -63,6 +58,16 @@ export class DemoAutomationTrace extends LitElement { hass.updateTranslations("config", "en"); } + private _handleTimelineValueChanged(ev) { + const sampleIdx = ev.target.sampleIdx; + this._selected = { ...this._selected, [sampleIdx]: ev.detail.value }; + } + + private _handleGraphNodeSelected(ev) { + const sampleIdx = ev.target.sampleIdx; + this._selected = { ...this._selected, [sampleIdx]: ev.detail.path }; + } + static get styles() { return css` ha-card { diff --git a/gallery/src/pages/components/ha-form.ts b/gallery/src/pages/components/ha-form.ts index fe877ad1d8c5..2f9b01287734 100644 --- a/gallery/src/pages/components/ha-form.ts +++ b/gallery/src/pages/components/ha-form.ts @@ -489,14 +489,8 @@ class DemoHaForm extends LitElement { .title=${info.title} .value=${this.data[idx]} .disabled=${this.disabled[idx]} - @submitted=${() => { - this.disabled[idx] = true; - this.requestUpdate(); - setTimeout(() => { - this.disabled[idx] = false; - this.requestUpdate(); - }, 2000); - }} + @submitted=${this._handleSubmit} + .sampleIdx=${idx} > ${["light", "dark"].map( (slot) => html` @@ -511,10 +505,8 @@ class DemoHaForm extends LitElement { .computeLabel=${(schema) => translations[schema.name] || schema.name} .computeHelper=${() => "Helper text"} - @value-changed=${(e) => { - this.data[idx] = e.detail.value; - this.requestUpdate(); - }} + @value-changed=${this._handleValueChanged} + .sampleIdx=${idx} > ` )} @@ -523,6 +515,22 @@ class DemoHaForm extends LitElement { })} `; } + + private _handleValueChanged(ev) { + const sampleIdx = ev.target.sampleIdx; + this.data[sampleIdx] = ev.detail.value; + this.requestUpdate(); + } + + private _handleSubmit(ev) { + const sampleIdx = ev.target.sampleIdx; + this.disabled[sampleIdx] = true; + this.requestUpdate(); + setTimeout(() => { + this.disabled[sampleIdx] = false; + this.requestUpdate(); + }, 2000); + } } declare global { diff --git a/gallery/src/pages/components/ha-selector.ts b/gallery/src/pages/components/ha-selector.ts index a63348539617..f9eb0e6d0e7f 100644 --- a/gallery/src/pages/components/ha-selector.ts +++ b/gallery/src/pages/components/ha-selector.ts @@ -590,13 +590,6 @@ class DemoHaSelector extends LitElement implements ProvideHassElement {
${SCHEMAS.map((info, idx) => { const data = this.data[idx]; - const valueChanged = (ev) => { - this.data[idx] = { - ...data, - [ev.target.key]: ev.detail.value, - }; - this.requestUpdate(); - }; return html` ${["light", "dark"].map((slot) => @@ -613,7 +606,8 @@ class DemoHaSelector extends LitElement implements ProvideHassElement { .value=${data[key] ?? value!.default} .disabled=${this._disabled} .required=${this._required} - @value-changed=${valueChanged} + @value-changed=${this._handleValueChanged} + .sampleIdx=${idx} .helper=${this._helper ? "Helper text" : undefined} > @@ -626,6 +620,15 @@ class DemoHaSelector extends LitElement implements ProvideHassElement { `; } + private _handleValueChanged(ev) { + const idx = ev.target.sampleIdx; + this.data[idx] = { + ...this.data[idx], + [ev.target.key]: ev.detail.value, + }; + this.requestUpdate(); + } + private _handleOptionChange(ev) { this[`_${ev.target.name}`] = ev.target.checked; } diff --git a/hassio/src/addon-store/hassio-addon-store.ts b/hassio/src/addon-store/hassio-addon-store.ts index 0ff3075ec3d2..66aaf84cb244 100644 --- a/hassio/src/addon-store/hassio-addon-store.ts +++ b/hassio/src/addon-store/hassio-addon-store.ts @@ -136,7 +136,7 @@ export class HassioAddonStore extends LitElement { this._manageRepositories(repositoryUrl); } - this.addEventListener("hass-api-called", (ev) => this.apiCalled(ev)); + this.addEventListener("hass-api-called", (ev) => this._apiCalled(ev)); this._loadData(); } @@ -179,7 +179,7 @@ export class HassioAddonStore extends LitElement { } } - private apiCalled(ev) { + private _apiCalled(ev) { if (ev.detail.success) { this._loadData(); } diff --git a/hassio/src/backups/hassio-backups.ts b/hassio/src/backups/hassio-backups.ts index 9ef0df2da055..ca0321ecffcf 100644 --- a/hassio/src/backups/hassio-backups.ts +++ b/hassio/src/backups/hassio-backups.ts @@ -58,7 +58,7 @@ export class HassioBackups extends LitElement { @property({ type: Boolean }) public narrow = false; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @state() private _selectedBackups: string[] = []; @@ -74,7 +74,7 @@ export class HassioBackups extends LitElement { public connectedCallback(): void { super.connectedCallback(); if (this.hass && this._firstUpdatedCalled) { - this.fetchBackups(); + this._fetchBackups(); } } @@ -107,7 +107,7 @@ export class HassioBackups extends LitElement { protected firstUpdated(changedProperties: PropertyValues): void { super.firstUpdated(changedProperties); if (this.hass && this.isConnected) { - this.fetchBackups(); + this._fetchBackups(); } this._firstUpdatedCalled = true; } @@ -280,7 +280,7 @@ export class HassioBackups extends LitElement { private _handleAction(ev: CustomEvent) { switch (ev.detail.index) { case 0: - this.fetchBackups(); + this._fetchBackups(); break; case 1: showHassioBackupLocationDialog(this, { supervisor: this.supervisor }); @@ -303,13 +303,13 @@ export class HassioBackups extends LitElement { showHassioBackupDialog(this, { slug, supervisor: this.supervisor, - onDelete: () => this.fetchBackups(), + onDelete: () => this._fetchBackups(), }), - reloadBackup: () => this.fetchBackups(), + reloadBackup: () => this._fetchBackups(), }); } - private async fetchBackups() { + private async _fetchBackups() { this._isLoading = true; await reloadHassioBackups(this.hass); this._backups = await fetchHassioBackups(this.hass); @@ -341,7 +341,7 @@ export class HassioBackups extends LitElement { }); return; } - await this.fetchBackups(); + await this._fetchBackups(); this._dataTable.clearSelection(); } @@ -350,7 +350,7 @@ export class HassioBackups extends LitElement { showHassioBackupDialog(this, { slug, supervisor: this.supervisor, - onDelete: () => this.fetchBackups(), + onDelete: () => this._fetchBackups(), }); } @@ -366,7 +366,7 @@ export class HassioBackups extends LitElement { } showHassioCreateBackupDialog(this, { supervisor: this.supervisor!, - onCreate: () => this.fetchBackups(), + onCreate: () => this._fetchBackups(), }); } diff --git a/hassio/src/components/hassio-card-content.ts b/hassio/src/components/hassio-card-content.ts index 7943d65e5fe0..e9f3872e07bb 100644 --- a/hassio/src/components/hassio-card-content.ts +++ b/hassio/src/components/hassio-card-content.ts @@ -9,23 +9,24 @@ import type { HomeAssistant } from "../../../src/types"; class HassioCardContent extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; + // eslint-disable-next-line lit/no-native-attributes @property() public title!: string; @property() public description?: string; @property({ type: Boolean }) public available = true; - @property({ type: Boolean }) public showTopbar = false; + @property({ attribute: false, type: Boolean }) public showTopbar = false; - @property() public topbarClass?: string; + @property({ attribute: false }) public topbarClass?: string; - @property() public iconTitle?: string; + @property({ attribute: false }) public iconTitle?: string; - @property() public iconClass?: string; + @property({ attribute: false }) public iconClass?: string; @property() public icon = mdiHelpCircle; - @property() public iconImage?: string; + @property({ attribute: false }) public iconImage?: string; protected render(): TemplateResult { return html` @@ -35,7 +36,11 @@ class HassioCardContent extends LitElement { ${this.iconImage ? html`
- + ${this.iconTitle
` diff --git a/hassio/src/components/supervisor-backup-content.ts b/hassio/src/components/supervisor-backup-content.ts index c94234611b91..03d1667d6ab2 100644 --- a/hassio/src/components/supervisor-backup-content.ts +++ b/hassio/src/components/supervisor-backup-content.ts @@ -73,23 +73,25 @@ export class SupervisorBackupContent extends LitElement { @property({ attribute: false }) public backup?: HassioBackupDetail; - @property() public backupType: HassioBackupDetail["type"] = "full"; + @property({ attribute: false }) + public backupType: HassioBackupDetail["type"] = "full"; @property({ attribute: false }) public folders?: CheckboxItem[]; @property({ attribute: false }) public addons?: AddonCheckboxItem[]; - @property({ type: Boolean }) public homeAssistant = false; + @property({ attribute: false, type: Boolean }) public homeAssistant = false; - @property({ type: Boolean }) public backupHasPassword = false; + @property({ attribute: false, type: Boolean }) public backupHasPassword = + false; @property({ type: Boolean }) public onboarding = false; - @property() public backupName = ""; + @property({ attribute: false }) public backupName = ""; - @property() public backupPassword = ""; + @property({ attribute: false }) public backupPassword = ""; - @property() public confirmBackupPassword = ""; + @property({ attribute: false }) public confirmBackupPassword = ""; @query("ha-textfield, ha-radio, ha-checkbox", true) private _focusTarget; @@ -191,7 +193,7 @@ export class SupervisorBackupContent extends LitElement { >
` @@ -277,7 +279,7 @@ export class SupervisorBackupContent extends LitElement { `; } - private toggleHomeAssistant() { + private _toggleHomeAssistant() { this.homeAssistant = !this.homeAssistant; } diff --git a/hassio/src/components/supervisor-formfield-label.ts b/hassio/src/components/supervisor-formfield-label.ts index 875e4535b780..10d926e0836b 100644 --- a/hassio/src/components/supervisor-formfield-label.ts +++ b/hassio/src/components/supervisor-formfield-label.ts @@ -7,9 +7,9 @@ import "../../../src/components/ha-svg-icon"; class SupervisorFormfieldLabel extends LitElement { @property({ type: String }) public label!: string; - @property({ type: String }) public imageUrl?: string; + @property({ attribute: false }) public imageUrl?: string; - @property({ type: String }) public iconPath?: string; + @property({ attribute: false }) public iconPath?: string; @property({ type: String }) public version?: string; diff --git a/hassio/src/dialogs/datadisk/dialog-hassio-datadisk.ts b/hassio/src/dialogs/datadisk/dialog-hassio-datadisk.ts index 8ede6209c39b..1ddcb13dfd62 100644 --- a/hassio/src/dialogs/datadisk/dialog-hassio-datadisk.ts +++ b/hassio/src/dialogs/datadisk/dialog-hassio-datadisk.ts @@ -95,7 +95,7 @@ class HassioDatadiskDialog extends LitElement { .label=${this.dialogParams.supervisor.localize( "dialog.datadisk_move.select_device" )} - @selected=${this._select_device} + @selected=${this._selectDevice} dialogInitialFocus > ${this.devices.map( @@ -137,7 +137,7 @@ class HassioDatadiskDialog extends LitElement { `; } - private _select_device(ev) { + private _selectDevice(ev) { this.selectedDevice = ev.target.value; } diff --git a/hassio/src/dialogs/markdown/dialog-hassio-markdown.ts b/hassio/src/dialogs/markdown/dialog-hassio-markdown.ts index e52b7a79e499..d7fcc8f889f4 100644 --- a/hassio/src/dialogs/markdown/dialog-hassio-markdown.ts +++ b/hassio/src/dialogs/markdown/dialog-hassio-markdown.ts @@ -12,6 +12,7 @@ import type { HassioMarkdownDialogParams } from "./show-dialog-hassio-markdown"; class HassioMarkdownDialog extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; + // eslint-disable-next-line lit/no-native-attributes @property() public title!: string; @property() public content!: string; diff --git a/hassio/src/dialogs/network/dialog-hassio-network.ts b/hassio/src/dialogs/network/dialog-hassio-network.ts index 088b3454ffdf..7e28eff9694e 100644 --- a/hassio/src/dialogs/network/dialog-hassio-network.ts +++ b/hassio/src/dialogs/network/dialog-hassio-network.ts @@ -394,7 +394,7 @@ export class DialogHassioNetwork `; } - _toArray(data: string | string[]): string[] { + private _toArray(data: string | string[]): string[] { if (Array.isArray(data)) { if (data && typeof data[0] === "string") { data = data[0]; @@ -409,7 +409,7 @@ export class DialogHassioNetwork return data; } - _toString(data: string | string[]): string { + private _toString(data: string | string[]): string { if (!data) { return ""; } diff --git a/hassio/src/ingress-view/hassio-ingress-view.ts b/hassio/src/ingress-view/hassio-ingress-view.ts index 93a366cb4e34..98e62b4fafcf 100644 --- a/hassio/src/ingress-view/hassio-ingress-view.ts +++ b/hassio/src/ingress-view/hassio-ingress-view.ts @@ -34,7 +34,7 @@ class HassioIngressView extends LitElement { @property({ attribute: false }) public route!: Route; - @property({ type: Boolean }) public ingressPanel = false; + @property({ attribute: false, type: Boolean }) public ingressPanel = false; @property({ type: Boolean }) public narrow = false; diff --git a/hassio/src/update-available/update-available-card.ts b/hassio/src/update-available/update-available-card.ts index f69bcf9b1d8e..91185d3a587a 100644 --- a/hassio/src/update-available/update-available-card.ts +++ b/hassio/src/update-available/update-available-card.ts @@ -58,10 +58,10 @@ const SUPERVISOR_UPDATE_NAMES = { supervisor: "Home Assistant Supervisor", }; -type updateType = "os" | "supervisor" | "core" | "addon"; +type UpdateType = "os" | "supervisor" | "core" | "addon"; const changelogUrl = ( - entry: updateType, + entry: UpdateType, version: string ): string | undefined => { if (entry === "addon") { @@ -99,7 +99,7 @@ class UpdateAvailableCard extends LitElement { @property({ attribute: false }) public addonSlug?: string; - @state() private _updateType?: updateType; + @state() private _updateType?: UpdateType; @state() private _changelogContent?: string; @@ -222,7 +222,7 @@ class UpdateAvailableCard extends LitElement { const updateType = ["core", "os", "supervisor"].includes(pathPart) ? pathPart : "addon"; - this._updateType = updateType as updateType; + this._updateType = updateType as UpdateType; switch (updateType) { case "addon": diff --git a/src/auth/ha-auth-flow.ts b/src/auth/ha-auth-flow.ts index b860d9e426db..e12dcda037a1 100644 --- a/src/auth/ha-auth-flow.ts +++ b/src/auth/ha-auth-flow.ts @@ -30,17 +30,17 @@ type State = "loading" | "error" | "step"; export class HaAuthFlow extends LitElement { @property({ attribute: false }) public authProvider?: AuthProvider; - @property() public clientId?: string; + @property({ attribute: false }) public clientId?: string; - @property() public redirectUri?: string; + @property({ attribute: false }) public redirectUri?: string; - @property() public oauth2State?: string; + @property({ attribute: false }) public oauth2State?: string; @property({ attribute: false }) public localize!: LocalizeFunc; @property({ attribute: false }) public step?: DataEntryFlowStep; - @property({ type: Boolean }) public initStoreToken = false; + @property({ attribute: false, type: Boolean }) public initStoreToken = false; @state() private _storeToken = false; diff --git a/src/auth/ha-authorize.ts b/src/auth/ha-authorize.ts index 030019eba62c..7208a25109f2 100644 --- a/src/auth/ha-authorize.ts +++ b/src/auth/ha-authorize.ts @@ -21,13 +21,13 @@ const appNames = { @customElement("ha-authorize") export class HaAuthorize extends litLocalizeLiteMixin(LitElement) { - @property() public clientId?: string; + @property({ attribute: false }) public clientId?: string; - @property() public redirectUri?: string; + @property({ attribute: false }) public redirectUri?: string; - @property() public oauth2State?: string; + @property({ attribute: false }) public oauth2State?: string; - @property() public translationFragment = "page-authorize"; + @property({ attribute: false }) public translationFragment = "page-authorize"; @state() private _authProvider?: AuthProvider; diff --git a/src/common/color/convert-color.ts b/src/common/color/convert-color.ts index af4225f3ee21..40d7e633112e 100644 --- a/src/common/color/convert-color.ts +++ b/src/common/color/convert-color.ts @@ -25,9 +25,11 @@ export const rgb2hex = (rgb: [number, number, number]): string => // Copyright (c) 2011-2019, Gregor Aisch // Constants for XYZ and LAB conversion +/* eslint-disable @typescript-eslint/naming-convention */ const Xn = 0.95047; const Yn = 1; const Zn = 1.08883; +/* eslint-enable @typescript-eslint/naming-convention */ const t0 = 0.137931034; // 4 / 29 const t1 = 0.206896552; // 6 / 29 diff --git a/src/common/translations/entity-state.ts b/src/common/translations/entity-state.ts index c9edbae99a4c..69c4df603db6 100644 --- a/src/common/translations/entity-state.ts +++ b/src/common/translations/entity-state.ts @@ -12,7 +12,7 @@ export type FormatEntityAttributeValueFunc = ( attribute: string, value?: any ) => string; -export type formatEntityAttributeNameFunc = ( +export type FormatEntityAttributeNameFunc = ( stateObj: HassEntity, attribute: string ) => string; @@ -26,7 +26,7 @@ export const computeFormatFunctions = async ( ): Promise<{ formatEntityState: FormatEntityStateFunc; formatEntityAttributeValue: FormatEntityAttributeValueFunc; - formatEntityAttributeName: formatEntityAttributeNameFunc; + formatEntityAttributeName: FormatEntityAttributeNameFunc; }> => { const { computeStateDisplay } = await import( "../entity/compute_state_display" diff --git a/src/common/translations/localize.ts b/src/common/translations/localize.ts index 32323b4b2573..2675d1c1fea9 100644 --- a/src/common/translations/localize.ts +++ b/src/common/translations/localize.ts @@ -94,6 +94,7 @@ export const computeLocalize = async ( resources: Resources, formats?: FormatsType ): Promise> => { + // eslint-disable-next-line @typescript-eslint/naming-convention const { IntlMessageFormat } = await import("intl-messageformat"); await polyfillLocaleData(language); diff --git a/src/components/chart/ha-chart-base.ts b/src/components/chart/ha-chart-base.ts index 049f4b6091ed..d219139741bf 100644 --- a/src/components/chart/ha-chart-base.ts +++ b/src/components/chart/ha-chart-base.ts @@ -53,9 +53,9 @@ export class HaChartBase extends LitElement { @property({ type: Number }) public height?: number; - @property({ type: Number }) public paddingYAxis = 0; + @property({ attribute: false, type: Number }) public paddingYAxis = 0; - @property({ type: Boolean }) public externalHidden = false; + @property({ attribute: false, type: Boolean }) public externalHidden = false; @state() private _chartHeight?: number; @@ -316,6 +316,7 @@ export class HaChartBase extends LitElement { .getContext("2d")!; this._loading = true; try { + // eslint-disable-next-line @typescript-eslint/naming-convention const ChartConstructor = (await import("../../resources/chartjs")).Chart; const computedStyles = getComputedStyle(this); diff --git a/src/components/chart/state-history-chart-line.ts b/src/components/chart/state-history-chart-line.ts index d244f91a0e6b..85495c77f3df 100644 --- a/src/components/chart/state-history-chart-line.ts +++ b/src/components/chart/state-history-chart-line.ts @@ -32,25 +32,26 @@ export class StateHistoryChartLine extends LitElement { @property() public identifier?: string; - @property({ type: Boolean }) public showNames = true; + @property({ attribute: false, type: Boolean }) public showNames = true; - @property({ type: Boolean }) public clickForMoreInfo = true; + @property({ attribute: false, type: Boolean }) public clickForMoreInfo = true; @property({ attribute: false }) public startTime!: Date; @property({ attribute: false }) public endTime!: Date; - @property({ type: Number }) public paddingYAxis = 0; + @property({ attribute: false, type: Number }) public paddingYAxis = 0; - @property({ type: Number }) public chartIndex?; + @property({ attribute: false, type: Number }) public chartIndex?; - @property({ type: Boolean }) public logarithmicScale = false; + @property({ attribute: false, type: Boolean }) public logarithmicScale = + false; - @property({ type: Number }) public minYAxis?: number; + @property({ attribute: false, type: Number }) public minYAxis?: number; - @property({ type: Number }) public maxYAxis?: number; + @property({ attribute: false, type: Number }) public maxYAxis?: number; - @property({ type: Boolean }) public fitYData = false; + @property({ attribute: false, type: Boolean }) public fitYData = false; @state() private _chartData?: ChartData<"line">; diff --git a/src/components/chart/state-history-chart-timeline.ts b/src/components/chart/state-history-chart-timeline.ts index 2cdb9c6b3c5e..f8d19d3cb4a4 100644 --- a/src/components/chart/state-history-chart-timeline.ts +++ b/src/components/chart/state-history-chart-timeline.ts @@ -30,9 +30,9 @@ export class StateHistoryChartTimeline extends LitElement { @property() public identifier?: string; - @property({ type: Boolean }) public showNames = true; + @property({ attribute: false, type: Boolean }) public showNames = true; - @property({ type: Boolean }) public clickForMoreInfo = true; + @property({ attribute: false, type: Boolean }) public clickForMoreInfo = true; @property({ type: Boolean }) public chunked = false; @@ -40,9 +40,9 @@ export class StateHistoryChartTimeline extends LitElement { @property({ attribute: false }) public endTime!: Date; - @property({ type: Number }) public paddingYAxis = 0; + @property({ attribute: false, type: Number }) public paddingYAxis = 0; - @property({ type: Number }) public chartIndex?; + @property({ attribute: false, type: Number }) public chartIndex?; @state() private _chartData?: ChartData<"timeline">; diff --git a/src/components/chart/state-history-charts.ts b/src/components/chart/state-history-charts.ts index 5920964dedb6..c701167302fa 100644 --- a/src/components/chart/state-history-charts.ts +++ b/src/components/chart/state-history-charts.ts @@ -1,5 +1,5 @@ import type { CSSResultGroup, PropertyValues } from "lit"; -import { css, html, LitElement, nothing } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, eventOptions, @@ -7,6 +7,7 @@ import { queryAll, state, } from "lit/decorators"; +import type { RenderItemFunction } from "@lit-labs/virtualizer/virtualize"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { restoreScroll } from "../../common/decorators/restore-scroll"; import type { @@ -58,21 +59,22 @@ export class StateHistoryCharts extends LitElement { @property({ type: Boolean, attribute: "up-to-now" }) public upToNow = false; - @property({ type: Number }) public hoursToShow?: number; + @property({ attribute: false, type: Number }) public hoursToShow?: number; - @property({ type: Boolean }) public showNames = true; + @property({ attribute: false, type: Boolean }) public showNames = true; - @property({ type: Boolean }) public clickForMoreInfo = true; + @property({ attribute: false, type: Boolean }) public clickForMoreInfo = true; - @property({ type: Boolean }) public isLoadingData = false; + @property({ attribute: false, type: Boolean }) public isLoadingData = false; - @property({ type: Boolean }) public logarithmicScale = false; + @property({ attribute: false, type: Boolean }) public logarithmicScale = + false; - @property({ type: Number }) public minYAxis?: number; + @property({ attribute: false, type: Number }) public minYAxis?: number; - @property({ type: Number }) public maxYAxis?: number; + @property({ attribute: false, type: Number }) public maxYAxis?: number; - @property({ type: Boolean }) public fitYData = false; + @property({ attribute: false, type: Boolean }) public fitYData = false; private _computedStartTime!: Date; @@ -122,6 +124,7 @@ export class StateHistoryCharts extends LitElement { ).concat(this.historyData.line) : this.historyData.line; + // eslint-disable-next-line lit/no-this-assign-in-render this._chartCount = combinedItems.length; return this.virtualize @@ -139,12 +142,12 @@ export class StateHistoryCharts extends LitElement { )}`; } - private _renderHistoryItem = ( - item: TimelineEntity[] | LineChartUnit, - index: number - ) => { + private _renderHistoryItem: RenderItemFunction< + TimelineEntity[] | LineChartUnit + > = (item, index) => { if (!item || index === undefined) { - return nothing; + // eslint-disable-next-line lit/prefer-nothing + return html``; } if (!Array.isArray(item)) { return html`
diff --git a/src/components/chart/statistics-chart.ts b/src/components/chart/statistics-chart.ts index c10157bb0875..9153cf99dd91 100644 --- a/src/components/chart/statistics-chart.ts +++ b/src/components/chart/statistics-chart.ts @@ -63,28 +63,25 @@ export class StatisticsChart extends LitElement { @property({ attribute: false }) public endTime?: Date; - @property({ type: Array }) public statTypes: Array = [ - "sum", - "min", - "mean", - "max", - ]; + @property({ attribute: false, type: Array }) + public statTypes: Array = ["sum", "min", "mean", "max"]; - @property() public chartType: ChartType = "line"; + @property({ attribute: false }) public chartType: ChartType = "line"; - @property({ type: Number }) public minYAxis?: number; + @property({ attribute: false, type: Number }) public minYAxis?: number; - @property({ type: Number }) public maxYAxis?: number; + @property({ attribute: false, type: Number }) public maxYAxis?: number; - @property({ type: Boolean }) public fitYData = false; + @property({ attribute: false, type: Boolean }) public fitYData = false; - @property({ type: Boolean }) public hideLegend = false; + @property({ attribute: false, type: Boolean }) public hideLegend = false; - @property({ type: Boolean }) public logarithmicScale = false; + @property({ attribute: false, type: Boolean }) public logarithmicScale = + false; - @property({ type: Boolean }) public isLoadingData = false; + @property({ attribute: false, type: Boolean }) public isLoadingData = false; - @property({ type: Boolean }) public clickForMoreInfo = true; + @property({ attribute: false, type: Boolean }) public clickForMoreInfo = true; @property() public period?: string; diff --git a/src/components/data-table/dialog-data-table-settings.ts b/src/components/data-table/dialog-data-table-settings.ts index d47b2abc2ace..0469c051ff4d 100644 --- a/src/components/data-table/dialog-data-table-settings.ts +++ b/src/components/data-table/dialog-data-table-settings.ts @@ -185,7 +185,7 @@ export class DialogDataTableSettings extends LitElement { this._params!.onUpdate(this._columnOrder, this._hiddenColumns); } - _toggle(ev) { + private _toggle(ev) { if (!this._params) { return; } @@ -266,7 +266,7 @@ export class DialogDataTableSettings extends LitElement { this._params!.onUpdate(this._columnOrder, this._hiddenColumns); } - _reset() { + private _reset() { this._columnOrder = undefined; this._hiddenColumns = undefined; diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts index de2b3a9a44c4..9348104065d4 100644 --- a/src/components/data-table/ha-data-table.ts +++ b/src/components/data-table/ha-data-table.ts @@ -116,7 +116,7 @@ export class HaDataTable extends LitElement { @property({ type: Boolean }) public clickable = false; - @property({ type: Boolean }) public hasFab = false; + @property({ attribute: false, type: Boolean }) public hasFab = false; /** * Add an extra row at the bottom of the data table @@ -127,24 +127,25 @@ export class HaDataTable extends LitElement { @property({ type: Boolean, attribute: "auto-height" }) public autoHeight = false; + // eslint-disable-next-line lit/no-native-attributes @property({ type: String }) public id = "id"; - @property({ type: String }) public noDataText?: string; + @property({ attribute: false, type: String }) public noDataText?: string; - @property({ type: String }) public searchLabel?: string; + @property({ attribute: false, type: String }) public searchLabel?: string; @property({ type: Boolean, attribute: "no-label-float" }) public noLabelFloat? = false; @property({ type: String }) public filter = ""; - @property() public groupColumn?: string; + @property({ attribute: false }) public groupColumn?: string; @property({ attribute: false }) public groupOrder?: string[]; - @property() public sortColumn?: string; + @property({ attribute: false }) public sortColumn?: string; - @property() public sortDirection: SortingDirection = null; + @property({ attribute: false }) public sortDirection: SortingDirection = null; @property({ attribute: false }) public initialCollapsedGroups?: string[]; diff --git a/src/components/date-range-picker.ts b/src/components/date-range-picker.ts index bc67b46bd93b..22734ca3b533 100644 --- a/src/components/date-range-picker.ts +++ b/src/components/date-range-picker.ts @@ -11,6 +11,7 @@ import { } from "../common/datetime/localize_date"; import { mainWindow } from "../common/dom/get_main_window"; +// eslint-disable-next-line @typescript-eslint/naming-convention const CustomDateRangePicker = Vue.extend({ mixins: [DateRangePicker], methods: { @@ -53,6 +54,7 @@ const CustomDateRangePicker = Vue.extend({ }, }); +// eslint-disable-next-line @typescript-eslint/naming-convention const Component = Vue.extend({ props: { timePicker: { @@ -154,6 +156,7 @@ const Component = Vue.extend({ }); // Assertion corrects HTMLElement type from package +// eslint-disable-next-line @typescript-eslint/naming-convention const WrappedElement = wrap( Vue, Component diff --git a/src/components/device/ha-device-automation-picker.ts b/src/components/device/ha-device-automation-picker.ts index eefd710e5cc6..7582e2d577e3 100644 --- a/src/components/device/ha-device-automation-picker.ts +++ b/src/components/device/ha-device-automation-picker.ts @@ -24,7 +24,7 @@ export abstract class HaDeviceAutomationPicker< @property() public label?: string; - @property() public deviceId?: string; + @property({ attribute: false }) public deviceId?: string; @property({ type: Object }) public value?: T; diff --git a/src/components/entity/ha-entities-picker.ts b/src/components/entity/ha-entities-picker.ts index 6e8f18a08fed..c847538cb239 100644 --- a/src/components/entity/ha-entities-picker.ts +++ b/src/components/entity/ha-entities-picker.ts @@ -75,7 +75,7 @@ class HaEntitiesPickerLight extends LitElement { @property({ attribute: false }) public entityFilter?: HaEntityPickerEntityFilterFunc; - @property({ type: Array }) public createDomains?: string[]; + @property({ attribute: false, type: Array }) public createDomains?: string[]; protected render() { if (!this.hass) { diff --git a/src/components/entity/ha-entity-attribute-picker.ts b/src/components/entity/ha-entity-attribute-picker.ts index 0339d3f9fd3c..2468f6fe71d4 100644 --- a/src/components/entity/ha-entity-attribute-picker.ts +++ b/src/components/entity/ha-entity-attribute-picker.ts @@ -13,7 +13,7 @@ export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean; class HaEntityAttributePicker extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public entityId?: string; + @property({ attribute: false }) public entityId?: string; /** * List of attributes to be hidden. @@ -23,6 +23,7 @@ class HaEntityAttributePicker extends LitElement { @property({ type: Array, attribute: "hide-attributes" }) public hideAttributes?: string[]; + // eslint-disable-next-line lit/no-native-attributes @property({ type: Boolean }) public autofocus = false; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/entity/ha-entity-picker.ts b/src/components/entity/ha-entity-picker.ts index 854406065bf0..c245ee7b4502 100644 --- a/src/components/entity/ha-entity-picker.ts +++ b/src/components/entity/ha-entity-picker.ts @@ -34,6 +34,7 @@ const CREATE_ID = "___create-new-entity___"; export class HaEntityPicker extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; + // eslint-disable-next-line lit/no-native-attributes @property({ type: Boolean }) public autofocus = false; @property({ type: Boolean }) public disabled = false; @@ -49,7 +50,7 @@ export class HaEntityPicker extends LitElement { @property() public helper?: string; - @property({ type: Array }) public createDomains?: string[]; + @property({ attribute: false, type: Array }) public createDomains?: string[]; /** * Show entities from specific domains. @@ -102,7 +103,7 @@ export class HaEntityPicker extends LitElement { @property({ attribute: false }) public entityFilter?: HaEntityPickerEntityFilterFunc; - @property({ type: Boolean }) public hideClearIcon = false; + @property({ attribute: false, type: Boolean }) public hideClearIcon = false; @property({ attribute: "item-label-path" }) public itemLabelPath = "friendly_name"; diff --git a/src/components/entity/ha-entity-state-content-picker.ts b/src/components/entity/ha-entity-state-content-picker.ts index 819b154d06fe..b83f490167e0 100644 --- a/src/components/entity/ha-entity-state-content-picker.ts +++ b/src/components/entity/ha-entity-state-content-picker.ts @@ -79,6 +79,7 @@ class HaEntityStatePicker extends LitElement { @property({ attribute: false }) public entityId?: string; + // eslint-disable-next-line lit/no-native-attributes @property({ type: Boolean }) public autofocus = false; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/entity/ha-entity-state-picker.ts b/src/components/entity/ha-entity-state-picker.ts index 6dac27a354cf..d7b430fab85e 100644 --- a/src/components/entity/ha-entity-state-picker.ts +++ b/src/components/entity/ha-entity-state-picker.ts @@ -14,12 +14,13 @@ export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean; class HaEntityStatePicker extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public entityId?: string; + @property({ attribute: false }) public entityId?: string; @property() public attribute?: string; @property({ attribute: false }) public extraOptions?: any[]; + // eslint-disable-next-line lit/no-native-attributes @property({ type: Boolean }) public autofocus = false; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/entity/ha-state-label-badge.ts b/src/components/entity/ha-state-label-badge.ts index 7c95b71cfcd3..872733751fe5 100644 --- a/src/components/entity/ha-state-label-badge.ts +++ b/src/components/entity/ha-state-label-badge.ts @@ -55,7 +55,7 @@ export class HaStateLabelBadge extends LitElement { @property() public image?: string; - @property({ type: Boolean }) public showName = false; + @property({ attribute: false, type: Boolean }) public showName = false; @state() private _timerTimeRemaining?: number; @@ -66,13 +66,13 @@ export class HaStateLabelBadge extends LitElement { public connectedCallback(): void { super.connectedCallback(); this._connected = true; - this.startInterval(this.state); + this._startInterval(this.state); } public disconnectedCallback(): void { super.disconnectedCallback(); this._connected = false; - this.clearInterval(); + this._clearInterval(); } protected render(): TemplateResult { @@ -151,7 +151,7 @@ export class HaStateLabelBadge extends LitElement { super.updated(changedProperties); if (this._connected && changedProperties.has("state")) { - this.startInterval(this.state); + this._startInterval(this.state); } } @@ -237,28 +237,28 @@ export class HaStateLabelBadge extends LitElement { return entityState.attributes.unit_of_measurement || null; } - private clearInterval() { + private _clearInterval() { if (this._updateRemaining) { clearInterval(this._updateRemaining); this._updateRemaining = undefined; } } - private startInterval(stateObj) { - this.clearInterval(); + private _startInterval(stateObj) { + this._clearInterval(); if (stateObj && computeStateDomain(stateObj) === "timer") { - this.calculateTimerRemaining(stateObj); + this._calculateTimerRemaining(stateObj); if (stateObj.state === "active") { this._updateRemaining = window.setInterval( - () => this.calculateTimerRemaining(this.state), + () => this._calculateTimerRemaining(this.state), 1000 ); } } } - private calculateTimerRemaining(stateObj) { + private _calculateTimerRemaining(stateObj) { this._timerTimeRemaining = timerTimeRemaining(stateObj); } diff --git a/src/components/entity/ha-statistic-picker.ts b/src/components/entity/ha-statistic-picker.ts index 6361270910a9..78ffb8d2473a 100644 --- a/src/components/entity/ha-statistic-picker.ts +++ b/src/components/entity/ha-statistic-picker.ts @@ -39,7 +39,8 @@ export class HaStatisticPicker extends LitElement { @property({ type: Boolean, attribute: "allow-custom-entity" }) public allowCustomEntity; - @property({ type: Array }) public statisticIds?: StatisticsMetaData[]; + @property({ attribute: false, type: Array }) + public statisticIds?: StatisticsMetaData[]; @property({ type: Boolean }) public disabled = false; @@ -84,7 +85,8 @@ export class HaStatisticPicker extends LitElement { @property({ type: Array, attribute: "exclude-statistics" }) public excludeStatistics?: string[]; - @property() public helpMissingEntityUrl = "/more-info/statistics/"; + @property({ attribute: false }) public helpMissingEntityUrl = + "/more-info/statistics/"; @state() private _opened?: boolean; diff --git a/src/components/entity/ha-statistics-picker.ts b/src/components/entity/ha-statistics-picker.ts index f5fa02a54011..7726aea1439e 100644 --- a/src/components/entity/ha-statistics-picker.ts +++ b/src/components/entity/ha-statistics-picker.ts @@ -12,7 +12,7 @@ class HaStatisticsPicker extends LitElement { @property({ type: Array }) public value?: string[]; - @property({ type: Array }) public statisticIds?: string[]; + @property({ attribute: false, type: Array }) public statisticIds?: string[]; @property({ attribute: "statistic-types" }) public statisticTypes?: "mean" | "sum"; diff --git a/src/components/entity/state-badge.ts b/src/components/entity/state-badge.ts index 2e336f62ac2f..feb10f1bf0bb 100644 --- a/src/components/entity/state-badge.ts +++ b/src/components/entity/state-badge.ts @@ -22,9 +22,9 @@ export class StateBadge extends LitElement { @property({ attribute: false }) public stateObj?: HassEntity; - @property() public overrideIcon?: string; + @property({ attribute: false }) public overrideIcon?: string; - @property() public overrideImage?: string; + @property({ attribute: false }) public overrideImage?: string; // Cannot be a boolean attribute because undefined is treated different than // false. When it is undefined, state is still colored for light entities. diff --git a/src/components/entity/state-info.ts b/src/components/entity/state-info.ts index 3dc06d154c75..f6edee605c79 100644 --- a/src/components/entity/state-info.ts +++ b/src/components/entity/state-info.ts @@ -14,7 +14,7 @@ class StateInfo extends LitElement { @property({ attribute: false }) public stateObj?: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; @property() public color?: string; diff --git a/src/components/ha-alert.ts b/src/components/ha-alert.ts index e01f1cbc7ec2..889894f35a65 100644 --- a/src/components/ha-alert.ts +++ b/src/components/ha-alert.ts @@ -27,6 +27,7 @@ declare global { @customElement("ha-alert") class HaAlert extends LitElement { + // eslint-disable-next-line lit/no-native-attributes @property() public title = ""; @property({ attribute: "alert-type" }) public alertType: @@ -63,7 +64,7 @@ class HaAlert extends LitElement { ${this.dismissable ? html`` @@ -75,7 +76,7 @@ class HaAlert extends LitElement { `; } - private _dismiss_clicked() { + private _dismissClicked() { fireEvent(this, "alert-dismissed-clicked"); } diff --git a/src/components/ha-assist-pipeline-picker.ts b/src/components/ha-assist-pipeline-picker.ts index 9c6e461733ac..09ead83b80f7 100644 --- a/src/components/ha-assist-pipeline-picker.ts +++ b/src/components/ha-assist-pipeline-picker.ts @@ -26,7 +26,7 @@ export class HaAssistPipelinePicker extends LitElement { @property({ type: Boolean }) public required = false; - @property({ type: Boolean }) public includeLastUsed = false; + @property({ attribute: false, type: Boolean }) public includeLastUsed = false; @state() _pipelines?: AssistPipeline[]; diff --git a/src/components/ha-attribute-icon.ts b/src/components/ha-attribute-icon.ts index ac462938d013..028386a926f9 100644 --- a/src/components/ha-attribute-icon.ts +++ b/src/components/ha-attribute-icon.ts @@ -15,7 +15,7 @@ export class HaAttributeIcon extends LitElement { @property() public attribute?: string; - @property() public attributeValue?: string; + @property({ attribute: false }) public attributeValue?: string; @property() public icon?: string; diff --git a/src/components/ha-attributes.ts b/src/components/ha-attributes.ts index da9df95ddd94..9a9b467b58cd 100644 --- a/src/components/ha-attributes.ts +++ b/src/components/ha-attributes.ts @@ -20,7 +20,7 @@ class HaAttributes extends LitElement { @state() private _expanded = false; private get _filteredAttributes() { - return this.computeDisplayAttributes( + return this._computeDisplayAttributes( STATE_ATTRIBUTES.concat( this.extraFilters ? this.extraFilters.split(",") : [] ) @@ -53,7 +53,7 @@ class HaAttributes extends LitElement { "ui.components.attributes.expansion_header" )} outlined - @expanded-will-change=${this.expandedChanged} + @expanded-will-change=${this._expandedChanged} >
${this._expanded @@ -128,7 +128,7 @@ class HaAttributes extends LitElement { ]; } - private computeDisplayAttributes(filtersArray: string[]): string[] { + private _computeDisplayAttributes(filtersArray: string[]): string[] { if (!this.stateObj) { return []; } @@ -137,7 +137,7 @@ class HaAttributes extends LitElement { ); } - private expandedChanged(ev) { + private _expandedChanged(ev) { this._expanded = ev.detail.expanded; } } diff --git a/src/components/ha-base-time-input.ts b/src/components/ha-base-time-input.ts index 7f8a9ddfc0df..5a1629bb117b 100644 --- a/src/components/ha-base-time-input.ts +++ b/src/components/ha-base-time-input.ts @@ -36,7 +36,7 @@ export class HaBaseTimeInput extends LitElement { /** * auto validate time inputs */ - @property({ type: Boolean }) autoValidate = false; + @property({ attribute: false, type: Boolean }) autoValidate = false; /** * determines if inputs are required @@ -81,52 +81,52 @@ export class HaBaseTimeInput extends LitElement { /** * Label for the day input */ - @property() dayLabel = ""; + @property({ attribute: false }) dayLabel = ""; /** * Label for the hour input */ - @property() hourLabel = ""; + @property({ attribute: false }) hourLabel = ""; /** * Label for the min input */ - @property() minLabel = ""; + @property({ attribute: false }) minLabel = ""; /** * Label for the sec input */ - @property() secLabel = ""; + @property({ attribute: false }) secLabel = ""; /** * Label for the milli sec input */ - @property() millisecLabel = ""; + @property({ attribute: false }) millisecLabel = ""; /** * show the sec field */ - @property({ type: Boolean }) enableSecond = false; + @property({ attribute: false, type: Boolean }) enableSecond = false; /** * show the milli sec field */ - @property({ type: Boolean }) enableMillisecond = false; + @property({ attribute: false, type: Boolean }) enableMillisecond = false; /** * show the day field */ - @property({ type: Boolean }) enableDay = false; + @property({ attribute: false, type: Boolean }) enableDay = false; /** * limit hours input */ - @property({ type: Boolean }) noHoursLimit = false; + @property({ attribute: false, type: Boolean }) noHoursLimit = false; /** * AM or PM */ - @property() amPm: "AM" | "PM" = "AM"; + @property({ attribute: false }) amPm: "AM" | "PM" = "AM"; @property({ type: Boolean, reflect: true }) public clearable?: boolean; diff --git a/src/components/ha-button-menu.ts b/src/components/ha-button-menu.ts index 77866ee94292..9cc317347032 100644 --- a/src/components/ha-button-menu.ts +++ b/src/components/ha-button-menu.ts @@ -14,7 +14,7 @@ export class HaButtonMenu extends LitElement { @property() public corner: Corner = "BOTTOM_START"; - @property() public menuCorner: MenuCorner = "START"; + @property({ attribute: false }) public menuCorner: MenuCorner = "START"; @property({ type: Number }) public x: number | null = null; diff --git a/src/components/ha-button-toggle-group.ts b/src/components/ha-button-toggle-group.ts index ef81220d24d4..69c92070b5fe 100644 --- a/src/components/ha-button-toggle-group.ts +++ b/src/components/ha-button-toggle-group.ts @@ -14,7 +14,7 @@ export class HaButtonToggleGroup extends LitElement { @property() public active?: string; - @property({ type: Boolean }) public fullWidth = false; + @property({ attribute: false, type: Boolean }) public fullWidth = false; @property({ type: Boolean }) public dense = false; diff --git a/src/components/ha-clickable-list-item.ts b/src/components/ha-clickable-list-item.ts index 38c39a410375..e50b6cf5aa87 100644 --- a/src/components/ha-clickable-list-item.ts +++ b/src/components/ha-clickable-list-item.ts @@ -7,9 +7,10 @@ import { HaListItem } from "./ha-list-item"; export class HaClickableListItem extends HaListItem { @property() public href?: string; - @property({ type: Boolean }) public disableHref = false; + @property({ attribute: false, type: Boolean }) public disableHref = false; - @property({ type: Boolean, reflect: true }) public openNewTab = false; + @property({ attribute: false, type: Boolean, reflect: true }) + public openNewTab = false; @query("a") private _anchor!: HTMLAnchorElement; @@ -18,7 +19,7 @@ export class HaClickableListItem extends HaListItem { const href = this.href || ""; return html`${this.disableHref - ? html`${r}` + ? html`${r}` : html`${r}`}`; @@ -44,6 +45,9 @@ export class HaClickableListItem extends HaListItem { align-items: center; overflow: hidden; } + .disabled { + pointer-events: none; + } `, ]; } diff --git a/src/components/ha-code-editor.ts b/src/components/ha-code-editor.ts index c9651ef45859..dcd774a54d48 100644 --- a/src/components/ha-code-editor.ts +++ b/src/components/ha-code-editor.ts @@ -44,9 +44,10 @@ export class HaCodeEditor extends ReactiveElement { public hass?: HomeAssistant; + // eslint-disable-next-line lit/no-native-attributes @property({ type: Boolean }) public autofocus = false; - @property({ type: Boolean }) public readOnly = false; + @property({ attribute: false, type: Boolean }) public readOnly = false; @property({ type: Boolean }) public linewrap = false; diff --git a/src/components/ha-color-picker.ts b/src/components/ha-color-picker.ts index 801f17088552..6800fbdd20e4 100644 --- a/src/components/ha-color-picker.ts +++ b/src/components/ha-color-picker.ts @@ -82,7 +82,7 @@ export class HaColorPicker extends LitElement { ` : value === "state" ? html`` - : this.renderColorCircle(value || "grey")} + : this._renderColorCircle(value || "grey")} ` : nothing} @@ -123,7 +123,7 @@ export class HaColorPicker extends LitElement { ${this.defaultColor === color ? ` (${this.hass.localize("ui.components.color-picker.default")})` : nothing} - ${this.renderColorCircle(color)} + ${this._renderColorCircle(color)} ` )} @@ -131,7 +131,7 @@ export class HaColorPicker extends LitElement { ? html` ${value} - ${this.renderColorCircle(value)} + ${this._renderColorCircle(value)} ` : nothing} @@ -139,7 +139,7 @@ export class HaColorPicker extends LitElement { `; } - private renderColorCircle(color: string) { + private _renderColorCircle(color: string) { return html` - ${this.renderIcon()} + ${this._renderIcon()}
${this.hideLabel ? nothing @@ -71,7 +72,7 @@ export class HaControlSelectMenu extends SelectBase { ? html`

${this.selectedText}

` : nothing}
- ${this.renderArrow()} + ${this._renderArrow()}
${this.renderMenu()} @@ -79,7 +80,7 @@ export class HaControlSelectMenu extends SelectBase { `; } - private renderArrow() { + private _renderArrow() { if (!this.showArrow) return nothing; return html` @@ -89,7 +90,7 @@ export class HaControlSelectMenu extends SelectBase { `; } - private renderIcon() { + private _renderIcon() { const index = this.mdcFoundation?.getSelectedIndex(); const items = this.menuElement?.items ?? []; const item = index != null ? items[index] : undefined; diff --git a/src/components/ha-control-slider.ts b/src/components/ha-control-slider.ts index 17380736eef9..3d6b7f5817d1 100644 --- a/src/components/ha-control-slider.ts +++ b/src/components/ha-control-slider.ts @@ -215,12 +215,12 @@ export class HaControlSlider extends LitElement { return Math.max(this.step, (this.max - this.min) / 10); } - _showTooltip() { + private _showTooltip() { if (this._tooltipTimeout != null) window.clearTimeout(this._tooltipTimeout); this.tooltipVisible = true; } - _hideTooltip(delay?: number) { + private _hideTooltip(delay?: number) { if (!delay) { this.tooltipVisible = false; return; @@ -230,7 +230,7 @@ export class HaControlSlider extends LitElement { }, delay); } - _handleKeyDown(e: KeyboardEvent) { + private _handleKeyDown(e: KeyboardEvent) { if (!A11Y_KEY_CODES.has(e.code)) return; e.preventDefault(); switch (e.code) { @@ -265,7 +265,7 @@ export class HaControlSlider extends LitElement { private _tooltipTimeout?: number; - _handleKeyUp(e: KeyboardEvent) { + private _handleKeyUp(e: KeyboardEvent) { if (!A11Y_KEY_CODES.has(e.code)) return; e.preventDefault(); this._hideTooltip(500); diff --git a/src/components/ha-control-switch.ts b/src/components/ha-control-switch.ts index d7ecd799f1f1..ba14bd5215a7 100644 --- a/src/components/ha-control-switch.ts +++ b/src/components/ha-control-switch.ts @@ -22,10 +22,10 @@ export class HaControlSwitch extends LitElement { @property({ type: Boolean, reflect: true }) public checked = false; // SVG icon path (if you need a non SVG icon instead, use the provided on icon slot to pass an in) - @property({ type: String }) pathOn?: string; + @property({ attribute: false, type: String }) pathOn?: string; // SVG icon path (if you need a non SVG icon instead, use the provided off icon slot to pass an in) - @property({ type: String }) pathOff?: string; + @property({ attribute: false, type: String }) pathOff?: string; @property({ attribute: "touch-action" }) public touchAction?: string; diff --git a/src/components/ha-country-picker.ts b/src/components/ha-country-picker.ts index 8f54e0256dac..a84e96af6570 100644 --- a/src/components/ha-country-picker.ts +++ b/src/components/ha-country-picker.ts @@ -277,7 +277,7 @@ export class HaCountryPicker extends LitElement { @property({ type: Boolean, reflect: true }) public disabled = false; - @property({ type: Boolean }) public noSort = false; + @property({ attribute: false, type: Boolean }) public noSort = false; private _getOptions = memoizeOne( (language?: string, countries?: string[]) => { diff --git a/src/components/ha-date-input.ts b/src/components/ha-date-input.ts index 50c91f3dcfa2..7d3524851e28 100644 --- a/src/components/ha-date-input.ts +++ b/src/components/ha-date-input.ts @@ -13,7 +13,7 @@ import "./ha-textfield"; const loadDatePickerDialog = () => import("./ha-dialog-date-picker"); -export interface datePickerDialogParams { +export interface DatePickerDialogParams { value?: string; min?: string; max?: string; @@ -25,7 +25,7 @@ export interface datePickerDialogParams { const showDatePickerDialog = ( element: HTMLElement, - dialogParams: datePickerDialogParams + dialogParams: DatePickerDialogParams ): void => { fireEvent(element, "show-dialog", { dialogTag: "ha-dialog-date-picker", @@ -51,7 +51,7 @@ export class HaDateInput extends LitElement { @property() public helper?: string; - @property({ type: Boolean }) public canClear = false; + @property({ attribute: false, type: Boolean }) public canClear = false; render() { return html` { + public async showDialog(params: DatePickerDialogParams): Promise { // app-datepicker has a bug, that it removes its handlers when disconnected, but doesn't add them back when reconnected. // So we need to wait for the next render to make sure the element is removed and re-created so the handlers are added. await nextRender(); diff --git a/src/components/ha-domain-icon.ts b/src/components/ha-domain-icon.ts index f23b0fb3e799..7d85f53ed8cf 100644 --- a/src/components/ha-domain-icon.ts +++ b/src/components/ha-domain-icon.ts @@ -14,11 +14,11 @@ export class HaDomainIcon extends LitElement { @property() public domain?: string; - @property() public deviceClass?: string; + @property({ attribute: false }) public deviceClass?: string; @property() public icon?: string; - @property({ type: Boolean }) public brandFallback?: boolean; + @property({ attribute: false, type: Boolean }) public brandFallback?: boolean; protected render() { if (this.icon) { diff --git a/src/components/ha-duration-input.ts b/src/components/ha-duration-input.ts index 2b35d622ad72..6306a926626a 100644 --- a/src/components/ha-duration-input.ts +++ b/src/components/ha-duration-input.ts @@ -23,9 +23,10 @@ class HaDurationInput extends LitElement { @property({ type: Boolean }) public required = false; - @property({ type: Boolean }) public enableMillisecond = false; + @property({ attribute: false, type: Boolean }) public enableMillisecond = + false; - @property({ type: Boolean }) public enableDay = false; + @property({ attribute: false, type: Boolean }) public enableDay = false; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/ha-expansion-panel.ts b/src/components/ha-expansion-panel.ts index 02f767e8301d..84da9fc5cc06 100644 --- a/src/components/ha-expansion-panel.ts +++ b/src/components/ha-expansion-panel.ts @@ -13,9 +13,11 @@ export class HaExpansionPanel extends LitElement { @property({ type: Boolean, reflect: true }) outlined = false; - @property({ type: Boolean, reflect: true }) leftChevron = false; + @property({ attribute: false, type: Boolean, reflect: true }) leftChevron = + false; - @property({ type: Boolean, reflect: true }) noCollapse = false; + @property({ attribute: false, type: Boolean, reflect: true }) noCollapse = + false; @property() header?: string; diff --git a/src/components/ha-form/ha-form-string.ts b/src/components/ha-form/ha-form-string.ts index bc20aff73722..7cd1a67bbcdb 100644 --- a/src/components/ha-form/ha-form-string.ts +++ b/src/components/ha-form/ha-form-string.ts @@ -22,7 +22,8 @@ const MASKED_FIELDS = ["password", "secret", "token"]; export class HaFormString extends LitElement implements HaFormElement { @property({ attribute: false }) public localize?: LocalizeFunc; - @property() public localizeBaseKey = "ui.components.selectors.text"; + @property({ attribute: false }) public localizeBaseKey = + "ui.components.selectors.text"; @property({ attribute: false }) public schema!: HaFormStringSchema; diff --git a/src/components/ha-gauge.ts b/src/components/ha-gauge.ts index eeddd6c75070..cf38f90c70fe 100644 --- a/src/components/ha-gauge.ts +++ b/src/components/ha-gauge.ts @@ -30,7 +30,7 @@ export class HaGauge extends LitElement { @property({ attribute: false }) public formatOptions?: Intl.NumberFormatOptions; - @property({ type: String }) public valueText?: string; + @property({ attribute: false, type: String }) public valueText?: string; @property({ attribute: false }) public locale!: FrontendLocaleData; @@ -52,8 +52,8 @@ export class HaGauge extends LitElement { afterNextRender(() => { this._updated = true; this._angle = getAngle(this.value, this.min, this.max); - this._segment_label = this.getSegmentLabel(); - this._rescale_svg(); + this._segment_label = this._getSegmentLabel(); + this._rescaleSvg(); }); } @@ -68,8 +68,8 @@ export class HaGauge extends LitElement { return; } this._angle = getAngle(this.value, this.min, this.max); - this._segment_label = this.getSegmentLabel(); - this._rescale_svg(); + this._segment_label = this._getSegmentLabel(); + this._rescaleSvg(); } protected render() { @@ -149,7 +149,7 @@ export class HaGauge extends LitElement { `; } - private _rescale_svg() { + private _rescaleSvg() { // Set the viewbox of the SVG containing the value to perfectly // fit the text // That way it will auto-scale correctly @@ -161,7 +161,7 @@ export class HaGauge extends LitElement { ); } - private getSegmentLabel() { + private _getSegmentLabel() { if (this.levels) { this.levels.sort((a, b) => a.level - b.level); for (let i = this.levels.length - 1; i >= 0; i--) { diff --git a/src/components/ha-grid-size-picker.ts b/src/components/ha-grid-size-picker.ts index 49a293e33d25..866298a20dec 100644 --- a/src/components/ha-grid-size-picker.ts +++ b/src/components/ha-grid-size-picker.ts @@ -149,7 +149,7 @@ export class HaGridSizeEditor extends LitElement { `; } - _cellClick(ev) { + private _cellClick(ev) { const cell = ev.currentTarget as HTMLElement; const rows = Number(cell.getAttribute("data-row")); const columns = Number(cell.getAttribute("data-column")); diff --git a/src/components/ha-hls-player.ts b/src/components/ha-hls-player.ts index 11280c3833e1..1b195259c106 100644 --- a/src/components/ha-hls-player.ts +++ b/src/components/ha-hls-player.ts @@ -139,6 +139,7 @@ class HaHLSPlayer extends LitElement { private async _startHls(): Promise { const masterPlaylistPromise = fetch(this._url); + // eslint-disable-next-line @typescript-eslint/naming-convention const Hls: typeof HlsType = (await import("hls.js/dist/hls.light.mjs")) .default; diff --git a/src/components/ha-hs-color-picker.ts b/src/components/ha-hs-color-picker.ts index 8e77b8ebc965..24f8c79110b4 100644 --- a/src/components/ha-hs-color-picker.ts +++ b/src/components/ha-hs-color-picker.ts @@ -119,7 +119,7 @@ class HaHsColorPicker extends LitElement { @property({ type: Array }) public value?: [number, number]; - @property({ type: Number }) + @property({ attribute: false, type: Number }) public colorBrightness?: number; @property({ type: Number }) @@ -131,10 +131,10 @@ class HaHsColorPicker extends LitElement { @property({ type: Number }) public ww?: number; - @property({ type: Number }) + @property({ attribute: false, type: Number }) public minKelvin?: number; - @property({ type: Number }) + @property({ attribute: false, type: Number }) public maxKelvin?: number; @query("#canvas") private _canvas!: HTMLCanvasElement; @@ -201,7 +201,7 @@ class HaHsColorPicker extends LitElement { } } - _setupListeners() { + private _setupListeners() { if (this._canvas && !this._mc) { this._mc = new Manager(this._canvas); this._mc.add( @@ -292,11 +292,11 @@ class HaHsColorPicker extends LitElement { const _y = (2 * (y - offsetY)) / maxY - 1; const [r, phi] = xy2polar(_x, _y); - const [__x, __y] = polar2xy(Math.min(1, r), phi); - return [__x, __y]; + const [xx, yy] = polar2xy(Math.min(1, r), phi); + return [xx, yy]; }; - _destroyListeners() { + private _destroyListeners() { if (this._mc) { this._mc.destroy(); this._mc = undefined; diff --git a/src/components/ha-icon-button.ts b/src/components/ha-icon-button.ts index 9d44dbe210a7..5f067a2835b7 100644 --- a/src/components/ha-icon-button.ts +++ b/src/components/ha-icon-button.ts @@ -21,7 +21,7 @@ export class HaIconButton extends LitElement { @property({ type: String, attribute: "aria-haspopup" }) override ariaHasPopup!: IconButton["ariaHasPopup"]; - @property({ type: Boolean }) hideTitle = false; + @property({ attribute: false, type: Boolean }) hideTitle = false; @query("mwc-icon-button", true) private _button?: IconButton; diff --git a/src/components/ha-language-picker.ts b/src/components/ha-language-picker.ts index d475f1eda8a4..650f5223158e 100644 --- a/src/components/ha-language-picker.ts +++ b/src/components/ha-language-picker.ts @@ -27,11 +27,11 @@ export class HaLanguagePicker extends LitElement { @property({ type: Boolean }) public required = false; - @property({ type: Boolean }) public nativeName = false; + @property({ attribute: false, type: Boolean }) public nativeName = false; - @property({ type: Boolean }) public noSort = false; + @property({ attribute: false, type: Boolean }) public noSort = false; - @property({ type: Boolean }) public inlineArrow = false; + @property({ attribute: false, type: Boolean }) public inlineArrow = false; @state() _defaultLanguages: string[] = []; diff --git a/src/components/ha-markdown-element.ts b/src/components/ha-markdown-element.ts index e291a54cce35..d2400b74ce21 100644 --- a/src/components/ha-markdown-element.ts +++ b/src/components/ha-markdown-element.ts @@ -19,7 +19,7 @@ const _gitHubMarkdownAlerts = { class HaMarkdownElement extends ReactiveElement { @property() public content?; - @property({ type: Boolean }) public allowSvg = false; + @property({ attribute: false, type: Boolean }) public allowSvg = false; @property({ type: Boolean }) public breaks = false; diff --git a/src/components/ha-markdown.ts b/src/components/ha-markdown.ts index 179c3e3521e6..52dbdb8f40ea 100644 --- a/src/components/ha-markdown.ts +++ b/src/components/ha-markdown.ts @@ -7,7 +7,7 @@ import "./ha-markdown-element"; export class HaMarkdown extends LitElement { @property() public content?; - @property({ type: Boolean }) public allowSvg = false; + @property({ attribute: false, type: Boolean }) public allowSvg = false; @property({ type: Boolean }) public breaks = false; diff --git a/src/components/ha-md-dialog.ts b/src/components/ha-md-dialog.ts index 7ee73d7866d5..be767c6eb6d5 100644 --- a/src/components/ha-md-dialog.ts +++ b/src/components/ha-md-dialog.ts @@ -116,7 +116,7 @@ export class HaMdDialog extends MdDialog { }); } - _handleCancel(closeEvent: Event) { + private _handleCancel(closeEvent: Event) { if (this.disableCancelAction) { closeEvent.preventDefault(); const dialogElement = this.shadowRoot?.querySelector("dialog .container"); diff --git a/src/components/ha-mount-picker.ts b/src/components/ha-mount-picker.ts index c61689f195ba..ab861ac90a13 100644 --- a/src/components/ha-mount-picker.ts +++ b/src/components/ha-mount-picker.ts @@ -18,7 +18,7 @@ import "./ha-list-item"; import "./ha-select"; import type { HaSelect } from "./ha-select"; -const __BACKUP_DATA_DISK__ = "/backup"; +const _BACKUP_DATA_DISK_ = "/backup"; @customElement("ha-mount-picker") class HaMountPicker extends LitElement { @@ -53,7 +53,7 @@ class HaMountPicker extends LitElement { } const dataDiskOption = html` ${this.hass.localize("ui.components.mount-picker.use_datadisk") || @@ -77,7 +77,7 @@ class HaMountPicker extends LitElement { > ${this.usage === SupervisorMountUsage.BACKUP && (!this._mounts.default_backup_mount || - this._mounts.default_backup_mount === __BACKUP_DATA_DISK__) + this._mounts.default_backup_mount === _BACKUP_DATA_DISK_) ? dataDiskOption : nothing} ${this._filterMounts(this._mounts, this.usage).map( @@ -138,8 +138,7 @@ class HaMountPicker extends LitElement { if (isComponentLoaded(this.hass, "hassio")) { this._mounts = await fetchSupervisorMounts(this.hass); if (this.usage === SupervisorMountUsage.BACKUP && !this.value) { - this.value = - this._mounts.default_backup_mount || __BACKUP_DATA_DISK__; + this.value = this._mounts.default_backup_mount || _BACKUP_DATA_DISK_; } } else { this._error = this.hass.localize( diff --git a/src/components/ha-multi-textfield.ts b/src/components/ha-multi-textfield.ts index 44d8863855b8..2e5e5e73d94a 100644 --- a/src/components/ha-multi-textfield.ts +++ b/src/components/ha-multi-textfield.ts @@ -20,17 +20,17 @@ class HaMultiTextField extends LitElement { @property() public label?: string; - @property() public inputType?: string; + @property({ attribute: false }) public inputType?: string; - @property() public inputSuffix?: string; + @property({ attribute: false }) public inputSuffix?: string; - @property() public inputPrefix?: string; + @property({ attribute: false }) public inputPrefix?: string; - @property() public autocomplete?: string; + @property({ attribute: false }) public autocomplete?: string; - @property() public addLabel?: string; + @property({ attribute: false }) public addLabel?: string; - @property() public removeLabel?: string; + @property({ attribute: false }) public removeLabel?: string; @property({ attribute: "item-index", type: Boolean }) public itemIndex = false; diff --git a/src/components/ha-navigation-list.ts b/src/components/ha-navigation-list.ts index 4b000bbcdc6b..16139441ba7a 100644 --- a/src/components/ha-navigation-list.ts +++ b/src/components/ha-navigation-list.ts @@ -19,7 +19,7 @@ class HaNavigationList extends LitElement { @property({ attribute: false }) public pages!: PageNavigation[]; - @property({ type: Boolean }) public hasSecondary = false; + @property({ attribute: false, type: Boolean }) public hasSecondary = false; @property() public label?: string; diff --git a/src/components/ha-password-field.ts b/src/components/ha-password-field.ts index 15fd9666dd34..1323aaa06269 100644 --- a/src/components/ha-password-field.ts +++ b/src/components/ha-password-field.ts @@ -23,7 +23,7 @@ export class HaPasswordField extends LitElement { @property({ type: Boolean }) public icon = false; - @property({ type: Boolean }) public iconTrailing = false; + @property({ attribute: false, type: Boolean }) public iconTrailing = false; @property() public autocomplete?: string; @@ -42,30 +42,32 @@ export class HaPasswordField extends LitElement { @property({ type: Boolean }) required = false; - @property({ type: Number }) minLength = -1; + @property({ attribute: false, type: Number }) minLength = -1; - @property({ type: Number }) maxLength = -1; + @property({ attribute: false, type: Number }) maxLength = -1; @property({ type: Boolean, reflect: true }) outlined = false; @property({ type: String }) helper = ""; - @property({ type: Boolean }) validateOnInitialRender = false; + @property({ attribute: false, type: Boolean }) validateOnInitialRender = + false; - @property({ type: String }) validationMessage = ""; + @property({ attribute: false, type: String }) validationMessage = ""; - @property({ type: Boolean }) autoValidate = false; + @property({ attribute: false, type: Boolean }) autoValidate = false; @property({ type: String }) pattern = ""; @property({ type: Number }) size: number | null = null; - @property({ type: Boolean }) helperPersistent = false; + @property({ attribute: false, type: Boolean }) helperPersistent = false; - @property({ type: Boolean }) charCounter: boolean | TextAreaCharCounter = - false; + @property({ attribute: false, type: Boolean }) charCounter: + | boolean + | TextAreaCharCounter = false; - @property({ type: Boolean }) endAligned = false; + @property({ attribute: false, type: Boolean }) endAligned = false; @property({ type: String }) prefix = ""; @@ -76,9 +78,10 @@ export class HaPasswordField extends LitElement { @property({ type: String, attribute: "input-mode" }) inputMode!: string; - @property({ type: Boolean }) readOnly = false; + @property({ attribute: false, type: Boolean }) readOnly = false; - @property({ type: String }) autocapitalize = ""; + // eslint-disable-next-line lit/no-native-attributes + @property({ attribute: false, type: String }) autocapitalize = ""; @state() private _unmaskedPassword = false; diff --git a/src/components/ha-picture-upload.ts b/src/components/ha-picture-upload.ts index b3ff842322ce..c61fecc87c06 100644 --- a/src/components/ha-picture-upload.ts +++ b/src/components/ha-picture-upload.ts @@ -25,7 +25,7 @@ export class HaPictureUpload extends LitElement { @property() public supports?: string; - @property() public currentImageAltText?: string; + @property({ attribute: false }) public currentImageAltText?: string; @property({ type: Boolean }) public crop = false; diff --git a/src/components/ha-qr-code.ts b/src/components/ha-qr-code.ts index d5063a42f481..31499f0a200f 100644 --- a/src/components/ha-qr-code.ts +++ b/src/components/ha-qr-code.ts @@ -22,15 +22,8 @@ export class HaQrCode extends LitElement { @property({ type: Number }) public margin = 4; - @property({ type: Number }) public maskPattern?: - | 0 - | 1 - | 2 - | 3 - | 4 - | 5 - | 6 - | 7; + @property({ attribute: false, type: Number }) + public maskPattern?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; @property({ attribute: "center-image" }) public centerImage?: string; diff --git a/src/components/ha-qr-scanner.ts b/src/components/ha-qr-scanner.ts index 2869b1986d80..e90e94e459df 100644 --- a/src/components/ha-qr-scanner.ts +++ b/src/components/ha-qr-scanner.ts @@ -160,6 +160,7 @@ class HaQrScanner extends LitElement { if (!navigator.mediaDevices) { return; } + // eslint-disable-next-line @typescript-eslint/naming-convention const QrScanner = (await import("qr-scanner")).default; if (!(await QrScanner.hasCamera())) { this._reportError("No camera found"); diff --git a/src/components/ha-related-items.ts b/src/components/ha-related-items.ts index c32ac07fb81f..6f75a0c0e0a1 100644 --- a/src/components/ha-related-items.ts +++ b/src/components/ha-related-items.ts @@ -30,9 +30,9 @@ import "./ha-switch"; export class HaRelatedItems extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public itemType!: ItemType; + @property({ attribute: false }) public itemType!: ItemType; - @property() public itemId!: string; + @property({ attribute: false }) public itemId!: string; @state() private _entries?: ConfigEntry[]; diff --git a/src/components/ha-ripple.ts b/src/components/ha-ripple.ts index e5f9ba9f7dc8..9df52b925b4f 100644 --- a/src/components/ha-ripple.ts +++ b/src/components/ha-ripple.ts @@ -7,7 +7,7 @@ import { customElement } from "lit/decorators"; export class HaRipple extends MdRipple { private readonly attachableTouchController = new AttachableController( this, - this.onTouchControlChange.bind(this) + this._onTouchControlChange.bind(this) ); attach(control: HTMLElement) { @@ -27,7 +27,7 @@ export class HaRipple extends MdRipple { } }; - private onTouchControlChange( + private _onTouchControlChange( prev: HTMLElement | null, next: HTMLElement | null ) { diff --git a/src/components/ha-select.ts b/src/components/ha-select.ts index 96ea190fcf1b..7fce69b9ccc7 100644 --- a/src/components/ha-select.ts +++ b/src/components/ha-select.ts @@ -14,7 +14,7 @@ export class HaSelect extends SelectBase { @property({ type: Boolean, reflect: true }) public clearable = false; - @property({ type: Boolean }) public inlineArrow = false; + @property({ attribute: false, type: Boolean }) public inlineArrow = false; protected override render() { return html` diff --git a/src/components/ha-service-control.ts b/src/components/ha-service-control.ts index 3265b2940806..3bba2598351a 100644 --- a/src/components/ha-service-control.ts +++ b/src/components/ha-service-control.ts @@ -86,11 +86,12 @@ export class HaServiceControl extends LitElement { @property({ type: Boolean, reflect: true }) public narrow = false; - @property({ type: Boolean }) public showAdvanced = false; + @property({ attribute: false, type: Boolean }) public showAdvanced = false; - @property({ type: Boolean, reflect: true }) public hidePicker = false; + @property({ attribute: false, type: Boolean, reflect: true }) + public hidePicker = false; - @property({ type: Boolean }) public hideDescription = false; + @property({ attribute: false, type: Boolean }) public hideDescription = false; @state() private _value!: this["value"]; diff --git a/src/components/ha-sidebar.ts b/src/components/ha-sidebar.ts index 1d1166050a6e..3af1b5e4d8da 100644 --- a/src/components/ha-sidebar.ts +++ b/src/components/ha-sidebar.ts @@ -184,9 +184,9 @@ class HaSidebar extends SubscribeMixin(LitElement) { @property({ attribute: false }) public route!: Route; - @property({ type: Boolean }) public alwaysExpand = false; + @property({ attribute: false, type: Boolean }) public alwaysExpand = false; - @property({ type: Boolean }) public editMode = false; + @property({ attribute: false, type: Boolean }) public editMode = false; @state() private _notifications?: PersistentNotification[]; @@ -284,10 +284,10 @@ class HaSidebar extends SubscribeMixin(LitElement) { protected firstUpdated(changedProps: PropertyValues) { super.firstUpdated(changedProps); - this.subscribePersistentNotifications(); + this._subscribePersistentNotifications(); } - private subscribePersistentNotifications(): void { + private _subscribePersistentNotifications(): void { if (this._unsubPersistentNotifications) { this._unsubPersistentNotifications(); } @@ -316,7 +316,7 @@ class HaSidebar extends SubscribeMixin(LitElement) { changedProps.get("hass")?.connected === false && this.hass.connected === true ) { - this.subscribePersistentNotifications(); + this._subscribePersistentNotifications(); } this._calculateCounts(); @@ -441,6 +441,7 @@ class HaSidebar extends SubscribeMixin(LitElement) { : html` - + ${!this.alwaysExpand && (this._updatesCount > 0 || this._issuesCount > 0) @@ -597,6 +603,7 @@ class HaSidebar extends SubscribeMixin(LitElement) { @@ -628,6 +635,7 @@ class HaSidebar extends SubscribeMixin(LitElement) { data-panel="panel" tabindex="-1" role="option" + aria-selected=${this.hass.panelUrl === "profile"} aria-label=${this.hass.localize("panel.profile")} @mouseenter=${this._itemMouseEnter} @mouseleave=${this._itemMouseLeave} @@ -657,6 +665,7 @@ class HaSidebar extends SubscribeMixin(LitElement) { )} href="#external-app-configuration" tabindex="-1" + aria-selected="false" @click=${this._handleExternalAppConfiguration} @mouseenter=${this._itemMouseEnter} @mouseleave=${this._itemMouseLeave} diff --git a/src/components/ha-sortable.ts b/src/components/ha-sortable.ts index 88feb7dfbafe..d65b5a475019 100644 --- a/src/components/ha-sortable.ts +++ b/src/components/ha-sortable.ts @@ -132,6 +132,7 @@ export class HaSortable extends LitElement { if (!container) return; + // eslint-disable-next-line @typescript-eslint/naming-convention const Sortable = (await import("../resources/sortable")).default; const options: SortableInstance.Options = { diff --git a/src/components/ha-svg-icon.ts b/src/components/ha-svg-icon.ts index a6d0e1c2f265..b950e37786af 100644 --- a/src/components/ha-svg-icon.ts +++ b/src/components/ha-svg-icon.ts @@ -6,9 +6,9 @@ import { customElement, property } from "lit/decorators"; export class HaSvgIcon extends LitElement { @property() public path?: string; - @property() public secondaryPath?: string; + @property({ attribute: false }) public secondaryPath?: string; - @property() public viewBox?: string; + @property({ attribute: false }) public viewBox?: string; protected render(): SVGTemplateResult { return svg` diff --git a/src/components/ha-tabs.ts b/src/components/ha-tabs.ts index c7abfda56943..d175b37748d1 100644 --- a/src/components/ha-tabs.ts +++ b/src/components/ha-tabs.ts @@ -5,6 +5,7 @@ import type { PaperTabsElement } from "@polymer/paper-tabs/paper-tabs"; import { customElement } from "lit/decorators"; import type { Constructor } from "../types"; +// eslint-disable-next-line @typescript-eslint/naming-convention const PaperTabs = customElements.get( "paper-tabs" ) as Constructor; @@ -53,6 +54,7 @@ export class HaTabs extends PaperTabs { } // Get first and last tab's width for _affectScroll + // eslint-disable-next-line @typescript-eslint/naming-convention public _tabChanged(tab: PaperTabElement, old: PaperTabElement): void { super._tabChanged(tab, old); const tabs = this.querySelectorAll("paper-tab:not(.hide-tab)"); @@ -74,6 +76,7 @@ export class HaTabs extends PaperTabs { * while scrolling and the tab container shrinks we can counteract * the jump in tab position so that the scroll still appears smooth. */ + // eslint-disable-next-line @typescript-eslint/naming-convention public _affectScroll(dx: number): void { if (this._firstTabWidth === 0 || this._lastTabWidth === 0) { return; diff --git a/src/components/ha-target-picker.ts b/src/components/ha-target-picker.ts index f7ba2fd5cad5..67cbc98957be 100644 --- a/src/components/ha-target-picker.ts +++ b/src/components/ha-target-picker.ts @@ -58,7 +58,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) { @property() public helper?: string; - @property({ type: Array }) public createDomains?: string[]; + @property({ attribute: false, type: Array }) public createDomains?: string[]; /** * Show only targets with entities from specific domains. @@ -84,7 +84,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) { @property({ type: Boolean, reflect: true }) public disabled = false; - @property({ type: Boolean }) public addOnTop = false; + @property({ attribute: false, type: Boolean }) public addOnTop = false; @state() private _addMode?: | "area_id" diff --git a/src/components/ha-textfield.ts b/src/components/ha-textfield.ts index 5e68bed7a1e0..df03a5d55068 100644 --- a/src/components/ha-textfield.ts +++ b/src/components/ha-textfield.ts @@ -15,7 +15,7 @@ export class HaTextField extends TextFieldBase { @property({ type: Boolean }) public icon = false; // @ts-ignore - @property({ type: Boolean }) public iconTrailing = false; + @property({ attribute: false, type: Boolean }) public iconTrailing = false; @property() public autocomplete?: string; diff --git a/src/components/ha-theme-picker.ts b/src/components/ha-theme-picker.ts index 91d0ffccff07..510d9d188244 100644 --- a/src/components/ha-theme-picker.ts +++ b/src/components/ha-theme-picker.ts @@ -15,7 +15,7 @@ export class HaThemePicker extends LitElement { @property() public label?: string; - @property({ type: Boolean }) includeDefault = false; + @property({ attribute: false, type: Boolean }) includeDefault = false; @property({ attribute: false }) public hass?: HomeAssistant; diff --git a/src/components/ha-tts-voice-picker.ts b/src/components/ha-tts-voice-picker.ts index e3c1ce53f467..c35921a3cd95 100644 --- a/src/components/ha-tts-voice-picker.ts +++ b/src/components/ha-tts-voice-picker.ts @@ -19,7 +19,7 @@ export class HaTTSVoicePicker extends LitElement { @property() public label?: string; - @property() public engineId?: string; + @property({ attribute: false }) public engineId?: string; @property() public language?: string; diff --git a/src/components/ha-two-pane-top-app-bar-fixed.ts b/src/components/ha-two-pane-top-app-bar-fixed.ts index eeb71a8e6c0b..e42a96c3a36b 100644 --- a/src/components/ha-two-pane-top-app-bar-fixed.ts +++ b/src/components/ha-two-pane-top-app-bar-fixed.ts @@ -32,7 +32,7 @@ export class TopAppBarBaseBase extends BaseElement { protected _scrollTarget!: HTMLElement | Window; - @property({ type: Boolean }) centerTitle = false; + @property({ attribute: false, type: Boolean }) centerTitle = false; @property({ type: Boolean, reflect: true }) prominent = false; @@ -46,7 +46,7 @@ export class TopAppBarBaseBase extends BaseElement { @query(".pane .ha-scrollbar") private _paneElement?: HTMLElement; - @property({ type: Object }) + @property({ attribute: false, type: Object }) get scrollTarget() { return this._scrollTarget || window; } diff --git a/src/components/ha-water_heater-state.ts b/src/components/ha-water_heater-state.ts index 43a81faf5148..27c287791514 100644 --- a/src/components/ha-water_heater-state.ts +++ b/src/components/ha-water_heater-state.ts @@ -51,10 +51,6 @@ export class HaWaterHeaterState extends LitElement { return ""; } - _localizeState(stateObj) { - return this.hass.formatEntityState(stateObj); - } - static get styles(): CSSResultGroup { return [ haStyle, diff --git a/src/components/ha-yaml-editor.ts b/src/components/ha-yaml-editor.ts index ee16a8c8a85b..7e74759d7608 100644 --- a/src/components/ha-yaml-editor.ts +++ b/src/components/ha-yaml-editor.ts @@ -32,21 +32,21 @@ export class HaYamlEditor extends LitElement { @property({ attribute: false }) public yamlSchema: Schema = DEFAULT_SCHEMA; - @property() public defaultValue?: any; + @property({ attribute: false }) public defaultValue?: any; - @property({ type: Boolean }) public isValid = true; + @property({ attribute: false, type: Boolean }) public isValid = true; @property() public label?: string; - @property({ type: Boolean }) public autoUpdate = false; + @property({ attribute: false, type: Boolean }) public autoUpdate = false; - @property({ type: Boolean }) public readOnly = false; + @property({ attribute: false, type: Boolean }) public readOnly = false; @property({ type: Boolean }) public required = false; - @property({ type: Boolean }) public copyClipboard = false; + @property({ attribute: false, type: Boolean }) public copyClipboard = false; - @property({ type: Boolean }) public hasExtraActions = false; + @property({ attribute: false, type: Boolean }) public hasExtraActions = false; @state() private _yaml = ""; diff --git a/src/components/map/ha-locations-editor.ts b/src/components/map/ha-locations-editor.ts index e9329736b49a..720b9ca666d9 100644 --- a/src/components/map/ha-locations-editor.ts +++ b/src/components/map/ha-locations-editor.ts @@ -51,7 +51,7 @@ export class HaLocationsEditor extends LitElement { @property() public helper?: string; - @property({ type: Boolean }) public autoFit = false; + @property({ attribute: false, type: Boolean }) public autoFit = false; @property({ type: Number }) public zoom = 16; diff --git a/src/components/map/ha-map.ts b/src/components/map/ha-map.ts index d2d44f2ade3e..e4a72802e717 100644 --- a/src/components/map/ha-map.ts +++ b/src/components/map/ha-map.ts @@ -69,13 +69,14 @@ export class HaMap extends ReactiveElement { @property({ type: Boolean }) public clickable = false; - @property({ type: Boolean }) public autoFit = false; + @property({ attribute: false, type: Boolean }) public autoFit = false; - @property({ type: Boolean }) public renderPassive = false; + @property({ attribute: false, type: Boolean }) public renderPassive = false; - @property({ type: Boolean }) public interactiveZones = false; + @property({ attribute: false, type: Boolean }) public interactiveZones = + false; - @property({ type: Boolean }) public fitZones = false; + @property({ attribute: false, type: Boolean }) public fitZones = false; @property({ attribute: "theme-mode", type: String }) public themeMode: ThemeMode = "auto"; @@ -318,6 +319,7 @@ export class HaMap extends ReactiveElement { private _drawPaths(): void { const hass = this.hass; const map = this.leafletMap; + // eslint-disable-next-line @typescript-eslint/naming-convention const Leaflet = this.Leaflet; if (!hass || !map || !Leaflet) { @@ -354,23 +356,21 @@ export class HaMap extends ReactiveElement { // DRAW point this._mapPaths.push( - Leaflet! - .circleMarker(path.points[pointIndex].point, { - radius: isTouch ? 8 : 3, - color: path.color || darkPrimaryColor, - opacity, - fillOpacity: opacity, - interactive: true, - }) - .bindTooltip( - this._computePathTooltip(path, path.points[pointIndex]), - { direction: "top" } - ) + Leaflet.circleMarker(path.points[pointIndex].point, { + radius: isTouch ? 8 : 3, + color: path.color || darkPrimaryColor, + opacity, + fillOpacity: opacity, + interactive: true, + }).bindTooltip( + this._computePathTooltip(path, path.points[pointIndex]), + { direction: "top" } + ) ); // DRAW line between this and next point this._mapPaths.push( - Leaflet!.polyline( + Leaflet.polyline( [path.points[pointIndex].point, path.points[pointIndex + 1].point], { color: path.color || darkPrimaryColor, @@ -387,18 +387,16 @@ export class HaMap extends ReactiveElement { : undefined; // DRAW end path point this._mapPaths.push( - Leaflet! - .circleMarker(path.points[pointIndex].point, { - radius: isTouch ? 8 : 3, - color: path.color || darkPrimaryColor, - opacity, - fillOpacity: opacity, - interactive: true, - }) - .bindTooltip( - this._computePathTooltip(path, path.points[pointIndex]), - { direction: "top" } - ) + Leaflet.circleMarker(path.points[pointIndex].point, { + radius: isTouch ? 8 : 3, + color: path.color || darkPrimaryColor, + opacity, + fillOpacity: opacity, + interactive: true, + }).bindTooltip( + this._computePathTooltip(path, path.points[pointIndex]), + { direction: "top" } + ) ); } this._mapPaths.forEach((marker) => map.addLayer(marker)); @@ -408,6 +406,7 @@ export class HaMap extends ReactiveElement { private _drawEntities(): void { const hass = this.hass; const map = this.leafletMap; + // eslint-disable-next-line @typescript-eslint/naming-convention const Leaflet = this.Leaflet; if (!hass || !map || !Leaflet) { diff --git a/src/components/media-player/ha-media-player-browse.ts b/src/components/media-player/ha-media-player-browse.ts index c650e81ffeed..5c20cf4a0b63 100644 --- a/src/components/media-player/ha-media-player-browse.ts +++ b/src/components/media-player/ha-media-player-browse.ts @@ -77,11 +77,12 @@ export interface MediaPlayerItemId { export class HaMediaPlayerBrowse extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public entityId!: string; + @property({ attribute: false }) public entityId!: string; @property() public action: MediaPlayerBrowseAction = "play"; - @property() public preferredLayout: MediaPlayerLayoutType = "auto"; + @property({ attribute: false }) + public preferredLayout: MediaPlayerLayoutType = "auto"; @property({ type: Boolean }) public dialog = false; diff --git a/src/components/search-input-outlined.ts b/src/components/search-input-outlined.ts index 629bf5ed8951..05b799eedfc6 100644 --- a/src/components/search-input-outlined.ts +++ b/src/components/search-input-outlined.ts @@ -18,8 +18,8 @@ class SearchInputOutlined extends LitElement { @property({ type: Boolean }) public suffix = false; - @property({ type: Boolean }) - public autofocus = false; + // eslint-disable-next-line lit/no-native-attributes + @property({ type: Boolean }) public autofocus = false; @property({ type: String }) public label?: string; diff --git a/src/components/search-input.ts b/src/components/search-input.ts index 532049985115..854d3805be11 100644 --- a/src/components/search-input.ts +++ b/src/components/search-input.ts @@ -18,8 +18,8 @@ class SearchInput extends LitElement { @property({ type: Boolean }) public suffix = false; - @property({ type: Boolean }) - public autofocus = false; + // eslint-disable-next-line lit/no-native-attributes + @property({ type: Boolean }) public autofocus = false; @property({ type: String }) public label?: string; diff --git a/src/components/tile/ha-tile-image.ts b/src/components/tile/ha-tile-image.ts index 6dfc37e7b214..51d785dcd98d 100644 --- a/src/components/tile/ha-tile-image.ts +++ b/src/components/tile/ha-tile-image.ts @@ -6,11 +6,11 @@ import { ifDefined } from "lit/directives/if-defined"; export type TileImageStyle = "square" | "rounded-square" | "circle"; @customElement("ha-tile-image") export class HaTileImage extends LitElement { - @property() public imageUrl?: string; + @property({ attribute: false }) public imageUrl?: string; - @property() public imageAlt?: string; + @property({ attribute: false }) public imageAlt?: string; - @property() public imageStyle: TileImageStyle = "circle"; + @property({ attribute: false }) public imageStyle: TileImageStyle = "circle"; protected render() { return html` diff --git a/src/components/trace/ha-timeline.ts b/src/components/trace/ha-timeline.ts index 1853882d2fc5..4859fba87334 100644 --- a/src/components/trace/ha-timeline.ts +++ b/src/components/trace/ha-timeline.ts @@ -11,9 +11,10 @@ export class HaTimeline extends LitElement { @property({ type: Boolean, reflect: true }) public raised = false; - @property({ reflect: true, type: Boolean }) notEnabled = false; + @property({ attribute: false, reflect: true, type: Boolean }) notEnabled = + false; - @property({ type: Boolean }) public lastItem = false; + @property({ attribute: false, type: Boolean }) public lastItem = false; @property({ type: String }) public icon?: string; diff --git a/src/components/trace/hat-graph-node.ts b/src/components/trace/hat-graph-node.ts index dd5fe9e125a5..de9e76560708 100644 --- a/src/components/trace/hat-graph-node.ts +++ b/src/components/trace/hat-graph-node.ts @@ -11,15 +11,17 @@ import { NODE_SIZE, SPACING } from "./hat-graph-const"; */ @customElement("hat-graph-node") export class HatGraphNode extends LitElement { - @property() iconPath?: string; + @property({ attribute: false }) iconPath?: string; @property({ type: Boolean, reflect: true }) public disabled = false; @property({ type: Boolean }) public error = false; - @property({ reflect: true, type: Boolean }) notEnabled = false; + @property({ attribute: false, reflect: true, type: Boolean }) notEnabled = + false; - @property({ reflect: true, type: Boolean }) graphStart = false; + @property({ attribute: false, reflect: true, type: Boolean }) graphStart = + false; @property({ type: Boolean, attribute: "nofocus" }) noFocus = false; diff --git a/src/components/trace/hat-script-graph.ts b/src/components/trace/hat-script-graph.ts index d0c8596b07c3..e0e9c1f7d161 100644 --- a/src/components/trace/hat-script-graph.ts +++ b/src/components/trace/hat-script-graph.ts @@ -76,13 +76,13 @@ export class HatScriptGraph extends LitElement { public trackedNodes: Record = {}; - private selectNode(config, path) { + private _selectNode(config, path) { return () => { fireEvent(this, "graph-node-selected", { config, path }); }; } - private render_trigger(config: Trigger, i: number) { + private _renderTrigger(config: Trigger, i: number) { const path = `trigger/${i}`; const track = this.trace && path in this.trace.trace; this.renderedNodes[path] = { config, path }; @@ -93,7 +93,7 @@ export class HatScriptGraph extends LitElement { key in node) || "other"; + Object.keys(this._typeRenderers).find((key) => key in node) || "other"; this.renderedNodes[path] = { config: node, path }; if (this.trace && path in this.trace.trace) { this.trackedNodes[path] = this.renderedNodes[path]; } - return this.typeRenderers[type].bind(this)( + return this._typeRenderers[type].bind(this)( node, path, graphStart, @@ -148,25 +148,25 @@ export class HatScriptGraph extends LitElement { ); } - private render_choose_node( + private _renderChooseNode( config: ChooseAction, path: string, graphStart = false, disabled = false ) { const trace = this.trace.trace[path] as ChooseActionTraceStep[] | undefined; - const trace_path = trace + const tracePath = trace ? trace.map((trc) => trc.result === undefined || trc.result.choice === "default" ? "default" : trc.result.choice ) : []; - const track_default = trace_path.includes("default"); + const trackDefault = tracePath.includes("default"); return html` { - const branch_path = `${path}/choose/${i}`; - const track_this = trace_path.includes(i); - this.renderedNodes[branch_path] = { config, path: branch_path }; - if (track_this) { - this.trackedNodes[branch_path] = - this.renderedNodes[branch_path]; + const branchPath = `${path}/choose/${i}`; + const trackThis = tracePath.includes(i); + this.renderedNodes[branchPath] = { config, path: branchPath }; + if (trackThis) { + this.trackedNodes[branchPath] = this.renderedNodes[branchPath]; } return html` -
+
${branch.sequence !== null ? ensureArray(branch.sequence).map((action, j) => - this.render_action_node( + this._renderActionNode( action, - `${branch_path}/sequence/${j}`, + `${branchPath}/sequence/${j}`, false, disabled || config.enabled === false ) @@ -216,11 +215,11 @@ export class HatScriptGraph extends LitElement { `; }) : ""} -
- +
+ ${config.default !== null ? ensureArray(config.default)?.map((action, i) => - this.render_action_node( + this._renderActionNode( action, `${path}/default/${i}`, false, @@ -233,7 +232,7 @@ export class HatScriptGraph extends LitElement { `; } - private render_if_node( + private _renderIfNode( config: IfAction, path: string, graphStart = false, @@ -256,7 +255,7 @@ export class HatScriptGraph extends LitElement { return html` ${ensureArray(config.else).map((action, j) => - this.render_action_node( + this._renderActionNode( action, `${path}/else/${j}`, false, @@ -298,7 +297,7 @@ export class HatScriptGraph extends LitElement { nofocus > ${ensureArray(config.then ?? []).map((action, j) => - this.render_action_node( + this._renderActionNode( action, `${path}/then/${j}`, false, @@ -310,7 +309,7 @@ export class HatScriptGraph extends LitElement { `; } - private render_condition_node( + private _renderConditionNode( node: Condition, path: string, graphStart = false, @@ -337,7 +336,7 @@ export class HatScriptGraph extends LitElement { } return html`
${ensureArray(node.repeat.sequence).map((action, i) => - this.render_action_node( + this._renderActionNode( action, `${path}/repeat/sequence/${i}`, false, @@ -417,7 +416,7 @@ export class HatScriptGraph extends LitElement { `; } - private render_service_node( + private _renderServiceNode( node: ServiceAction, path: string, graphStart = false, @@ -427,7 +426,7 @@ export class HatScriptGraph extends LitElement { ${ensureArray(node.sequence).map((action, i) => - this.render_action_node( + this._renderActionNode( action, `${path}/sequence/${i}`, false, @@ -503,7 +502,7 @@ export class HatScriptGraph extends LitElement { `; } - private render_parallel_node( + private _renderParallelNode( node: ParallelAction, path: string, graphStart = false, @@ -513,7 +512,7 @@ export class HatScriptGraph extends LitElement { return html` ${ensureArray((action as ManualScriptConfig).sequence).map( (sAction, j) => - this.render_action_node( + this._renderActionNode( sAction, `${path}/parallel/${i}/sequence/${j}`, false, @@ -540,7 +539,7 @@ export class HatScriptGraph extends LitElement { ) )}
` - : this.render_action_node( + : this._renderActionNode( action, `${path}/parallel/${i}/sequence/0`, false, @@ -551,7 +550,7 @@ export class HatScriptGraph extends LitElement { `; } - private render_other_node( + private _renderOtherNode( node: Action, path: string, graphStart = false, @@ -561,7 +560,7 @@ export class HatScriptGraph extends LitElement { tr.error)} @@ -577,33 +576,33 @@ export class HatScriptGraph extends LitElement { const actionKey = "actions" in this.trace.config ? "actions" : "action"; const paths = Object.keys(this.trackedNodes); - const trigger_nodes = + const triggerNodes = triggerKey in this.trace.config ? flattenTriggers(ensureArray(this.trace.config[triggerKey])).map( - (trigger, i) => this.render_trigger(trigger, i) + (trigger, i) => this._renderTrigger(trigger, i) ) : undefined; try { return html`
- ${trigger_nodes - ? html` - ${trigger_nodes} + ${triggerNodes + ? html` + ${triggerNodes} ` : ""} ${conditionKey in this.trace.config ? html`${ensureArray(this.trace.config[conditionKey])?.map( - (condition, i) => this.render_condition(condition, i) + (condition, i) => this._renderCondition(condition, i) )}` : ""} ${actionKey in this.trace.config ? html`${ensureArray(this.trace.config[actionKey]).map( - (action, i) => this.render_action_node(action, `action/${i}`) + (action, i) => this._renderActionNode(action, `action/${i}`) )}` : ""} ${"sequence" in this.trace.config ? html`${ensureArray(this.trace.config.sequence).map((action, i) => - this.render_action_node(action, `sequence/${i}`, i === 0) + 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 365dba0f1dd3..0dbdd4abb5c9 100644 --- a/src/components/trace/hat-trace-timeline.ts +++ b/src/components/trace/hat-trace-timeline.ts @@ -676,7 +676,7 @@ export class HaAutomationTracer extends LitElement { @property({ attribute: false }) public selectedPath?: string; - @property({ type: Boolean }) public allowPick = false; + @property({ attribute: false, type: Boolean }) public allowPick = false; @state() @consume({ context: fullEntitiesContext, subscribe: true }) diff --git a/src/components/user/ha-user-picker.ts b/src/components/user/ha-user-picker.ts index 2b5504a88a51..537eb3ef3d1b 100644 --- a/src/components/user/ha-user-picker.ts +++ b/src/components/user/ha-user-picker.ts @@ -17,7 +17,7 @@ class HaUserPicker extends LitElement { @property() public label?: string; - @property() public noUserLabel?: string; + @property({ attribute: false }) public noUserLabel?: string; @property() public value = ""; diff --git a/src/data/assist_pipeline.ts b/src/data/assist_pipeline.ts index 0623049a0fc9..c978d48820f3 100644 --- a/src/data/assist_pipeline.ts +++ b/src/data/assist_pipeline.ts @@ -39,7 +39,7 @@ export interface AssistPipelineMutableParams { wake_word_id: string | null; } -export interface assistRunListing { +export interface AssistRunListing { pipeline_run_id: string; timestamp: string; } @@ -303,7 +303,7 @@ export const listAssistPipelineRuns = ( pipeline_id: string ) => hass.callWS<{ - pipeline_runs: assistRunListing[]; + pipeline_runs: AssistRunListing[]; }>({ type: "assist_pipeline/pipeline_debug/list", pipeline_id, diff --git a/src/data/supervisor/supervisor.ts b/src/data/supervisor/supervisor.ts index c047b8ee1e13..38a2cc63a42e 100644 --- a/src/data/supervisor/supervisor.ts +++ b/src/data/supervisor/supervisor.ts @@ -46,7 +46,7 @@ export type SupervisorObject = | "addon" | "store"; -interface supervisorApiRequest { +interface SupervisorApiRequest { endpoint: string; method?: "get" | "post" | "delete" | "put"; force_rest?: boolean; @@ -78,7 +78,7 @@ export interface Supervisor { export const supervisorApiWsRequest = ( conn: Connection, - request: supervisorApiRequest + request: SupervisorApiRequest ): Promise => conn.sendMessagePromise({ ...supervisorWSbaseCommand, ...request }); diff --git a/src/dialogs/area-filter/area-filter-dialog.ts b/src/dialogs/area-filter/area-filter-dialog.ts index df8be2168d94..68b2b2ae2d41 100644 --- a/src/dialogs/area-filter/area-filter-dialog.ts +++ b/src/dialogs/area-filter/area-filter-dialog.ts @@ -147,7 +147,7 @@ export class DialogAreaFilter `; } - _toggle(ev) { + private _toggle(ev) { const area = ev.target.area; const hidden = [...(this._hidden ?? [])]; if (hidden.includes(area)) { diff --git a/src/dialogs/config-flow/previews/entity-preview-row.ts b/src/dialogs/config-flow/previews/entity-preview-row.ts index a52606b510e2..4bb8f68af072 100644 --- a/src/dialogs/config-flow/previews/entity-preview-row.ts +++ b/src/dialogs/config-flow/previews/entity-preview-row.ts @@ -42,7 +42,7 @@ class EntityPreviewRow extends LitElement {
${computeStateName(stateObj)}
-
${this.renderEntityState(stateObj)}
`; +
${this._renderEntityState(stateObj)}
`; } static get styles(): CSSResultGroup { @@ -103,7 +103,7 @@ class EntityPreviewRow extends LitElement { `; } - private renderEntityState(stateObj: HassEntity): TemplateResult | string { + private _renderEntityState(stateObj: HassEntity): TemplateResult | string { const domain = stateObj.entity_id.split(".", 1)[0]; if (domain === "button") { diff --git a/src/dialogs/config-flow/previews/flow-preview-generic.ts b/src/dialogs/config-flow/previews/flow-preview-generic.ts index 436bf1f35cd6..2af0becad59b 100644 --- a/src/dialogs/config-flow/previews/flow-preview-generic.ts +++ b/src/dialogs/config-flow/previews/flow-preview-generic.ts @@ -14,17 +14,17 @@ import "../../../components/ha-alert"; class FlowPreviewGeneric extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public flowType!: FlowType; + @property({ attribute: false }) public flowType!: FlowType; public handler!: string; @property() public domain!: string; - @property() public stepId!: string; + @property({ attribute: false }) public stepId!: string; - @property() public flowId!: string; + @property({ attribute: false }) public flowId!: string; - @property() public stepData!: Record; + @property({ attribute: false }) public stepData!: Record; @state() private _preview?: HassEntity; diff --git a/src/dialogs/config-flow/previews/flow-preview-template.ts b/src/dialogs/config-flow/previews/flow-preview-template.ts index b6bf8a30c096..e4c8c3eafe06 100644 --- a/src/dialogs/config-flow/previews/flow-preview-template.ts +++ b/src/dialogs/config-flow/previews/flow-preview-template.ts @@ -17,13 +17,13 @@ import "../../../components/ha-alert"; class FlowPreviewTemplate extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public flowType!: FlowType; + @property({ attribute: false }) public flowType!: FlowType; public handler!: string; - @property() public stepId!: string; + @property({ attribute: false }) public stepId!: string; - @property() public flowId!: string; + @property({ attribute: false }) public flowId!: string; @property({ attribute: false }) public stepData!: Record; diff --git a/src/dialogs/config-flow/step-flow-loading.ts b/src/dialogs/config-flow/step-flow-loading.ts index d5cbfcb42022..1ff4534f0d1a 100644 --- a/src/dialogs/config-flow/step-flow-loading.ts +++ b/src/dialogs/config-flow/step-flow-loading.ts @@ -12,7 +12,7 @@ class StepFlowLoading extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public loadingReason!: LoadingReason; + @property({ attribute: false }) public loadingReason!: LoadingReason; @property() public handler?: string; diff --git a/src/dialogs/more-info/components/lights/light-color-rgb-picker.ts b/src/dialogs/more-info/components/lights/light-color-rgb-picker.ts index 040effe09c8c..d2ff112884c9 100644 --- a/src/dialogs/more-info/components/lights/light-color-rgb-picker.ts +++ b/src/dialogs/more-info/components/lights/light-color-rgb-picker.ts @@ -158,7 +158,7 @@ class LightRgbColorPicker extends LitElement { `; } - public _updateSliderValues() { + private _updateSliderValues() { const stateObj = this.stateObj; if (stateObj.state === "on") { diff --git a/src/dialogs/more-info/components/lights/light-color-temp-picker.ts b/src/dialogs/more-info/components/lights/light-color-temp-picker.ts index 3f00ab3db71f..b9b1fe82f379 100644 --- a/src/dialogs/more-info/components/lights/light-color-temp-picker.ts +++ b/src/dialogs/more-info/components/lights/light-color-temp-picker.ts @@ -97,7 +97,7 @@ class LightColorTempPicker extends LitElement { (min: number, max: number) => generateColorTemperatureGradient(min, max) ); - public _updateSliderValues() { + private _updateSliderValues() { const stateObj = this.stateObj; if (stateObj.state === "on") { diff --git a/src/dialogs/more-info/controls/more-info-fan.ts b/src/dialogs/more-info/controls/more-info-fan.ts index 2a263e58c92c..47b1d873b457 100644 --- a/src/dialogs/more-info/controls/more-info-fan.ts +++ b/src/dialogs/more-info/controls/more-info-fan.ts @@ -48,7 +48,7 @@ class MoreInfoFan extends LitElement { }); }; - _handleDirection(ev) { + private _handleDirection(ev) { const newVal = ev.target.value; const oldVal = this.stateObj?.attributes.direction; @@ -60,7 +60,7 @@ class MoreInfoFan extends LitElement { }); } - _handlePresetMode(ev) { + private _handlePresetMode(ev) { const newVal = ev.target.value; const oldVal = this._presetMode; @@ -73,7 +73,7 @@ class MoreInfoFan extends LitElement { }); } - _handleOscillating(ev) { + private _handleOscillating(ev) { const newVal = ev.target.value === "true"; const oldVal = this.stateObj?.attributes.oscillating; diff --git a/src/dialogs/more-info/controls/more-info-lawn_mower.ts b/src/dialogs/more-info/controls/more-info-lawn_mower.ts index e3b25e455da9..5af81e5a21cf 100644 --- a/src/dialogs/more-info/controls/more-info-lawn_mower.ts +++ b/src/dialogs/more-info/controls/more-info-lawn_mower.ts @@ -96,7 +96,7 @@ class MoreInfoLawnMower extends LitElement { ${isDefaultView ? html` - ${this.shouldShowHistory(domain) + ${this._shouldShowHistory(domain) ? html` ` : nothing} - ${this.shouldShowEditIcon(domain, stateObj) + ${this._shouldShowEditIcon(domain, stateObj) ? html` diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-check.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-check.ts index 31d8032dc2b1..3588cac066ba 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-check.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-check.ts @@ -12,7 +12,7 @@ import { documentationUrl } from "../../util/documentation-url"; export class HaVoiceAssistantSetupStepCheck extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public assistEntityId?: string; + @property({ attribute: false }) public assistEntityId?: string; @state() private _status?: "success" | "timeout"; 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 e75e4260cfd5..08798d8449e5 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 @@ -25,9 +25,9 @@ export class HaVoiceAssistantSetupStepPipeline extends LitElement { @property({ attribute: false }) public assistConfiguration?: AssistSatelliteConfiguration; - @property() public deviceId!: string; + @property({ attribute: false }) public deviceId!: string; - @property() public assistEntityId?: string; + @property({ attribute: false }) public assistEntityId?: string; @state() private _cloudChecked = false; 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 27e0a188d805..7cf4ed88699a 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 @@ -33,9 +33,9 @@ export class HaVoiceAssistantSetupStepSuccess extends LitElement { @property({ attribute: false }) public assistConfiguration?: AssistSatelliteConfiguration; - @property() public deviceId!: string; + @property({ attribute: false }) public deviceId!: string; - @property() public assistEntityId?: string; + @property({ attribute: false }) public assistEntityId?: string; @state() private _ttsSettings?: any; diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts index 4c61291f8145..4b562e9a7c99 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts @@ -17,7 +17,7 @@ import { AssistantSetupStyles } from "./styles"; export class HaVoiceAssistantSetupStepUpdate extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public updateEntityId?: string; + @property({ attribute: false }) public updateEntityId?: string; private _updated = false; diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts index 3eb8ba64164d..fb0d8abc3bca 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts @@ -21,7 +21,7 @@ export class HaVoiceAssistantSetupStepWakeWord extends LitElement { @property({ attribute: false }) public assistConfiguration?: AssistSatelliteConfiguration; - @property() public assistEntityId?: string; + @property({ attribute: false }) public assistEntityId?: string; @property({ attribute: false }) public deviceEntities?: EntityRegistryDisplayEntry[]; diff --git a/src/entrypoints/service-worker.ts b/src/entrypoints/service-worker.ts index 70413a8c4950..488d9962a3c0 100644 --- a/src/entrypoints/service-worker.ts +++ b/src/entrypoints/service-worker.ts @@ -14,6 +14,7 @@ import { StaleWhileRevalidate, } from "workbox-strategies"; +// eslint-disable-next-line @typescript-eslint/naming-convention declare const __WB_MANIFEST__: Parameters[0]; const noFallBackRegEx = diff --git a/src/layouts/hass-tabs-subpage-data-table.ts b/src/layouts/hass-tabs-subpage-data-table.ts index 9ac568e80d4f..2be1b35d0fa6 100644 --- a/src/layouts/hass-tabs-subpage-data-table.ts +++ b/src/layouts/hass-tabs-subpage-data-table.ts @@ -46,7 +46,7 @@ export class HaTabsSubpageDataTable extends LitElement { @property({ attribute: false }) public localizeFunc?: LocalizeFunc; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @property({ type: Boolean, reflect: true }) public narrow = false; @@ -84,7 +84,7 @@ export class HaTabsSubpageDataTable extends LitElement { * Do we need to add padding for a fab. * @type {Boolean} */ - @property({ type: Boolean }) public hasFab = false; + @property({ attribute: false, type: Boolean }) public hasFab = false; /** * Add an extra row at the bottom of the data table @@ -96,6 +96,7 @@ export class HaTabsSubpageDataTable extends LitElement { * Field with a unique id per entry in data. * @type {String} */ + // eslint-disable-next-line lit/no-native-attributes @property({ type: String }) public id = "id"; /** @@ -104,7 +105,7 @@ export class HaTabsSubpageDataTable extends LitElement { */ @property({ type: String }) public filter = ""; - @property() public searchLabel?: string; + @property({ attribute: false }) public searchLabel?: string; /** * Number of active filters. @@ -135,7 +136,7 @@ export class HaTabsSubpageDataTable extends LitElement { * String to show when there are no records in the data table. * @type {String} */ - @property({ type: String }) public noDataText?: string; + @property({ attribute: false, type: String }) public noDataText?: string; /** * Hides the data table and show an empty message. @@ -155,16 +156,16 @@ export class HaTabsSubpageDataTable extends LitElement { * Show the filter menu. * @type {Boolean} */ - @property({ type: Boolean }) public hasFilters = false; + @property({ attribute: false, type: Boolean }) public hasFilters = false; - @property({ type: Boolean }) public showFilters = false; + @property({ attribute: false, type: Boolean }) public showFilters = false; @property({ attribute: false }) public initialSorting?: { column: string; direction: SortingDirection; }; - @property() public initialGroupColumn?: string; + @property({ attribute: false }) public initialGroupColumn?: string; @property({ attribute: false }) public groupOrder?: string[]; diff --git a/src/layouts/partial-panel-resolver.ts b/src/layouts/partial-panel-resolver.ts index e425312265de..1a8b665e483a 100644 --- a/src/layouts/partial-panel-resolver.ts +++ b/src/layouts/partial-panel-resolver.ts @@ -112,7 +112,7 @@ class PartialPanelResolver extends HassRouterPage { } } - private getRoutes(panels: Panels): RouterOptions { + private _getRoutes(panels: Panels): RouterOptions { const routes: RouterOptions["routes"] = {}; Object.values(panels).forEach((panel) => { const data: RouteOptions = { @@ -184,7 +184,7 @@ class PartialPanelResolver extends HassRouterPage { } private async _updateRoutes(oldPanels?: HomeAssistant["panels"]) { - this.routerOptions = this.getRoutes(this.hass.panels); + this.routerOptions = this._getRoutes(this.hass.panels); if ( !this._waitForStart && diff --git a/src/managers/notification-manager.ts b/src/managers/notification-manager.ts index dea25c743bfa..85511abf0745 100644 --- a/src/managers/notification-manager.ts +++ b/src/managers/notification-manager.ts @@ -73,7 +73,7 @@ class NotificationManager extends LitElement { ` : nothing} @@ -91,7 +91,7 @@ class NotificationManager extends LitElement { `; } - private buttonClicked() { + private _buttonClicked() { this._toast?.close("action"); if (this._parameters?.action) { this._parameters?.action.action(); diff --git a/src/mixins/subscribe-mixin.ts b/src/mixins/subscribe-mixin.ts index 5aecc110a965..5e4c10dd45bf 100644 --- a/src/mixins/subscribe-mixin.ts +++ b/src/mixins/subscribe-mixin.ts @@ -20,7 +20,7 @@ export const SubscribeMixin = >( public connectedCallback() { super.connectedCallback(); - this.__checkSubscribed(); + this._checkSubscribed(); } public disconnectedCallback() { @@ -41,7 +41,7 @@ export const SubscribeMixin = >( protected updated(changedProps: PropertyValues) { super.updated(changedProps); if (changedProps.has("hass")) { - this.__checkSubscribed(); + this._checkSubscribed(); return; } if (!this.hassSubscribeRequiredHostProps) { @@ -49,7 +49,7 @@ export const SubscribeMixin = >( } for (const key of changedProps.keys()) { if (this.hassSubscribeRequiredHostProps.includes(key as string)) { - this.__checkSubscribed(); + this._checkSubscribed(); return; } } @@ -61,7 +61,7 @@ export const SubscribeMixin = >( return []; } - private __checkSubscribed(): void { + private _checkSubscribed(): void { if ( this.__unsubs !== undefined || !(this as unknown as Element).isConnected || diff --git a/src/onboarding/ha-onboarding.ts b/src/onboarding/ha-onboarding.ts index 2a0677dfe063..466f6f070e84 100644 --- a/src/onboarding/ha-onboarding.ts +++ b/src/onboarding/ha-onboarding.ts @@ -88,7 +88,8 @@ declare global { class HaOnboarding extends litLocalizeLiteMixin(HassElement) { @property({ attribute: false }) public hass?: HomeAssistant; - @property() public translationFragment = "page-onboarding"; + @property({ attribute: false }) public translationFragment = + "page-onboarding"; @state() private _progress = 0; diff --git a/src/onboarding/integration-badge.ts b/src/onboarding/integration-badge.ts index 87d60b9ded74..1ff2ff1f56e9 100644 --- a/src/onboarding/integration-badge.ts +++ b/src/onboarding/integration-badge.ts @@ -8,11 +8,14 @@ import { brandsUrl } from "../util/brands-url"; class IntegrationBadge extends LitElement { @property() public domain!: string; - @property() public title!: string; + // eslint-disable-next-line lit/no-native-attributes + @property({ attribute: false }) public title!: string; - @property({ type: Boolean }) public darkOptimizedIcon = false; + @property({ attribute: false, type: Boolean }) public darkOptimizedIcon = + false; - @property({ type: Boolean, reflect: true }) public clickable = false; + @property({ attribute: false, type: Boolean, reflect: true }) + public clickable = false; protected render(): TemplateResult { return html` diff --git a/src/onboarding/onboarding-analytics.ts b/src/onboarding/onboarding-analytics.ts index 11818f952337..be08ccb5fde4 100644 --- a/src/onboarding/onboarding-analytics.ts +++ b/src/onboarding/onboarding-analytics.ts @@ -32,7 +32,7 @@ class OnboardingAnalytics extends LitElement {

${this.localize("ui.panel.page-onboarding.analytics.intro")}

diff --git a/src/onboarding/onboarding-welcome-link.ts b/src/onboarding/onboarding-welcome-link.ts index 25c605bb7fcd..a6397d280f09 100644 --- a/src/onboarding/onboarding-welcome-link.ts +++ b/src/onboarding/onboarding-welcome-link.ts @@ -9,7 +9,7 @@ import "../components/ha-svg-icon"; class OnboardingWelcomeLink extends LitElement { @property() public label!: string; - @property() public iconPath!: string; + @property({ attribute: false }) public iconPath!: string; @property({ type: Boolean }) public noninteractive = false; diff --git a/src/onboarding/onboarding-welcome-links.ts b/src/onboarding/onboarding-welcome-links.ts index 95183d8839ac..0682469baf94 100644 --- a/src/onboarding/onboarding-welcome-links.ts +++ b/src/onboarding/onboarding-welcome-links.ts @@ -15,7 +15,7 @@ class OnboardingWelcomeLinks extends LitElement { @property({ attribute: false }) public localize!: LocalizeFunc; - @property({ type: Boolean }) public mobileApp = false; + @property({ attribute: false, type: Boolean }) public mobileApp = false; protected render(): TemplateResult { return html` = { class HaConfigAreaPage extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public areaId!: string; + @property({ attribute: false }) public areaId!: string; @property({ type: Boolean, reflect: true }) public narrow = false; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; - @property({ type: Boolean }) public showAdvanced = false; + @property({ attribute: false, type: Boolean }) public showAdvanced = false; @state() @consume({ context: fullEntitiesContext, subscribe: true }) diff --git a/src/panels/config/areas/ha-config-areas-dashboard.ts b/src/panels/config/areas/ha-config-areas-dashboard.ts index d92f56cb99f3..424a75fa3f2c 100644 --- a/src/panels/config/areas/ha-config-areas-dashboard.ts +++ b/src/panels/config/areas/ha-config-areas-dashboard.ts @@ -58,7 +58,7 @@ const SORT_OPTIONS = { sort: false, delay: 500, delayOnTouchOnly: true }; export class HaConfigAreasDashboard extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @property({ type: Boolean }) public narrow = false; diff --git a/src/panels/config/areas/ha-config-areas.ts b/src/panels/config/areas/ha-config-areas.ts index 332b1cbb0875..7a79fb5524a7 100644 --- a/src/panels/config/areas/ha-config-areas.ts +++ b/src/panels/config/areas/ha-config-areas.ts @@ -11,9 +11,9 @@ class HaConfigAreas extends HassRouterPage { @property({ type: Boolean }) public narrow = false; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; - @property({ type: Boolean }) public showAdvanced = false; + @property({ attribute: false, type: Boolean }) public showAdvanced = false; protected routerOptions: RouterOptions = { defaultPage: "dashboard", diff --git a/src/panels/config/automation/condition/ha-automation-condition-editor.ts b/src/panels/config/automation/condition/ha-automation-condition-editor.ts index a4734a1e8249..06dfc7099c41 100644 --- a/src/panels/config/automation/condition/ha-automation-condition-editor.ts +++ b/src/panels/config/automation/condition/ha-automation-condition-editor.ts @@ -28,7 +28,7 @@ export default class HaAutomationConditionEditor extends LitElement { @property({ type: Boolean }) public disabled = false; - @property({ type: Boolean }) public yamlMode = false; + @property({ attribute: false, type: Boolean }) public yamlMode = false; private _processedCondition = memoizeOne((condition) => expandConditionWithShorthand(condition) diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts index 6be64adc0417..9e81a67e0dec 100644 --- a/src/panels/config/automation/ha-automation-editor.ts +++ b/src/panels/config/automation/ha-automation-editor.ts @@ -85,13 +85,13 @@ declare global { export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public automationId: string | null = null; + @property({ attribute: false }) public automationId: string | null = null; - @property() public entityId: string | null = null; + @property({ attribute: false }) public entityId: string | null = null; @property({ attribute: false }) public automations!: AutomationEntity[]; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @property({ type: Boolean }) public narrow = false; @@ -590,7 +590,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { private async _showTrace() { if (this._config?.id) { - const result = await this.confirmUnsavedChanged(); + const result = await this._confirmUnsavedChanged(); if (result) { navigate( `/config/automation/trace/${encodeURIComponent(this._config.id)}` @@ -644,7 +644,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { this._errors = undefined; } - private async confirmUnsavedChanged(): Promise { + private async _confirmUnsavedChanged(): Promise { if (this._dirty) { return showConfirmationDialog(this, { title: this.hass!.localize( @@ -662,7 +662,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { } private _backTapped = async () => { - const result = await this.confirmUnsavedChanged(); + const result = await this._confirmUnsavedChanged(); if (result) { afterNextRender(() => history.back()); } @@ -723,7 +723,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { "ui.panel.config.automation.picker.migrate_automation_description" ), }) - : await this.confirmUnsavedChanged(); + : await this._confirmUnsavedChanged(); if (result) { showAutomationEditor({ ...this._config, diff --git a/src/panels/config/automation/ha-automation-picker.ts b/src/panels/config/automation/ha-automation-picker.ts index dc09dd6e3196..45c8b630a705 100644 --- a/src/panels/config/automation/ha-automation-picker.ts +++ b/src/panels/config/automation/ha-automation-picker.ts @@ -128,7 +128,7 @@ type AutomationItem = AutomationEntity & { class HaAutomationPicker extends SubscribeMixin(LitElement) { @property({ attribute: false }) public hass!: HomeAssistant; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @property({ type: Boolean }) public narrow = false; diff --git a/src/panels/config/automation/ha-automation-trace.ts b/src/panels/config/automation/ha-automation-trace.ts index b5039f3faf60..1cf4acdd5c42 100644 --- a/src/panels/config/automation/ha-automation-trace.ts +++ b/src/panels/config/automation/ha-automation-trace.ts @@ -49,11 +49,11 @@ const TABS = ["details", "automation_config", "timeline", "logbook"] as const; export class HaAutomationTrace extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public automationId!: string; + @property({ attribute: false }) public automationId!: string; @property({ attribute: false }) public automations!: AutomationEntity[]; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @property({ type: Boolean, reflect: true }) public narrow = false; diff --git a/src/panels/config/automation/ha-config-automation.ts b/src/panels/config/automation/ha-config-automation.ts index c14435318408..ae8e5c5c76f4 100644 --- a/src/panels/config/automation/ha-config-automation.ts +++ b/src/panels/config/automation/ha-config-automation.ts @@ -24,9 +24,9 @@ class HaConfigAutomation extends HassRouterPage { @property({ type: Boolean }) public narrow = false; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; - @property({ type: Boolean }) public showAdvanced = false; + @property({ attribute: false, type: Boolean }) public showAdvanced = false; @property({ attribute: false }) public automations: AutomationEntity[] = []; diff --git a/src/panels/config/automation/manual-automation-editor.ts b/src/panels/config/automation/manual-automation-editor.ts index eaa06b9e6546..3455fad61561 100644 --- a/src/panels/config/automation/manual-automation-editor.ts +++ b/src/panels/config/automation/manual-automation-editor.ts @@ -34,7 +34,7 @@ import { constructUrlCurrentPath } from "../../../common/url/construct-url"; export class HaManualAutomationEditor extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @property({ type: Boolean }) public narrow = false; diff --git a/src/panels/config/backup/ha-config-backup.ts b/src/panels/config/backup/ha-config-backup.ts index 1119c9981820..cb0c164afd2c 100644 --- a/src/panels/config/backup/ha-config-backup.ts +++ b/src/panels/config/backup/ha-config-backup.ts @@ -33,7 +33,7 @@ import { fileDownload } from "../../../util/file_download"; class HaConfigBackup extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @property({ type: Boolean }) public narrow = false; diff --git a/src/panels/config/blueprint/blueprint-generic-editor.ts b/src/panels/config/blueprint/blueprint-generic-editor.ts index 957e697b6ada..a7cda69b9534 100644 --- a/src/panels/config/blueprint/blueprint-generic-editor.ts +++ b/src/panels/config/blueprint/blueprint-generic-editor.ts @@ -24,7 +24,7 @@ import type { HomeAssistant } from "../../../types"; export abstract class HaBlueprintGenericEditor extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @property({ type: Boolean }) public disabled = false; @@ -97,11 +97,11 @@ export abstract class HaBlueprintGenericEditor extends LitElement { ? Object.entries(blueprint.metadata.input).map( ([key, value]) => { if (value && "input" in value) { - const section = this.renderSection(key, value); + const section = this._renderSection(key, value); border = false; return section; } - const row = this.renderSettingRow(key, value, border); + const row = this._renderSettingRow(key, value, border); border = true; return row; } @@ -116,7 +116,7 @@ export abstract class HaBlueprintGenericEditor extends LitElement { `; } - private renderSection(sectionKey: string, section: BlueprintInputSection) { + private _renderSection(sectionKey: string, section: BlueprintInputSection) { const title = section?.name || sectionKey; const anyRequired = section.input && @@ -145,14 +145,14 @@ export abstract class HaBlueprintGenericEditor extends LitElement { : nothing} ${section.input ? Object.entries(section.input).map(([key, value]) => - this.renderSettingRow(key, value, true) + this._renderSettingRow(key, value, true) ) : nothing}

`; } - private renderSettingRow( + private _renderSettingRow( key: string, value: BlueprintInput | null, border: boolean diff --git a/src/panels/config/blueprint/ha-blueprint-overview.ts b/src/panels/config/blueprint/ha-blueprint-overview.ts index 0f5c5f28ffe9..78454bbfec2c 100644 --- a/src/panels/config/blueprint/ha-blueprint-overview.ts +++ b/src/panels/config/blueprint/ha-blueprint-overview.ts @@ -81,7 +81,7 @@ const createNewFunctions = { class HaBlueprintOverview extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @property({ type: Boolean }) public narrow = false; diff --git a/src/panels/config/blueprint/ha-config-blueprint.ts b/src/panels/config/blueprint/ha-config-blueprint.ts index 0947d6c7db8e..ec7e5c7518c2 100644 --- a/src/panels/config/blueprint/ha-config-blueprint.ts +++ b/src/panels/config/blueprint/ha-config-blueprint.ts @@ -20,9 +20,9 @@ class HaConfigBlueprint extends HassRouterPage { @property({ type: Boolean }) public narrow = false; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; - @property({ type: Boolean }) public showAdvanced = false; + @property({ attribute: false, type: Boolean }) public showAdvanced = false; @property({ attribute: false }) public blueprints: Record = {}; diff --git a/src/panels/config/cloud/account/cloud-account.ts b/src/panels/config/cloud/account/cloud-account.ts index 0cabad210d16..72ca38d002fb 100644 --- a/src/panels/config/cloud/account/cloud-account.ts +++ b/src/panels/config/cloud/account/cloud-account.ts @@ -37,7 +37,7 @@ import "./cloud-webhooks"; export class CloudAccount extends SubscribeMixin(LitElement) { @property({ attribute: false }) public hass!: HomeAssistant; - @property({ type: Boolean }) public isWide = false; + @property({ attribute: false, type: Boolean }) public isWide = false; @property({ type: Boolean }) public narrow = false; diff --git a/src/panels/config/cloud/account/cloud-tts-pref.ts b/src/panels/config/cloud/account/cloud-tts-pref.ts index d8abcee53ad0..2a8e2c066189 100644 --- a/src/panels/config/cloud/account/cloud-tts-pref.ts +++ b/src/panels/config/cloud/account/cloud-tts-pref.ts @@ -123,7 +123,7 @@ export class CloudTTSPref extends LitElement { }); } - async _handleLanguageChange(ev) { + private async _handleLanguageChange(ev) { if (ev.detail.value === this.cloudStatus!.prefs.tts_default_voice[0]) { return; } @@ -152,7 +152,7 @@ export class CloudTTSPref extends LitElement { } } - async _handleVoiceChange(ev) { + private async _handleVoiceChange(ev) { if (ev.target.value === this.cloudStatus!.prefs.tts_default_voice[1]) { return; } diff --git a/src/panels/config/cloud/dialog-manage-cloudhook/dialog-manage-cloudhook.ts b/src/panels/config/cloud/dialog-manage-cloudhook/dialog-manage-cloudhook.ts index e4358a2b5641..b1c313fe6bab 100644 --- a/src/panels/config/cloud/dialog-manage-cloudhook/dialog-manage-cloudhook.ts +++ b/src/panels/config/cloud/dialog-manage-cloudhook/dialog-manage-cloudhook.ts @@ -89,7 +89,7 @@ export class DialogManageCloudhook extends LitElement { .value=${cloudhook.cloudhook_url} iconTrailing readOnly - @click=${this.focusInput} + @click=${this._focusInput} > @@ -287,7 +287,7 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard { `; } - private renderEntity(entityConf: LovelaceRowConfig): TemplateResult { + private _renderEntity(entityConf: LovelaceRowConfig): TemplateResult { const element = createRowElement( (!("type" in entityConf) || entityConf.type === "conditional") && "state_color" in this._config! diff --git a/src/panels/lovelace/cards/hui-entity-card.ts b/src/panels/lovelace/cards/hui-entity-card.ts index 672a5336d1c3..178121b03a25 100644 --- a/src/panels/lovelace/cards/hui-entity-card.ts +++ b/src/panels/lovelace/cards/hui-entity-card.ts @@ -74,7 +74,7 @@ export class HuiEntityCard extends LitElement implements LovelaceCard { private _footerElement?: HuiErrorCard | LovelaceHeaderFooter; - private getStateColor(stateObj: HassEntity, config: EntityCardConfig) { + private _getStateColor(stateObj: HassEntity, config: EntityCardConfig) { const domain = stateObj ? computeStateDomain(stateObj) : undefined; return config && (config.state_color ?? domain === "light"); } @@ -127,7 +127,7 @@ export class HuiEntityCard extends LitElement implements LovelaceCard { const name = this._config.name || computeStateName(stateObj); - const colored = stateObj && this.getStateColor(stateObj, this._config); + const colored = stateObj && this._getStateColor(stateObj, this._config); const fixedFooter = this.layout === "grid" && this._footerElement !== undefined; diff --git a/src/panels/lovelace/cards/hui-glance-card.ts b/src/panels/lovelace/cards/hui-glance-card.ts index 1d75e2438e0d..4811238e9c28 100644 --- a/src/panels/lovelace/cards/hui-glance-card.ts +++ b/src/panels/lovelace/cards/hui-glance-card.ts @@ -128,7 +128,7 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
${this._configEntities!.map((entityConf) => - this.renderEntity(entityConf) + this._renderEntity(entityConf) )}
@@ -230,7 +230,7 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard { `; } - private renderEntity(entityConf: GlanceConfigEntity): TemplateResult { + private _renderEntity(entityConf: GlanceConfigEntity): TemplateResult { const stateObj = this.hass!.states[entityConf.entity]; if (!stateObj) { diff --git a/src/panels/lovelace/cards/hui-picture-glance-card.ts b/src/panels/lovelace/cards/hui-picture-glance-card.ts index b4a84748724a..79c380c1959a 100644 --- a/src/panels/lovelace/cards/hui-picture-glance-card.ts +++ b/src/panels/lovelace/cards/hui-picture-glance-card.ts @@ -233,12 +233,12 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard { : ""}
${this._entitiesDialog!.map((entityConf) => - this.renderEntity(entityConf, true) + this._renderEntity(entityConf, true) )}
${this._entitiesToggle!.map((entityConf) => - this.renderEntity(entityConf, false) + this._renderEntity(entityConf, false) )}
@@ -246,7 +246,7 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard { `; } - private renderEntity( + private _renderEntity( entityConf: PictureGlanceEntityConfig, dialog: boolean ): TemplateResult { diff --git a/src/panels/lovelace/cards/hui-plant-status-card.ts b/src/panels/lovelace/cards/hui-plant-status-card.ts index fa7a042b2049..64307a158342 100644 --- a/src/panels/lovelace/cards/hui-plant-status-card.ts +++ b/src/panels/lovelace/cards/hui-plant-status-card.ts @@ -123,7 +123,7 @@ class HuiPlantStatusCard extends LitElement implements LovelaceCard {
- ${this.computeAttributes(stateObj).map( + ${this._computeAttributes(stateObj).map( (item) => html`
key in stateObj.attributes ); diff --git a/src/panels/lovelace/cards/hui-todo-list-card.ts b/src/panels/lovelace/cards/hui-todo-list-card.ts index a6644f7c4786..7182212aa38e 100644 --- a/src/panels/lovelace/cards/hui-todo-list-card.ts +++ b/src/panels/lovelace/cards/hui-todo-list-card.ts @@ -196,7 +196,9 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { })} >
- ${this.todoListSupportsFeature(TodoListEntityFeature.CREATE_TODO_ITEM) + ${this._todoListSupportsFeature( + TodoListEntityFeature.CREATE_TODO_ITEM + ) ? html` - ${this.todoListSupportsFeature( + ${this._todoListSupportsFeature( TodoListEntityFeature.MOVE_TODO_ITEM ) ? html` @@ -278,7 +280,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { "ui.panel.lovelace.cards.todo-list.checked_items" )} - ${this.todoListSupportsFeature( + ${this._todoListSupportsFeature( TodoListEntityFeature.DELETE_TODO_ITEM ) ? html` @@ -322,10 +324,10 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { (item) => item.uid, (item) => { const showDelete = - this.todoListSupportsFeature( + this._todoListSupportsFeature( TodoListEntityFeature.DELETE_TODO_ITEM ) && - !this.todoListSupportsFeature( + !this._todoListSupportsFeature( TodoListEntityFeature.UPDATE_TODO_ITEM ); const showReorder = @@ -348,7 +350,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { })}" .selected=${item.status === TodoItemStatus.Completed} .disabled=${unavailable || - !this.todoListSupportsFeature( + !this._todoListSupportsFeature( TodoListEntityFeature.UPDATE_TODO_ITEM )} item-id=${item.uid} @@ -412,7 +414,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { `; } - private todoListSupportsFeature(feature: number): boolean { + private _todoListSupportsFeature(feature: number): boolean { const entityStateObj = this.hass!.states[this._entityId!]; return entityStateObj && supportsFeature(entityStateObj, feature); } diff --git a/src/panels/lovelace/common/directives/action-handler-directive.ts b/src/panels/lovelace/common/directives/action-handler-directive.ts index ef931d895b9c..f78c1312d2f2 100644 --- a/src/panels/lovelace/common/directives/action-handler-directive.ts +++ b/src/panels/lovelace/common/directives/action-handler-directive.ts @@ -72,7 +72,7 @@ class ActionHandler extends HTMLElement implements ActionHandlerType { () => { this.cancelled = true; if (this.timer) { - this.stopAnimation(); + this._stopAnimation(); clearTimeout(this.timer); this.timer = undefined; } @@ -141,7 +141,7 @@ class ActionHandler extends HTMLElement implements ActionHandlerType { if (options.hasHold) { this.held = false; this.timer = window.setTimeout(() => { - this.startAnimation(x, y); + this._startAnimation(x, y); this.held = true; }, this.holdTime); } @@ -162,7 +162,7 @@ class ActionHandler extends HTMLElement implements ActionHandlerType { } if (options.hasHold) { clearTimeout(this.timer); - this.stopAnimation(); + this._stopAnimation(); this.timer = undefined; } if (options.hasHold && this.held) { @@ -207,7 +207,7 @@ class ActionHandler extends HTMLElement implements ActionHandlerType { element.addEventListener("keydown", element.actionHandler.handleKeyDown); } - private startAnimation(x: number, y: number) { + private _startAnimation(x: number, y: number) { Object.assign(this.style, { left: `${x}px`, top: `${y}px`, @@ -215,7 +215,7 @@ class ActionHandler extends HTMLElement implements ActionHandlerType { }); } - private stopAnimation() { + private _stopAnimation() { Object.assign(this.style, { left: null, top: null, diff --git a/src/panels/lovelace/common/graph/get-path.ts b/src/panels/lovelace/common/graph/get-path.ts index 2c97ed5bc06f..542cd910c844 100644 --- a/src/panels/lovelace/common/graph/get-path.ts +++ b/src/panels/lovelace/common/graph/get-path.ts @@ -4,9 +4,9 @@ const midPoint = ( _Bx: number, _By: number ): number[] => { - const _Zx = (_Ax - _Bx) / 2 + _Bx; - const _Zy = (_Ay - _By) / 2 + _By; - return [_Zx, _Zy]; + const zX = (_Ax - _Bx) / 2 + _Bx; + const zY = (_Ay - _By) / 2 + _By; + return [zX, zY]; }; export const getPath = (coords: number[][]): string => { diff --git a/src/panels/lovelace/components/hui-action-editor.ts b/src/panels/lovelace/components/hui-action-editor.ts index a8e4eab7e8aa..951e85d787b4 100644 --- a/src/panels/lovelace/components/hui-action-editor.ts +++ b/src/panels/lovelace/components/hui-action-editor.ts @@ -71,13 +71,13 @@ const ASSIST_SCHEMA = [ export class HuiActionEditor extends LitElement { @property({ attribute: false }) public config?: ActionConfig; - @property() public label?: string; + @property({ attribute: false }) public label?: string; @property({ attribute: false }) public actions?: UiAction[]; @property({ attribute: false }) public defaultAction?: UiAction; - @property() public tooltipText?: string; + @property({ attribute: false }) public tooltipText?: string; @property({ attribute: false }) public hass?: HomeAssistant; diff --git a/src/panels/lovelace/components/hui-badge-edit-mode.ts b/src/panels/lovelace/components/hui-badge-edit-mode.ts index 7da0e29b3179..f35c09b3b961 100644 --- a/src/panels/lovelace/components/hui-badge-edit-mode.ts +++ b/src/panels/lovelace/components/hui-badge-edit-mode.ts @@ -39,7 +39,7 @@ export class HuiBadgeEditMode extends LitElement { @property({ type: Array }) public path!: LovelaceCardPath; - @property({ type: Boolean }) public hiddenOverlay = false; + @property({ attribute: false, type: Boolean }) public hiddenOverlay = false; @state() public _menuOpened: boolean = false; @@ -98,7 +98,7 @@ export class HuiBadgeEditMode extends LitElement { document.removeEventListener("click", this._documentClicked); } - _documentClicked = (ev) => { + private _documentClicked = (ev) => { this._hover = ev.composedPath().includes(this); document.removeEventListener("click", this._documentClicked); }; diff --git a/src/panels/lovelace/components/hui-card-edit-mode.ts b/src/panels/lovelace/components/hui-card-edit-mode.ts index 9775e67e734a..c15a32b650ba 100644 --- a/src/panels/lovelace/components/hui-card-edit-mode.ts +++ b/src/panels/lovelace/components/hui-card-edit-mode.ts @@ -105,7 +105,7 @@ export class HuiCardEditMode extends LitElement { document.removeEventListener("click", this._documentClicked); } - _documentClicked = (ev) => { + private _documentClicked = (ev) => { this._hover = ev.composedPath().includes(this); document.removeEventListener("click", this._documentClicked); }; diff --git a/src/panels/lovelace/components/hui-card-options.ts b/src/panels/lovelace/components/hui-card-options.ts index 851afe9b4018..471ba420347c 100644 --- a/src/panels/lovelace/components/hui-card-options.ts +++ b/src/panels/lovelace/components/hui-card-options.ts @@ -56,7 +56,7 @@ export class HuiCardOptions extends LitElement { @queryAssignedNodes() private _assignedNodes?: NodeListOf; - @property({ type: Boolean }) public hidePosition = false; + @property({ attribute: false, type: Boolean }) public hidePosition = false; @storage({ key: "dashboardCardClipboard", diff --git a/src/panels/lovelace/components/hui-energy-period-selector.ts b/src/panels/lovelace/components/hui-energy-period-selector.ts index dbacc7824ac7..5c8f2ef0b5fe 100644 --- a/src/panels/lovelace/components/hui-energy-period-selector.ts +++ b/src/panels/lovelace/components/hui-energy-period-selector.ts @@ -55,7 +55,7 @@ import type { HomeAssistant } from "../../../types"; export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public collectionKey?: string; + @property({ attribute: "collection-key" }) public collectionKey?: string; @property({ type: Boolean, reflect: true }) public narrow?; diff --git a/src/panels/lovelace/components/hui-generic-entity-row.ts b/src/panels/lovelace/components/hui-generic-entity-row.ts index 7cc06e2f55c5..71d8acebaf16 100644 --- a/src/panels/lovelace/components/hui-generic-entity-row.ts +++ b/src/panels/lovelace/components/hui-generic-entity-row.ts @@ -23,16 +23,16 @@ export class HuiGenericEntityRow extends LitElement { @property({ attribute: false }) public config?: EntitiesCardEntityConfig; - @property() public secondaryText?: string; + @property({ attribute: false }) public secondaryText?: string; - @property({ type: Boolean }) public hideName = false; + @property({ attribute: false, type: Boolean }) public hideName = false; // Allows to control if this row should capture the user interaction, e.g. with its // toggle switch, button or input field. Some domains dynamically decide what to show // => static determination will not work => the caller has to pass the desired value in. // Same applies for custom components that want to override the default behavior. // Default behavior is controlled by DOMAINS_INPUT_ROW. - @property({ type: Boolean }) public catchInteraction?; + @property({ attribute: false, type: Boolean }) public catchInteraction?; protected render() { if (!this.hass || !this.config) { diff --git a/src/panels/lovelace/components/hui-image.ts b/src/panels/lovelace/components/hui-image.ts index 90472db8bac7..81f38a0acb39 100644 --- a/src/panels/lovelace/components/hui-image.ts +++ b/src/panels/lovelace/components/hui-image.ts @@ -42,21 +42,21 @@ export class HuiImage extends LitElement { @property({ attribute: false }) public stateImage?: StateSpecificConfig; - @property() public cameraImage?: string; + @property({ attribute: false }) public cameraImage?: string; - @property() public cameraView?: "live" | "auto"; + @property({ attribute: false }) public cameraView?: "live" | "auto"; - @property() public aspectRatio?: string; + @property({ attribute: false }) public aspectRatio?: string; @property() public filter?: string; @property({ attribute: false }) public stateFilter?: StateSpecificConfig; - @property() public darkModeImage?: string; + @property({ attribute: false }) public darkModeImage?: string; - @property() public darkModeFilter?: string; + @property({ attribute: false }) public darkModeFilter?: string; - @property() public fitMode?: "cover" | "contain" | "fill"; + @property({ attribute: false }) public fitMode?: "cover" | "contain" | "fill"; @state() private _imageVisible? = false; @@ -228,6 +228,7 @@ export class HuiImage extends LitElement { ${this.entity - !("domains" in SecondaryInfoValues[info]) || - ("domains" in SecondaryInfoValues[info] && - SecondaryInfoValues[info].domains!.includes(domain)) - ) as Array + !("domains" in SECONDARY_INFO_VALUES[info]) || + ("domains" in SECONDARY_INFO_VALUES[info] && + SECONDARY_INFO_VALUES[info].domains!.includes(domain)) + ) as Array ).map((info) => ({ value: info, label: localize( diff --git a/src/panels/lovelace/editor/header-footer-editor/hui-header-footer-editor.ts b/src/panels/lovelace/editor/header-footer-editor/hui-header-footer-editor.ts index f9a5036bd3ed..b0ac33caa032 100644 --- a/src/panels/lovelace/editor/header-footer-editor/hui-header-footer-editor.ts +++ b/src/panels/lovelace/editor/header-footer-editor/hui-header-footer-editor.ts @@ -17,7 +17,7 @@ export class HuiHeaderFooterEditor extends LitElement { @property({ attribute: false }) public config?: LovelaceHeaderFooterConfig; - @property() public configValue!: "header" | "footer"; + @property({ attribute: false }) public configValue!: "header" | "footer"; protected render(): TemplateResult { return html` diff --git a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts index 000b5ca9d30f..efd1fc914a45 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts @@ -31,7 +31,7 @@ declare global { export class HuiViewEditor extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property({ type: Boolean }) public isNew = false; + @property({ attribute: false, type: Boolean }) public isNew = false; @state() private _config!: LovelaceViewConfig; diff --git a/src/panels/lovelace/editor/view-editor/hui-view-visibility-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-visibility-editor.ts index 9d3ab7f6a224..88ae1d72c5b3 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-visibility-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-visibility-editor.ts @@ -78,7 +78,7 @@ export class HuiViewVisibilityEditor extends LitElement { @@ -97,7 +97,7 @@ export class HuiViewVisibilityEditor extends LitElement { return (this._visible as ShowViewConfig[]).some((u) => u.user === userId); } - private valChange(ev: Event): void { + private _valChange(ev: Event): void { const userId = (ev.currentTarget as any).userId; const checked = (ev.currentTarget as HaSwitch).checked; diff --git a/src/panels/lovelace/elements/hui-conditional-element.ts b/src/panels/lovelace/elements/hui-conditional-element.ts index 44ccbda64d5a..b2998798204e 100644 --- a/src/panels/lovelace/elements/hui-conditional-element.ts +++ b/src/panels/lovelace/elements/hui-conditional-element.ts @@ -52,16 +52,16 @@ class HuiConditionalElement extends HTMLElement implements LovelaceElement { this._elements.push(createStyledHuiElement(elementConfig)); }); - this.updateElements(); + this._updateElements(); } set hass(hass: HomeAssistant) { this._hass = hass; - this.updateElements(); + this._updateElements(); } - private updateElements() { + private _updateElements() { if (!this._hass || !this._config) { return; } diff --git a/src/panels/lovelace/sections/hui-error-section.ts b/src/panels/lovelace/sections/hui-error-section.ts index 7f38a1739536..6b4847438b63 100644 --- a/src/panels/lovelace/sections/hui-error-section.ts +++ b/src/panels/lovelace/sections/hui-error-section.ts @@ -32,7 +32,7 @@ export class HuiErrorSection { public hass?: HomeAssistant; - @property({ type: Boolean }) public isStrategy = false; + @property({ attribute: false, type: Boolean }) public isStrategy = false; @state() private _config?: ErrorSectionConfig; diff --git a/src/panels/lovelace/sections/hui-grid-section.ts b/src/panels/lovelace/sections/hui-grid-section.ts index d311a4d0731c..efaccd39d251 100644 --- a/src/panels/lovelace/sections/hui-grid-section.ts +++ b/src/panels/lovelace/sections/hui-grid-section.ts @@ -44,13 +44,13 @@ export class GridSection extends LitElement implements LovelaceSectionElement { @property({ type: Number }) public index?: number; - @property({ type: Number }) public viewIndex?: number; + @property({ attribute: false, type: Number }) public viewIndex?: number; - @property({ type: Boolean }) public isStrategy = false; + @property({ attribute: false, type: Boolean }) public isStrategy = false; @property({ attribute: false }) public cards: HuiCard[] = []; - @property({ attribute: false }) public importOnly = false; + @property({ attribute: false, type: Boolean }) public importOnly = false; @state() _config?: LovelaceSectionConfig; diff --git a/src/panels/lovelace/sections/hui-section.ts b/src/panels/lovelace/sections/hui-section.ts index 381c95678e7b..c9aa927aede0 100644 --- a/src/panels/lovelace/sections/hui-section.ts +++ b/src/panels/lovelace/sections/hui-section.ts @@ -48,7 +48,7 @@ export class HuiSection extends ReactiveElement { @property({ type: Number }) public index!: number; - @property({ type: Number }) public viewIndex!: number; + @property({ attribute: false, type: Number }) public viewIndex!: number; @state() private _cards: HuiCard[] = []; diff --git a/src/panels/lovelace/views/hui-masonry-view.ts b/src/panels/lovelace/views/hui-masonry-view.ts index 02abb59d0c80..4bd8b7e1e3ad 100644 --- a/src/panels/lovelace/views/hui-masonry-view.ts +++ b/src/panels/lovelace/views/hui-masonry-view.ts @@ -42,7 +42,7 @@ export class MasonryView extends LitElement implements LovelaceViewElement { @property({ type: Number }) public index?: number; - @property({ type: Boolean }) public isStrategy = false; + @property({ attribute: false, type: Boolean }) public isStrategy = false; @property({ attribute: false }) public cards: HuiCard[] = []; diff --git a/src/panels/lovelace/views/hui-panel-view.ts b/src/panels/lovelace/views/hui-panel-view.ts index 1e49f9300f18..f832afb06046 100644 --- a/src/panels/lovelace/views/hui-panel-view.ts +++ b/src/panels/lovelace/views/hui-panel-view.ts @@ -22,7 +22,7 @@ export class PanelView extends LitElement implements LovelaceViewElement { @property({ type: Number }) public index?: number; - @property({ type: Boolean }) public isStrategy = false; + @property({ attribute: false, type: Boolean }) public isStrategy = false; @property({ attribute: false }) public cards: HuiCard[] = []; diff --git a/src/panels/lovelace/views/hui-sections-view.ts b/src/panels/lovelace/views/hui-sections-view.ts index a5eea8f38cb9..7b9b3ca217d7 100644 --- a/src/panels/lovelace/views/hui-sections-view.ts +++ b/src/panels/lovelace/views/hui-sections-view.ts @@ -57,7 +57,7 @@ export class SectionsView extends LitElement implements LovelaceViewElement { @property({ type: Number }) public index?: number; - @property({ type: Boolean }) public isStrategy = false; + @property({ attribute: false, type: Boolean }) public isStrategy = false; @property({ attribute: false }) public sections: HuiSection[] = []; diff --git a/src/panels/lovelace/views/hui-sidebar-view.ts b/src/panels/lovelace/views/hui-sidebar-view.ts index 36f093371b85..1ba84bd24629 100644 --- a/src/panels/lovelace/views/hui-sidebar-view.ts +++ b/src/panels/lovelace/views/hui-sidebar-view.ts @@ -20,7 +20,7 @@ export class SideBarView extends LitElement implements LovelaceViewElement { @property({ type: Number }) public index?: number; - @property({ type: Boolean }) public isStrategy = false; + @property({ attribute: false, type: Boolean }) public isStrategy = false; @property({ attribute: false }) public cards: HuiCard[] = []; diff --git a/src/panels/lovelace/views/hui-view.ts b/src/panels/lovelace/views/hui-view.ts index 86ea756b148c..7111c20d0182 100644 --- a/src/panels/lovelace/views/hui-view.ts +++ b/src/panels/lovelace/views/hui-view.ts @@ -91,7 +91,7 @@ export class HUIView extends ReactiveElement { return element; } - public _createBadgeElement(badgeConfig: LovelaceBadgeConfig) { + public createBadgeElement(badgeConfig: LovelaceBadgeConfig) { const element = document.createElement("hui-badge"); element.hass = this.hass; element.preview = this.lovelace.editMode; @@ -311,7 +311,7 @@ export class HUIView extends ReactiveElement { this._badges = config.badges.map((badge) => { const badgeConfig = ensureBadgeConfig(badge); - const element = this._createBadgeElement(badgeConfig); + const element = this.createBadgeElement(badgeConfig); return element; }); } diff --git a/src/panels/profile/ha-profile-section-general.ts b/src/panels/profile/ha-profile-section-general.ts index 2cd3fe478b00..4cd71d7ed749 100644 --- a/src/panels/profile/ha-profile-section-general.ts +++ b/src/panels/profile/ha-profile-section-general.ts @@ -40,7 +40,7 @@ class HaProfileSectionGeneral extends LitElement { private _unsubCoreData?: UnsubscribeFunc; - private getCoreData() { + private _getCoreData() { this._unsubCoreData = getOptimisticFrontendUserDataCollection( this.hass.connection, "core" @@ -52,13 +52,13 @@ class HaProfileSectionGeneral extends LitElement { public connectedCallback() { super.connectedCallback(); if (this.hass) { - this.getCoreData(); + this._getCoreData(); } } public firstUpdated() { if (!this._unsubCoreData) { - this.getCoreData(); + this._getCoreData(); } } diff --git a/src/state-summary/state-card-alert.ts b/src/state-summary/state-card-alert.ts index c7688cfd3f67..653b9f342077 100755 --- a/src/state-summary/state-card-alert.ts +++ b/src/state-summary/state-card-alert.ts @@ -14,7 +14,7 @@ class StateCardAlert extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { return html` diff --git a/src/state-summary/state-card-button.ts b/src/state-summary/state-card-button.ts index 08cfe16f7208..33f882fc8ed9 100644 --- a/src/state-summary/state-card-button.ts +++ b/src/state-summary/state-card-button.ts @@ -15,7 +15,7 @@ class StateCardButton extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render() { const stateObj = this.stateObj; diff --git a/src/state-summary/state-card-climate.ts b/src/state-summary/state-card-climate.ts index 29ace0f03a07..8ca20e855581 100644 --- a/src/state-summary/state-card-climate.ts +++ b/src/state-summary/state-card-climate.ts @@ -13,7 +13,7 @@ class StateCardClimate extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { return html` diff --git a/src/state-summary/state-card-configurator.ts b/src/state-summary/state-card-configurator.ts index 533278687198..0e241d461cd3 100644 --- a/src/state-summary/state-card-configurator.ts +++ b/src/state-summary/state-card-configurator.ts @@ -13,7 +13,7 @@ class StateCardConfigurator extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { return html` diff --git a/src/state-summary/state-card-content.ts b/src/state-summary/state-card-content.ts index ad0a950420f0..f2c72f72828e 100644 --- a/src/state-summary/state-card-content.ts +++ b/src/state-summary/state-card-content.ts @@ -36,7 +36,7 @@ class StateCardContent extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render() { let stateCard: string; diff --git a/src/state-summary/state-card-cover.ts b/src/state-summary/state-card-cover.ts index 1c050c0b6674..3f734057a18b 100644 --- a/src/state-summary/state-card-cover.ts +++ b/src/state-summary/state-card-cover.ts @@ -15,7 +15,7 @@ class StateCardCover extends LitElement { @property({ attribute: false }) public stateObj!: CoverEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { return html` diff --git a/src/state-summary/state-card-display.ts b/src/state-summary/state-card-display.ts index 6dc9c1c56c6a..a84a76ed1514 100755 --- a/src/state-summary/state-card-display.ts +++ b/src/state-summary/state-card-display.ts @@ -17,7 +17,7 @@ class StateCardDisplay extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; // property used only in CSS @property({ type: Boolean, reflect: true }) public rtl = false; diff --git a/src/state-summary/state-card-event.ts b/src/state-summary/state-card-event.ts index 23a275a16b02..c954cdbffb91 100644 --- a/src/state-summary/state-card-event.ts +++ b/src/state-summary/state-card-event.ts @@ -13,7 +13,7 @@ class StateCardEvent extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render() { return html` diff --git a/src/state-summary/state-card-humidifier.ts b/src/state-summary/state-card-humidifier.ts index 0e3e6b4f216c..96e1b7e31077 100644 --- a/src/state-summary/state-card-humidifier.ts +++ b/src/state-summary/state-card-humidifier.ts @@ -14,7 +14,7 @@ class StateCardHumidifier extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { return html` diff --git a/src/state-summary/state-card-input_button.ts b/src/state-summary/state-card-input_button.ts index e7e7f0e9f780..918dbee744c9 100644 --- a/src/state-summary/state-card-input_button.ts +++ b/src/state-summary/state-card-input_button.ts @@ -15,7 +15,7 @@ class StateCardInputButton extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render() { const stateObj = this.stateObj; diff --git a/src/state-summary/state-card-input_number.ts b/src/state-summary/state-card-input_number.ts index 2193b73408bc..e90cbabc3394 100644 --- a/src/state-summary/state-card-input_number.ts +++ b/src/state-summary/state-card-input_number.ts @@ -16,7 +16,7 @@ class StateCardInputNumber extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; private _loaded?: boolean; diff --git a/src/state-summary/state-card-input_text.ts b/src/state-summary/state-card-input_text.ts index 7fd9b3873a76..9d8634c64554 100644 --- a/src/state-summary/state-card-input_text.ts +++ b/src/state-summary/state-card-input_text.ts @@ -14,7 +14,7 @@ class StateCardInputText extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; @state() public value: string = ""; diff --git a/src/state-summary/state-card-lawn_mower.ts b/src/state-summary/state-card-lawn_mower.ts index 03b8c3692813..7b7c9c840607 100644 --- a/src/state-summary/state-card-lawn_mower.ts +++ b/src/state-summary/state-card-lawn_mower.ts @@ -13,7 +13,7 @@ class StateCardLawnMower extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; public render() { const stateObj = this.stateObj; diff --git a/src/state-summary/state-card-lock.ts b/src/state-summary/state-card-lock.ts index 7757a6315652..ffa3e1e983af 100644 --- a/src/state-summary/state-card-lock.ts +++ b/src/state-summary/state-card-lock.ts @@ -15,7 +15,7 @@ class StateCardLock extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { const isLocked = this.stateObj.state === "locked"; diff --git a/src/state-summary/state-card-media_player.ts b/src/state-summary/state-card-media_player.ts index 941553eadfa7..4e8598ee4810 100644 --- a/src/state-summary/state-card-media_player.ts +++ b/src/state-summary/state-card-media_player.ts @@ -13,7 +13,7 @@ class StateCardMediaPlayer extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { const playerObj = new HassMediaPlayerEntity(this.hass, this.stateObj); diff --git a/src/state-summary/state-card-number.ts b/src/state-summary/state-card-number.ts index d210327fbf6c..502a2141f4c3 100644 --- a/src/state-summary/state-card-number.ts +++ b/src/state-summary/state-card-number.ts @@ -16,7 +16,7 @@ class StateCardNumber extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; private _loaded?: boolean; diff --git a/src/state-summary/state-card-scene.ts b/src/state-summary/state-card-scene.ts index d4efdac1e1b0..2805d1cb066d 100644 --- a/src/state-summary/state-card-scene.ts +++ b/src/state-summary/state-card-scene.ts @@ -14,7 +14,7 @@ class StateCardScene extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render() { return html` diff --git a/src/state-summary/state-card-script.ts b/src/state-summary/state-card-script.ts index 9b3b8f9b12a8..af7f4ff3685e 100644 --- a/src/state-summary/state-card-script.ts +++ b/src/state-summary/state-card-script.ts @@ -18,7 +18,7 @@ class StateCardScript extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render() { const stateObj = this.stateObj as ScriptEntity; diff --git a/src/state-summary/state-card-timer.ts b/src/state-summary/state-card-timer.ts index 64ee8aef191f..f299cce6ed2b 100644 --- a/src/state-summary/state-card-timer.ts +++ b/src/state-summary/state-card-timer.ts @@ -13,7 +13,7 @@ class StateCardTimer extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { return html` diff --git a/src/state-summary/state-card-toggle.ts b/src/state-summary/state-card-toggle.ts index 7dd883892f9f..cf9253dbc188 100644 --- a/src/state-summary/state-card-toggle.ts +++ b/src/state-summary/state-card-toggle.ts @@ -13,7 +13,7 @@ class StateCardToggle extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { return html` diff --git a/src/state-summary/state-card-update.ts b/src/state-summary/state-card-update.ts index ad1e4a52fc43..d31d709c9020 100755 --- a/src/state-summary/state-card-update.ts +++ b/src/state-summary/state-card-update.ts @@ -13,7 +13,7 @@ export class StateCardUpdate extends LitElement { @property({ attribute: false }) public stateObj!: UpdateEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { return html` diff --git a/src/state-summary/state-card-vacuum.ts b/src/state-summary/state-card-vacuum.ts index 6bdba7ec7ee8..abf06c08041d 100644 --- a/src/state-summary/state-card-vacuum.ts +++ b/src/state-summary/state-card-vacuum.ts @@ -13,7 +13,7 @@ class StateCardVacuum extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { return html` diff --git a/src/state-summary/state-card-water_heater.ts b/src/state-summary/state-card-water_heater.ts index 0e43a02a0ed7..7f84397933d1 100644 --- a/src/state-summary/state-card-water_heater.ts +++ b/src/state-summary/state-card-water_heater.ts @@ -13,7 +13,7 @@ class StateCardWaterHeater extends LitElement { @property({ attribute: false }) public stateObj!: HassEntity; - @property({ type: Boolean }) public inDialog = false; + @property({ attribute: false, type: Boolean }) public inDialog = false; protected render(): TemplateResult { return html` diff --git a/src/state/dialog-manager-mixin.ts b/src/state/dialog-manager-mixin.ts index 2e32da64fb22..26ac3e509b34 100644 --- a/src/state/dialog-manager-mixin.ts +++ b/src/state/dialog-manager-mixin.ts @@ -35,7 +35,7 @@ export const dialogManagerMixin = >( makeDialogManager(this, this.shadowRoot!); } - private registerDialog({ + protected registerDialog({ dialogShowEvent, dialogTag, dialogImport, diff --git a/src/state/quick-bar-mixin.ts b/src/state/quick-bar-mixin.ts index a85f9ac528ef..30a96e7e9366 100644 --- a/src/state/quick-bar-mixin.ts +++ b/src/state/quick-bar-mixin.ts @@ -65,13 +65,11 @@ export default >(superClass: T) => a: (ev) => this._showVoiceCommandDialog(ev), d: (ev) => this._showQuickBar(ev, QuickBarMode.Device), // Those are fallbacks for non-latin keyboards that don't have e, c, m keys (qwerty-based shortcuts) - /* eslint-disable @typescript-eslint/naming-convention */ KeyE: (ev) => this._showQuickBar(ev), KeyC: (ev) => this._showQuickBar(ev, QuickBarMode.Command), KeyM: (ev) => this._createMyLink(ev), KeyA: (ev) => this._showVoiceCommandDialog(ev), KeyD: (ev) => this._showQuickBar(ev, QuickBarMode.Device), - /* eslint-enable @typescript-eslint/naming-convention */ }); } diff --git a/src/types/node-vibrant.d.ts b/src/types/node-vibrant.d.ts index 0733624274cb..3b16ea4b693f 100644 --- a/src/types/node-vibrant.d.ts +++ b/src/types/node-vibrant.d.ts @@ -1,4 +1,4 @@ -// eslint-disable-next-line @typescript-eslint/naming-convention, no-var +// eslint-disable-next-line no-var declare var Vibrant: Any; declare module "node-vibrant" { export default Vibrant;