From 9ce4563dd436afadf6881f67c40f81b708d5f5e1 Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Tue, 28 Feb 2023 05:02:47 -0500 Subject: [PATCH] Prefer nothing over empty templates (#15633) --- .eslintrc.json | 1 - cast/src/receiver/layout/hc-demo.ts | 6 +-- demo/src/custom-cards/cast-demo-row.ts | 6 +-- demo/src/custom-cards/ha-demo-card.ts | 6 +-- gallery/src/components/page-description.ts | 4 +- .../src/pages/automation/describe-action.ts | 6 +-- .../pages/automation/describe-condition.ts | 6 +-- .../src/pages/automation/describe-trigger.ts | 6 +-- .../src/pages/automation/trace-timeline.ts | 7 ++-- gallery/src/pages/automation/trace.ts | 11 +++--- gallery/src/pages/misc/entity-state.ts | 6 +-- gallery/src/pages/misc/integration-card.ts | 18 ++++----- hassio/src/addon-store/hassio-addon-store.ts | 7 ++-- .../addon-view/config/hassio-addon-network.ts | 6 +-- hassio/src/backups/hassio-backups.ts | 6 +-- .../components/supervisor-backup-content.ts | 15 ++++++-- hassio/src/dashboard/hassio-update.ts | 12 +++--- .../backup/dialog-hassio-backup-upload.ts | 6 +-- .../dialogs/backup/dialog-hassio-backup.ts | 12 +++--- .../backup/dialog-hassio-create-backup.ts | 10 ++--- .../datadisk/dialog-hassio-datadisk.ts | 6 +-- .../hardware/dialog-hassio-hardware.ts | 8 ++-- .../markdown/dialog-hassio-markdown.ts | 6 +-- .../dialogs/network/dialog-hassio-network.ts | 6 +-- .../dialog-hassio-repositories.ts | 14 +++---- hassio/src/hassio-my-redirect.ts | 6 +-- .../update-available/update-available-card.ts | 6 +-- src/auth/ha-auth-flow.ts | 14 +++---- src/components/chart/state-history-charts.ts | 12 +++--- src/components/data-table/ha-data-table.ts | 10 ++--- .../device/ha-area-devices-picker.ts | 8 ++-- .../device/ha-device-automation-picker.ts | 6 +-- src/components/device/ha-devices-picker.ts | 6 +-- src/components/entity/ha-entities-picker.ts | 6 +-- .../entity/ha-entity-attribute-picker.ts | 6 +-- .../entity/ha-entity-state-picker.ts | 12 +++--- src/components/entity/ha-statistics-picker.ts | 6 +-- src/components/entity/state-badge.ts | 6 +-- src/components/entity/state-info.ts | 6 +-- src/components/ha-addon-picker.ts | 6 +-- src/components/ha-areas-picker.ts | 6 +-- src/components/ha-attributes.ts | 15 ++++++-- src/components/ha-blueprint-picker.ts | 6 +-- src/components/ha-camera-stream.ts | 10 ++--- src/components/ha-card.ts | 6 +-- src/components/ha-config-entry-picker.ts | 14 +++---- src/components/ha-cover-controls.ts | 6 +-- src/components/ha-cover-tilt-controls.ts | 6 +-- src/components/ha-dialog-date-picker.ts | 4 +- src/components/ha-icon.ts | 6 +-- src/components/ha-markdown.ts | 6 +-- src/components/ha-network.ts | 4 +- src/components/ha-related-items.ts | 6 +-- .../ha-selector/ha-selector-area.ts | 6 +-- .../ha-selector/ha-selector-device.ts | 4 +- .../ha-selector/ha-selector-entity.ts | 4 +- .../ha-selector/ha-selector-target.ts | 6 +-- src/components/ha-sidebar.ts | 3 +- src/components/ha-target-picker.ts | 4 +- src/components/ha-tip.ts | 8 ++-- src/components/ha-yaml-editor.ts | 6 +-- .../media-player/dialog-media-manage.ts | 8 ++-- .../dialog-media-player-browse.ts | 10 ++--- .../media-player/ha-media-manage-button.ts | 12 +++--- .../media-player/ha-media-player-browse.ts | 5 ++- .../media-player/ha-media-upload-button.ts | 14 +++---- src/components/trace/hat-trace-timeline.ts | 5 ++- src/components/user/ha-person-badge.ts | 6 +-- src/components/user/ha-user-badge.ts | 6 +-- src/components/user/ha-users-picker.ts | 6 +-- src/dialogs/aliases/dialog-aliases.ts | 6 +-- .../dialog-config-entry-system-options.ts | 6 +-- .../config-flow/dialog-data-entry-flow.ts | 6 +-- src/dialogs/config-flow/step-flow-abort.ts | 18 +++------ .../domain-toggler/dialog-domain-toggler.ts | 6 +-- src/dialogs/generic/dialog-box.ts | 6 +-- .../ha-more-info-view-light-color-picker.ts | 6 +-- .../controls/more-info-alarm_control_panel.ts | 12 +++--- .../controls/more-info-automation.ts | 6 +-- .../more-info/controls/more-info-camera.ts | 6 +-- .../more-info/controls/more-info-climate.ts | 6 +-- .../controls/more-info-configurator.ts | 6 +-- .../more-info/controls/more-info-counter.ts | 6 +-- .../more-info/controls/more-info-cover.ts | 10 ++--- .../more-info/controls/more-info-default.ts | 6 +-- .../more-info/controls/more-info-group.ts | 6 +-- .../controls/more-info-humidifier.ts | 6 +-- .../controls/more-info-input_datetime.ts | 6 +-- .../more-info/controls/more-info-lock.ts | 6 +-- .../controls/more-info-media_player.ts | 6 +-- .../more-info/controls/more-info-person.ts | 6 +-- .../more-info/controls/more-info-remote.ts | 12 +++--- .../more-info/controls/more-info-script.ts | 6 +-- .../more-info/controls/more-info-sun.ts | 6 +-- .../more-info/controls/more-info-timer.ts | 6 +-- .../more-info/controls/more-info-update.ts | 12 +++--- .../more-info/controls/more-info-vacuum.ts | 6 +-- .../more-info/controls/more-info-weather.ts | 6 +-- src/dialogs/more-info/ha-more-info-history.ts | 14 +++---- src/dialogs/more-info/ha-more-info-logbook.ts | 8 ++-- .../more-info/ha-more-info-settings.ts | 13 +++++-- .../configurator-notification-item.ts | 6 +-- .../notifications/notification-item.ts | 6 +-- .../persistent-notification-item.ts | 6 +-- src/dialogs/quick-bar/ha-quick-bar.ts | 10 ++--- src/dialogs/restart/dialog-restart.ts | 6 +-- .../ha-voice-command-dialog.ts | 6 +-- src/onboarding/ha-onboarding.ts | 6 +-- src/onboarding/onboarding-integrations.ts | 9 +++-- .../calendar/confirm-event-dialog-box.ts | 8 ++-- .../calendar/dialog-calendar-event-detail.ts | 12 +++--- .../calendar/dialog-calendar-event-editor.ts | 10 ++--- src/panels/calendar/ha-full-calendar.ts | 6 +-- .../calendar/ha-recurrence-rule-editor.ts | 26 ++++++------- .../dialog-add-application-credential.ts | 6 +-- .../ha-config-application-credentials.ts | 11 +++++- .../areas/dialog-area-registry-detail.ts | 8 ++-- .../config/areas/ha-config-area-page.ts | 10 ++--- .../dialog-automation-mode.ts | 24 ++++++------ .../dialog-automation-rename.ts | 12 +++--- .../condition/ha-automation-condition-row.ts | 4 +- .../condition/ha-automation-condition.ts | 13 +++++-- .../automation/dialog-new-automation.ts | 6 +-- .../automation/thingtalk/dialog-thingtalk.ts | 6 +-- .../types/ha-automation-trigger-tag.ts | 4 +- .../types/ha-automation-trigger-time.ts | 14 +++---- .../blueprint/dialog-import-blueprint.ts | 6 +-- .../config/cloud/account/cloud-alexa-pref.ts | 6 +-- .../config/cloud/account/cloud-google-pref.ts | 6 +-- .../config/cloud/account/cloud-remote-pref.ts | 6 +-- .../config/cloud/account/cloud-tts-pref.ts | 6 +-- .../cloud/account/dialog-cloud-tts-try.ts | 6 +-- .../dialog-cloud-certificate.ts | 4 +- .../dialog-manage-cloudhook.ts | 4 +- .../config/core/updates/dialog-join-beta.ts | 6 +-- .../config/dashboard/ha-config-updates.ts | 16 ++++---- .../ha-device-automation-card.ts | 6 +-- .../ha-device-automation-dialog.ts | 6 +-- .../ha-device-via-devices-card.ts | 6 +-- .../mqtt/dialog-mqtt-device-debug-info.ts | 13 +++++-- .../zha/ha-device-info-zha.ts | 6 +-- .../zwave_js/ha-device-info-zwave_js.ts | 10 ++--- .../dialog-device-registry-detail.ts | 8 ++-- .../components/ha-energy-validation-result.ts | 4 +- .../dialogs/dialog-energy-battery-settings.ts | 12 +++--- .../dialogs/dialog-energy-device-settings.ts | 18 ++++----- .../dialogs/dialog-energy-gas-settings.ts | 32 ++++++++-------- .../dialog-energy-grid-flow-settings.ts | 30 +++++++-------- .../dialogs/dialog-energy-solar-settings.ts | 28 +++++++------- .../dialogs/dialog-energy-water-settings.ts | 10 ++--- .../settings/entity-settings-helper-tab.ts | 6 +-- .../entities/entity-registry-basic-editor.ts | 8 ++-- .../entities/entity-registry-settings.ts | 12 +++--- .../config/entities/ha-config-entities.ts | 6 +-- .../hardware/dialog-hardware-available.ts | 6 +-- .../config/helpers/dialog-helper-detail.ts | 13 +++++-- .../config/helpers/forms/ha-counter-form.ts | 8 ++-- .../helpers/forms/ha-input_boolean-form.ts | 6 +-- .../helpers/forms/ha-input_button-form.ts | 6 +-- .../helpers/forms/ha-input_datetime-form.ts | 8 ++-- .../helpers/forms/ha-input_number-form.ts | 12 +++--- .../helpers/forms/ha-input_select-form.ts | 6 +-- .../helpers/forms/ha-input_text-form.ts | 14 +++---- .../config/helpers/forms/ha-schedule-form.ts | 6 +-- .../config/helpers/forms/ha-timer-form.ts | 6 +-- .../integrations/dialog-add-integration.ts | 15 ++++++-- .../integrations/dialog-yaml-integration.ts | 6 +-- .../integrations/ha-integration-list-item.ts | 19 ++++++---- .../matter/dialog-matter-add-device.ts | 6 +-- .../zha/dialog-zha-manage-zigbee-device.ts | 28 +++++++------- .../zha/dialog-zha-reconfigure-device.ts | 6 +-- .../zha/zha-cluster-attributes.ts | 9 +++-- .../zha/zha-cluster-commands.ts | 8 ++-- .../integration-panels/zha/zha-device-card.ts | 26 ++++++------- .../zha/zha-device-neighbors.ts | 12 +++--- .../zha/zha-device-pairing-status-card.ts | 12 +++--- .../zha/zha-device-signature.ts | 6 +-- .../integration-panels/zha/zha-group-page.ts | 13 +++++-- .../zha/zha-manage-clusters.ts | 10 ++--- .../zwave_js/dialog-zwave_js-add-node.ts | 6 +-- .../zwave_js/dialog-zwave_js-heal-network.ts | 8 ++-- .../zwave_js/dialog-zwave_js-heal-node.ts | 12 +++--- .../dialog-zwave_js-node-statistics.ts | 29 ++++++++------ .../dialog-zwave_js-reinterview-node.ts | 6 +-- .../dialog-zwave_js-remove-failed-node.ts | 6 +-- .../zwave_js/dialog-zwave_js-remove-node.ts | 6 +-- .../dialog-zwave_js-update-firmware-node.ts | 38 +++++++++---------- .../zwave_js/zwave_js-config-dashboard.ts | 33 +++++++++------- .../config/logs/dialog-system-log-detail.ts | 8 ++-- src/panels/config/logs/system-log-card.ts | 6 +-- .../dialog-lovelace-dashboard-detail.ts | 6 +-- .../ha-config-lovelace-dashboards.ts | 6 +-- .../dialog-lovelace-resource-detail.ts | 8 ++-- src/panels/config/network/dialog-ip-detail.ts | 6 +-- .../config/network/ha-config-network.ts | 6 +-- .../config/network/ha-config-url-form.ts | 6 +-- .../config/network/supervisor-hostname.ts | 6 +-- .../config/network/supervisor-network.ts | 6 +-- .../config/person/dialog-person-detail.ts | 8 ++-- src/panels/config/person/ha-config-person.ts | 6 +-- .../repairs/dialog-integration-startup.ts | 6 +-- .../config/repairs/dialog-repairs-issue.ts | 6 +-- .../repairs/dialog-system-information.ts | 15 ++++++-- .../config/repairs/ha-config-repairs.ts | 6 +-- .../repairs/integrations-startup-time.ts | 6 +-- src/panels/config/scene/ha-scene-editor.ts | 10 ++--- src/panels/config/script/ha-script-editor.ts | 7 ++-- .../config/storage/dialog-move-datadisk.ts | 6 +-- src/panels/config/tags/dialog-tag-detail.ts | 15 ++++++-- src/panels/config/tags/tag-image.ts | 4 +- src/panels/config/users/dialog-add-user.ts | 6 +-- .../users/dialog-admin-change-password.ts | 6 +-- src/panels/config/users/dialog-user-detail.ts | 6 +-- src/panels/config/zone/dialog-zone-detail.ts | 8 ++-- .../dialog-statistics-adjust-sum.ts | 5 ++- .../dialog-statistics-fix-units-changed.ts | 16 ++++---- .../template/developer-tools-template.ts | 4 +- src/panels/logbook/ha-logbook-renderer.ts | 13 +++---- src/panels/logbook/ha-logbook.ts | 8 ++-- src/panels/lovelace/badges/hui-error-badge.ts | 6 +-- .../lovelace/badges/hui-state-label-badge.ts | 6 +-- .../hui-energy-carbon-consumed-gauge-card.ts | 8 ++-- .../cards/energy/hui-energy-compare-card.ts | 6 +-- .../energy/hui-energy-date-selection-card.ts | 8 ++-- .../energy/hui-energy-devices-graph-card.ts | 6 +-- .../energy/hui-energy-distribution-card.ts | 4 +- .../cards/energy/hui-energy-gas-graph-card.ts | 8 ++-- .../hui-energy-grid-neutrality-gauge-card.ts | 10 ++--- .../hui-energy-solar-consumed-gauge-card.ts | 8 ++-- .../energy/hui-energy-solar-graph-card.ts | 8 ++-- .../energy/hui-energy-sources-table-card.ts | 19 +++------- .../energy/hui-energy-usage-graph-card.ts | 8 ++-- .../energy/hui-energy-water-graph-card.ts | 10 ++--- .../lovelace/cards/hui-alarm-panel-card.ts | 10 ++--- src/panels/lovelace/cards/hui-area-card.ts | 7 ++-- src/panels/lovelace/cards/hui-button-card.ts | 6 +-- .../lovelace/cards/hui-calendar-card.ts | 8 ++-- .../lovelace/cards/hui-empty-state-card.ts | 6 +-- .../lovelace/cards/hui-entities-card.ts | 7 ++-- src/panels/lovelace/cards/hui-entity-card.ts | 6 +-- src/panels/lovelace/cards/hui-error-card.ts | 6 +-- src/panels/lovelace/cards/hui-gauge-card.ts | 6 +-- src/panels/lovelace/cards/hui-glance-card.ts | 5 ++- .../lovelace/cards/hui-history-graph-card.ts | 6 +-- .../lovelace/cards/hui-humidifier-card.ts | 6 +-- src/panels/lovelace/cards/hui-iframe-card.ts | 6 +-- src/panels/lovelace/cards/hui-light-card.ts | 6 +-- src/panels/lovelace/cards/hui-logbook-card.ts | 6 +-- src/panels/lovelace/cards/hui-map-card.ts | 34 ++++++++--------- .../lovelace/cards/hui-markdown-card.ts | 6 +-- .../lovelace/cards/hui-media-control-card.ts | 6 +-- src/panels/lovelace/cards/hui-picture-card.ts | 6 +-- .../cards/hui-picture-elements-card.ts | 6 +-- .../lovelace/cards/hui-picture-entity-card.ts | 5 ++- .../lovelace/cards/hui-picture-glance-card.ts | 5 ++- .../lovelace/cards/hui-plant-status-card.ts | 6 +-- .../lovelace/cards/hui-shopping-list-card.ts | 6 +-- src/panels/lovelace/cards/hui-stack-card.ts | 6 +-- .../lovelace/cards/hui-starting-card.ts | 6 +-- .../lovelace/cards/hui-statistic-card.ts | 6 +-- .../cards/hui-statistics-graph-card.ts | 6 +-- .../lovelace/cards/hui-thermostat-card.ts | 10 ++--- src/panels/lovelace/cards/hui-tile-card.ts | 13 +++++-- .../cards/hui-weather-forecast-card.ts | 6 +-- .../lovelace/components/hui-action-editor.ts | 8 ++-- .../components/hui-energy-period-selector.ts | 12 +++--- .../components/hui-entities-toggle.ts | 6 +-- .../lovelace/components/hui-entity-editor.ts | 6 +-- .../components/hui-generic-entity-row.ts | 8 ++-- src/panels/lovelace/components/hui-image.ts | 12 +++--- .../components/hui-input-list-editor.ts | 8 ++-- src/panels/lovelace/components/hui-marquee.ts | 6 +-- .../components/hui-timestamp-display.ts | 6 +-- .../editor/card-editor/hui-card-picker.ts | 7 ++-- .../card-editor/hui-dialog-create-card.ts | 6 +-- .../card-editor/hui-dialog-delete-card.ts | 6 +-- .../card-editor/hui-dialog-edit-card.ts | 6 +-- .../card-editor/hui-dialog-suggest-card.ts | 6 +-- .../hui-alarm-panel-card-editor.ts | 6 +-- .../config-elements/hui-area-card-editor.ts | 6 +-- .../config-elements/hui-button-card-editor.ts | 6 +-- .../hui-calendar-card-editor.ts | 10 ++--- .../hui-conditional-card-editor.ts | 6 +-- .../hui-entities-card-editor.ts | 14 +++---- .../config-elements/hui-entity-card-editor.ts | 6 +-- .../config-elements/hui-gauge-card-editor.ts | 6 +-- .../hui-generic-entity-row-editor.ts | 6 +-- .../config-elements/hui-glance-card-editor.ts | 14 +++---- .../hui-graph-footer-editor.ts | 6 +-- .../config-elements/hui-grid-card-editor.ts | 6 +-- .../hui-history-graph-card-editor.ts | 14 +++---- .../hui-humidifier-card-editor.ts | 6 +-- .../config-elements/hui-iframe-card-editor.ts | 8 ++-- .../config-elements/hui-light-card-editor.ts | 6 +-- .../hui-logbook-card-editor.ts | 10 ++--- .../config-elements/hui-map-card-editor.ts | 8 ++-- .../hui-markdown-card-editor.ts | 8 ++-- .../hui-media-control-card-editor.ts | 6 +-- .../hui-picture-card-editor.ts | 8 ++-- .../hui-picture-entity-card-editor.ts | 6 +-- .../hui-picture-glance-card-editor.ts | 6 +-- .../hui-plant-status-card-editor.ts | 6 +-- .../config-elements/hui-sensor-card-editor.ts | 6 +-- .../hui-shopping-list-editor.ts | 10 ++--- .../config-elements/hui-stack-card-editor.ts | 6 +-- .../hui-statistic-card-editor.ts | 6 +-- .../hui-statistics-graph-card-editor.ts | 8 ++-- .../hui-thermostat-card-editor.ts | 6 +-- .../config-elements/hui-tile-card-editor.ts | 6 +-- ...hui-vacuum-commands-tile-feature-editor.ts | 6 +-- .../hui-weather-forecast-card-editor.ts | 6 +-- .../hui-dialog-create-headerfooter.ts | 6 +-- .../lovelace/editor/hui-dialog-save-config.ts | 6 +-- .../editor/hui-entities-card-row-editor.ts | 6 +-- .../hui-dialog-edit-lovelace.ts | 8 ++-- .../select-view/hui-dialog-select-view.ts | 6 +-- .../unused-entities/hui-unused-entities.ts | 8 ++-- .../view-editor/hui-dialog-edit-view.ts | 6 +-- .../editor/view-editor/hui-view-editor.ts | 6 +-- .../view-editor/hui-view-visibility-editor.ts | 6 +-- .../lovelace/elements/hui-icon-element.ts | 6 +-- .../lovelace/elements/hui-image-element.ts | 6 +-- .../elements/hui-service-button-element.ts | 6 +-- .../elements/hui-state-badge-element.ts | 6 +-- .../elements/hui-state-icon-element.ts | 6 +-- .../elements/hui-state-label-element.ts | 6 +-- .../entity-rows/hui-button-entity-row.ts | 6 +-- .../entity-rows/hui-climate-entity-row.ts | 6 +-- .../entity-rows/hui-cover-entity-row.ts | 6 +-- .../entity-rows/hui-group-entity-row.ts | 6 +-- .../entity-rows/hui-humidifier-entity-row.ts | 6 +-- .../hui-input-button-entity-row.ts | 6 +-- .../hui-input-datetime-entity-row.ts | 10 ++--- .../hui-input-number-entity-row.ts | 6 +-- .../hui-input-select-entity-row.ts | 10 ++--- .../entity-rows/hui-input-text-entity-row.ts | 10 ++--- .../entity-rows/hui-lock-entity-row.ts | 6 +-- .../hui-media-player-entity-row.ts | 6 +-- .../entity-rows/hui-number-entity-row.ts | 8 ++-- .../entity-rows/hui-scene-entity-row.ts | 6 +-- .../entity-rows/hui-script-entity-row.ts | 6 +-- .../entity-rows/hui-select-entity-row.ts | 6 +-- .../entity-rows/hui-sensor-entity-row.ts | 6 +-- .../entity-rows/hui-simple-entity-row.ts | 6 +-- .../entity-rows/hui-text-entity-row.ts | 12 +++--- .../entity-rows/hui-timer-entity-row.ts | 6 +-- .../entity-rows/hui-toggle-entity-row.ts | 6 +-- .../entity-rows/hui-weather-entity-row.ts | 6 +-- .../header-footer/hui-graph-header-footer.ts | 10 ++--- .../hui-picture-header-footer.ts | 6 +-- .../special-rows/hui-attribute-row.ts | 6 +-- .../lovelace/special-rows/hui-button-row.ts | 8 ++-- .../lovelace/special-rows/hui-cast-row.ts | 8 ++-- .../lovelace/special-rows/hui-divider-row.ts | 6 +-- .../lovelace/special-rows/hui-section-row.ts | 8 ++-- .../lovelace/special-rows/hui-text-row.ts | 6 +-- .../lovelace/special-rows/hui-weblink-row.ts | 6 +-- .../media-browser/ha-bar-media-player.ts | 6 +-- .../hui-dialog-web-browser-play-media.ts | 13 ++----- src/panels/my/ha-panel-my.ts | 4 +- .../dialog-ha-mfa-module-setup-flow.ts | 6 +-- .../ha-long-lived-access-token-dialog.ts | 15 ++++++-- 362 files changed, 1533 insertions(+), 1435 deletions(-) mode change 100755 => 100644 hassio/src/dialogs/hardware/dialog-hassio-hardware.ts mode change 100755 => 100644 src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts mode change 100755 => 100644 src/panels/lovelace/editor/card-editor/hui-dialog-suggest-card.ts diff --git a/.eslintrc.json b/.eslintrc.json index 5680879b3c..553dba0c4a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -119,7 +119,6 @@ "lit/no-template-map": "off", "lit/no-native-attributes": "warn", "lit/no-this-assign-in-render": "warn", - "lit/prefer-nothing": "warn", "lit-a11y/click-events-have-key-events": ["off"], "lit-a11y/no-autofocus": "off", "lit-a11y/alt-text": "warn", diff --git a/cast/src/receiver/layout/hc-demo.ts b/cast/src/receiver/layout/hc-demo.ts index a5822ebe97..16daeead9b 100644 --- a/cast/src/receiver/layout/hc-demo.ts +++ b/cast/src/receiver/layout/hc-demo.ts @@ -1,4 +1,4 @@ -import { html, TemplateResult } from "lit"; +import { html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { mockHistory } from "../../../../demo/src/stubs/history"; import { LovelaceConfig } from "../../../../src/data/lovelace"; @@ -18,9 +18,9 @@ class HcDemo extends HassElement { @state() private _lovelaceConfig?: LovelaceConfig; - protected render(): TemplateResult { + protected render() { if (!this._lovelaceConfig) { - return html``; + return nothing; } return html` diff --git a/demo/src/custom-cards/ha-demo-card.ts b/demo/src/custom-cards/ha-demo-card.ts index 89835b5174..92f1731b71 100644 --- a/demo/src/custom-cards/ha-demo-card.ts +++ b/demo/src/custom-cards/ha-demo-card.ts @@ -1,5 +1,5 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { until } from "lit/directives/until"; import "../../../src/components/ha-card"; @@ -30,9 +30,9 @@ export class HADemoCard extends LitElement implements LovelaceCard { public setConfig(_config: LovelaceCardConfig) {} - protected render(): TemplateResult { + protected render() { if (this._hidden) { - return html``; + return nothing; } return html` diff --git a/gallery/src/components/page-description.ts b/gallery/src/components/page-description.ts index e9680e59b3..9c98d9b37e 100644 --- a/gallery/src/components/page-description.ts +++ b/gallery/src/components/page-description.ts @@ -1,4 +1,4 @@ -import { html, css } from "lit"; +import { css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { until } from "lit/directives/until"; import { HaMarkdown } from "../../../src/components/ha-markdown"; @@ -10,7 +10,7 @@ class PageDescription extends HaMarkdown { render() { if (!PAGES[this.page].description) { - return html``; + return nothing; } return html` diff --git a/gallery/src/pages/automation/describe-action.ts b/gallery/src/pages/automation/describe-action.ts index 6465e9fc1e..9735880916 100644 --- a/gallery/src/pages/automation/describe-action.ts +++ b/gallery/src/pages/automation/describe-action.ts @@ -1,5 +1,5 @@ import { dump } from "js-yaml"; -import { html, css, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-yaml-editor"; @@ -127,9 +127,9 @@ export class DemoAutomationDescribeAction extends LitElement { @state() _action = initialAction; - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` diff --git a/gallery/src/pages/automation/describe-condition.ts b/gallery/src/pages/automation/describe-condition.ts index 3350dce74f..dfd959a633 100644 --- a/gallery/src/pages/automation/describe-condition.ts +++ b/gallery/src/pages/automation/describe-condition.ts @@ -1,5 +1,5 @@ import { dump } from "js-yaml"; -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-yaml-editor"; @@ -53,9 +53,9 @@ export class DemoAutomationDescribeCondition extends LitElement { @state() _condition = initialCondition; - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` diff --git a/gallery/src/pages/automation/describe-trigger.ts b/gallery/src/pages/automation/describe-trigger.ts index 081f6162a7..49a57e652a 100644 --- a/gallery/src/pages/automation/describe-trigger.ts +++ b/gallery/src/pages/automation/describe-trigger.ts @@ -1,5 +1,5 @@ import { dump } from "js-yaml"; -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-yaml-editor"; @@ -64,9 +64,9 @@ export class DemoAutomationDescribeTrigger extends LitElement { @state() _trigger = initialTrigger; - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` diff --git a/gallery/src/pages/automation/trace-timeline.ts b/gallery/src/pages/automation/trace-timeline.ts index b4d9fea9ec..638da986e0 100644 --- a/gallery/src/pages/automation/trace-timeline.ts +++ b/gallery/src/pages/automation/trace-timeline.ts @@ -1,5 +1,6 @@ /* eslint-disable lit/no-template-arrow */ -import { html, css, LitElement, TemplateResult } from "lit"; + +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/trace/hat-script-graph"; @@ -29,9 +30,9 @@ const traces: DemoTrace[] = [ export class DemoAutomationTraceTimeline extends LitElement { @property({ attribute: false }) hass?: HomeAssistant; - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` ${traces.map( diff --git a/gallery/src/pages/automation/trace.ts b/gallery/src/pages/automation/trace.ts index 7de26e1004..0092915510 100644 --- a/gallery/src/pages/automation/trace.ts +++ b/gallery/src/pages/automation/trace.ts @@ -1,14 +1,15 @@ /* eslint-disable lit/no-template-arrow */ -import { html, css, LitElement, TemplateResult } from "lit"; + +import { css, html, LitElement, nothing } from "lit"; +import { customElement, property, state } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/trace/hat-script-graph"; import "../../../../src/components/trace/hat-trace-timeline"; -import { customElement, property, state } from "lit/decorators"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import { HomeAssistant } from "../../../../src/types"; -import { DemoTrace } from "../../data/traces/types"; import { basicTrace } from "../../data/traces/basic_trace"; import { motionLightTrace } from "../../data/traces/motion-light-trace"; +import { DemoTrace } from "../../data/traces/types"; const traces: DemoTrace[] = [basicTrace, motionLightTrace]; @@ -18,9 +19,9 @@ export class DemoAutomationTrace extends LitElement { @state() private _selected = {}; - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` ${traces.map( diff --git a/gallery/src/pages/misc/entity-state.ts b/gallery/src/pages/misc/entity-state.ts index abd6e7c4f3..c49fcc0abc 100644 --- a/gallery/src/pages/misc/entity-state.ts +++ b/gallery/src/pages/misc/entity-state.ts @@ -2,7 +2,7 @@ import { HassEntity, HassEntityAttributeBase, } from "home-assistant-js-websocket"; -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { computeDomain } from "../../../../src/common/entity/compute_domain"; @@ -387,9 +387,9 @@ export class DemoEntityState extends LitElement { hass.updateTranslations("config", "en"); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` diff --git a/gallery/src/pages/misc/integration-card.ts b/gallery/src/pages/misc/integration-card.ts index 168344e51b..f99b5f676c 100644 --- a/gallery/src/pages/misc/integration-card.ts +++ b/gallery/src/pages/misc/integration-card.ts @@ -1,22 +1,22 @@ -import { html, css, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import "../../../../src/components/ha-formfield"; import "../../../../src/components/ha-switch"; -import { classMap } from "lit/directives/class-map"; import { customElement, property, state } from "lit/decorators"; +import { classMap } from "lit/directives/class-map"; import { IntegrationManifest } from "../../../../src/data/integration"; +import { DeviceRegistryEntry } from "../../../../src/data/device_registry"; +import { EntityRegistryEntry } from "../../../../src/data/entity_registry"; import { provideHass } from "../../../../src/fake_data/provide_hass"; -import { HomeAssistant } from "../../../../src/types"; -import "../../../../src/panels/config/integrations/ha-integration-card"; -import "../../../../src/panels/config/integrations/ha-ignored-config-entry-card"; import "../../../../src/panels/config/integrations/ha-config-flow-card"; import type { ConfigEntryExtended, DataEntryFlowProgressExtended, } from "../../../../src/panels/config/integrations/ha-config-integrations"; -import { DeviceRegistryEntry } from "../../../../src/data/device_registry"; -import { EntityRegistryEntry } from "../../../../src/data/entity_registry"; +import "../../../../src/panels/config/integrations/ha-ignored-config-entry-card"; +import "../../../../src/panels/config/integrations/ha-integration-card"; +import { HomeAssistant } from "../../../../src/types"; const createConfigEntry = ( title: string, @@ -231,9 +231,9 @@ export class DemoIntegrationCard extends LitElement { @state() isCloud = false; - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html`
diff --git a/hassio/src/addon-store/hassio-addon-store.ts b/hassio/src/addon-store/hassio-addon-store.ts index 0ae00d5453..024d803be2 100644 --- a/hassio/src/addon-store/hassio-addon-store.ts +++ b/hassio/src/addon-store/hassio-addon-store.ts @@ -6,6 +6,7 @@ import { CSSResultGroup, html, LitElement, + nothing, PropertyValues, TemplateResult, } from "lit"; @@ -73,8 +74,8 @@ export class HassioAddonStore extends LitElement { } } - protected render(): TemplateResult { - let repos: TemplateResult[] = []; + protected render() { + let repos: (TemplateResult | typeof nothing)[] = []; if (this.supervisor.store.repositories) { repos = this.addonRepositories( @@ -173,7 +174,7 @@ export class HassioAddonStore extends LitElement { .supervisor=${this.supervisor} > ` - : html``; + : nothing; }) ); diff --git a/hassio/src/addon-view/config/hassio-addon-network.ts b/hassio/src/addon-view/config/hassio-addon-network.ts index 2d3b11c5ad..0e315bbf11 100644 --- a/hassio/src/addon-view/config/hassio-addon-network.ts +++ b/hassio/src/addon-view/config/hassio-addon-network.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; @@ -47,9 +47,9 @@ class HassioAddonNetwork extends LitElement { this._setNetworkConfig(); } - protected render(): TemplateResult { + protected render() { if (!this._config) { - return html``; + return nothing; } const hasHiddenOptions = Object.keys(this._config).find( diff --git a/hassio/src/backups/hassio-backups.ts b/hassio/src/backups/hassio-backups.ts index abd17be598..bca0160b64 100644 --- a/hassio/src/backups/hassio-backups.ts +++ b/hassio/src/backups/hassio-backups.ts @@ -8,7 +8,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -160,9 +160,9 @@ export class HassioBackups extends LitElement { })) ); - protected render(): TemplateResult { + protected render() { if (!this.supervisor) { - return html``; + return nothing; } return html` diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts b/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts index 05901f2a3a..8718a359bc 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts @@ -1,5 +1,5 @@ import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../src/common/dom/fire_event"; import "../../../../src/components/ha-header-bar"; @@ -36,9 +36,9 @@ export class DialogHassioBackupUpload fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._dialogParams) { - return html``; + return nothing; } return html` diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup.ts b/hassio/src/dialogs/backup/dialog-hassio-backup.ts index c5c868cd26..389bf5dd46 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup.ts @@ -1,9 +1,11 @@ import { ActionDetail } from "@material/mwc-list"; import "@material/mwc-list/mwc-list-item"; import { mdiClose, mdiDotsVertical } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; +import { atLeastVersion } from "../../../../src/common/config/version"; import { fireEvent } from "../../../../src/common/dom/fire_event"; +import { stopPropagation } from "../../../../src/common/dom/stop_propagation"; import { slugify } from "../../../../src/common/string/slugify"; import "../../../../src/components/buttons/ha-progress-button"; import "../../../../src/components/ha-alert"; @@ -11,11 +13,11 @@ import "../../../../src/components/ha-button-menu"; import "../../../../src/components/ha-header-bar"; import "../../../../src/components/ha-icon-button"; import { getSignedPath } from "../../../../src/data/auth"; -import { extractApiErrorMessage } from "../../../../src/data/hassio/common"; import { fetchHassioBackupInfo, HassioBackupDetail, } from "../../../../src/data/hassio/backup"; +import { extractApiErrorMessage } from "../../../../src/data/hassio/common"; import { showAlertDialog, showConfirmationDialog, @@ -27,8 +29,6 @@ import { fileDownload } from "../../../../src/util/file_download"; import "../../components/supervisor-backup-content"; import type { SupervisorBackupContent } from "../../components/supervisor-backup-content"; import { HassioBackupDialogParams } from "./show-dialog-hassio-backup"; -import { atLeastVersion } from "../../../../src/common/config/version"; -import { stopPropagation } from "../../../../src/common/dom/stop_propagation"; @customElement("dialog-hassio-backup") class HassioBackupDialog @@ -62,9 +62,9 @@ class HassioBackupDialog fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._dialogParams || !this._backup) { - return html``; + return nothing; } return html` repo.slug) ); - protected render(): TemplateResult { + protected render() { if (!this._dialogParams?.supervisor || this._repositories === undefined) { - return html``; + return nothing; } const repositories = this._filteredRepositories(this._repositories); const usedRepositories = this._filteredUsedRepositories( diff --git a/hassio/src/hassio-my-redirect.ts b/hassio/src/hassio-my-redirect.ts index 526d6295e1..71bc873eb6 100644 --- a/hassio/src/hassio-my-redirect.ts +++ b/hassio/src/hassio-my-redirect.ts @@ -1,5 +1,5 @@ import { sanitizeUrl } from "@braintree/sanitize-url"; -import { html, LitElement, TemplateResult } from "lit"; +import { html, LitElement, TemplateResult, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { navigate } from "../../src/common/navigate"; import { @@ -101,13 +101,13 @@ class HassioMyRedirect extends LitElement { navigate(url, { replace: true }); } - protected render(): TemplateResult { + protected render() { if (this._error) { return html``; } - return html``; + return nothing; } private _createRedirectUrl(redirect: Redirect): string { diff --git a/hassio/src/update-available/update-available-card.ts b/hassio/src/update-available/update-available-card.ts index c8472ae93b..84b01d1fdd 100644 --- a/hassio/src/update-available/update-available-card.ts +++ b/hassio/src/update-available/update-available-card.ts @@ -5,7 +5,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; @@ -116,12 +116,12 @@ class UpdateAvailableCard extends LitElement { storeAddons.find((addon) => addon.slug === slug) ); - protected render(): TemplateResult { + protected render() { if ( !this._updateType || (this._updateType === "addon" && !this._addonInfo) ) { - return html``; + return nothing; } const changelog = changelogUrl(this._updateType, this._version_latest); diff --git a/src/auth/ha-auth-flow.ts b/src/auth/ha-auth-flow.ts index f151fea546..0577a0af7c 100644 --- a/src/auth/ha-auth-flow.ts +++ b/src/auth/ha-auth-flow.ts @@ -5,8 +5,8 @@ import { CSSResultGroup, html, LitElement, + nothing, PropertyValues, - TemplateResult, } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../components/ha-alert"; @@ -134,11 +134,11 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) { }, 500); } - private _renderForm(): TemplateResult { + private _renderForm() { switch (this._state) { case "step": if (this._step == null) { - return html``; + return nothing; } return html` ${this._renderStep(this._step)} @@ -176,11 +176,11 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) { `; default: - return html``; + return nothing; } } - private _renderStep(step: DataEntryFlowStep): TemplateResult { + private _renderStep(step: DataEntryFlowStep) { switch (step.type) { case "abort": return html` @@ -202,7 +202,7 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) { .content=${this._computeStepDescription(step)} > ` - : html``} + : nothing} ${this.hass.localize("ui.components.history_charts.history_disabled")} @@ -130,9 +130,9 @@ export class StateHistoryCharts extends LitElement { private _renderHistoryItem = ( item: TimelineEntity[] | LineChartUnit, index: number - ): TemplateResult => { + ) => { if (!item || index === undefined) { - return html``; + return nothing; } if (!Array.isArray(item)) { return html`
diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts index 34a0bc29d3..f837968d02 100644 --- a/src/components/data-table/ha-data-table.ts +++ b/src/components/data-table/ha-data-table.ts @@ -6,6 +6,7 @@ import { CSSResultGroup, html, LitElement, + nothing, PropertyValues, TemplateResult, } from "lit"; @@ -73,7 +74,7 @@ export interface DataTableColumnData extends DataTableSortColumnData { title: TemplateResult | string; label?: TemplateResult | string; type?: "numeric" | "icon" | "icon-button" | "overflow-menu"; - template?: (data: any, row: T) => TemplateResult | string; + template?: (data: any, row: T) => TemplateResult | string | typeof nothing; width?: string; maxWidth?: string; grows?: boolean; @@ -352,13 +353,10 @@ export class HaDataTable extends LitElement { `; } - private _renderRow = ( - row: DataTableRowData, - index: number - ): TemplateResult => { + private _renderRow = (row: DataTableRowData, index: number) => { // not sure how this happens... if (!row) { - return html``; + return nothing; } if (row.append) { return html`
${row.content}
`; diff --git a/src/components/device/ha-area-devices-picker.ts b/src/components/device/ha-area-devices-picker.ts index 3edee20f5a..9d2a1162c0 100644 --- a/src/components/device/ha-area-devices-picker.ts +++ b/src/components/device/ha-area-devices-picker.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; @@ -230,9 +230,9 @@ export class HaAreaDevicesPicker extends SubscribeMixin(LitElement) { } } - protected render(): TemplateResult { + protected render() { if (!this._devices || !this._areas || !this._entities) { - return html``; + return nothing; } const areas = this._getAreasWithDevices( this._devices, diff --git a/src/components/device/ha-device-automation-picker.ts b/src/components/device/ha-device-automation-picker.ts index d14833ca9e..a6a6632e1e 100644 --- a/src/components/device/ha-device-automation-picker.ts +++ b/src/components/device/ha-device-automation-picker.ts @@ -1,5 +1,5 @@ import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { @@ -85,9 +85,9 @@ export abstract class HaDeviceAutomationPicker< return `${this._automations[idx].device_id}_${idx}`; } - protected render(): TemplateResult { + protected render() { if (this._renderEmpty) { - return html``; + return nothing; } const value = this._value; return html` diff --git a/src/components/device/ha-devices-picker.ts b/src/components/device/ha-devices-picker.ts index 327af4c8ac..dd42865401 100644 --- a/src/components/device/ha-devices-picker.ts +++ b/src/components/device/ha-devices-picker.ts @@ -1,4 +1,4 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { PolymerChangedEvent } from "../../polymer-types"; @@ -49,9 +49,9 @@ class HaDevicesPicker extends LitElement { @property() public entityFilter?: HaDevicePickerEntityFilterFunc; - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const currentDevices = this._currentDevices; diff --git a/src/components/entity/ha-entities-picker.ts b/src/components/entity/ha-entities-picker.ts index e0a8b5ae41..e54074806b 100644 --- a/src/components/entity/ha-entities-picker.ts +++ b/src/components/entity/ha-entities-picker.ts @@ -1,5 +1,5 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; @@ -76,9 +76,9 @@ class HaEntitiesPickerLight extends LitElement { @property() public entityFilter?: HaEntityPickerEntityFilterFunc; - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const currentEntities = this._currentEntities; diff --git a/src/components/entity/ha-entity-attribute-picker.ts b/src/components/entity/ha-entity-attribute-picker.ts index 6fb98f55b9..1e4c790712 100644 --- a/src/components/entity/ha-entity-attribute-picker.ts +++ b/src/components/entity/ha-entity-attribute-picker.ts @@ -1,5 +1,5 @@ import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import { formatAttributeName } from "../../data/entity_attributes"; import { PolymerChangedEvent } from "../../polymer-types"; @@ -60,9 +60,9 @@ class HaEntityAttributePicker extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` diff --git a/src/components/entity/ha-entity-state-picker.ts b/src/components/entity/ha-entity-state-picker.ts index 3536baa665..2174ffb093 100644 --- a/src/components/entity/ha-entity-state-picker.ts +++ b/src/components/entity/ha-entity-state-picker.ts @@ -1,14 +1,14 @@ import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; +import { fireEvent } from "../../common/dom/fire_event"; import { computeStateDisplay } from "../../common/entity/compute_state_display"; -import { PolymerChangedEvent } from "../../polymer-types"; import { getStates } from "../../common/entity/get_states"; +import { formatAttributeValue } from "../../data/entity_attributes"; +import { PolymerChangedEvent } from "../../polymer-types"; import { HomeAssistant } from "../../types"; import "../ha-combo-box"; import type { HaComboBox } from "../ha-combo-box"; -import { formatAttributeValue } from "../../data/entity_attributes"; -import { fireEvent } from "../../common/dom/fire_event"; export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean; @@ -64,9 +64,9 @@ class HaEntityStatePicker extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` diff --git a/src/components/entity/ha-statistics-picker.ts b/src/components/entity/ha-statistics-picker.ts index 31266721c4..797cc1cf9f 100644 --- a/src/components/entity/ha-statistics-picker.ts +++ b/src/components/entity/ha-statistics-picker.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import type { PolymerChangedEvent } from "../../polymer-types"; @@ -56,9 +56,9 @@ class HaStatisticsPicker extends LitElement { }) public ignoreRestrictionsOnFirstStatistic = false; - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const ignoreRestriction = diff --git a/src/components/entity/state-badge.ts b/src/components/entity/state-badge.ts index b0e001e9c2..e855bfdd57 100644 --- a/src/components/entity/state-badge.ts +++ b/src/components/entity/state-badge.ts @@ -6,7 +6,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; @@ -45,7 +45,7 @@ export class StateBadge extends LitElement { return this.stateColor || (domain === "light" && this.stateColor !== false); } - protected render(): TemplateResult { + protected render() { const stateObj = this.stateObj; // We either need a `stateObj` or one override @@ -56,7 +56,7 @@ export class StateBadge extends LitElement { } if (!this._showIcon) { - return html``; + return nothing; } const domain = stateObj ? computeStateDomain(stateObj) : undefined; diff --git a/src/components/entity/state-info.ts b/src/components/entity/state-info.ts index 9db1bae9f7..7becc6c5b9 100644 --- a/src/components/entity/state-info.ts +++ b/src/components/entity/state-info.ts @@ -1,6 +1,6 @@ import "@polymer/paper-tooltip/paper-tooltip"; import type { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { computeStateName } from "../../common/entity/compute_state_name"; import { computeRTL } from "../../common/util/compute_rtl"; @@ -21,9 +21,9 @@ class StateInfo extends LitElement { @property() public color?: string; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } const name = computeStateName(this.stateObj); diff --git a/src/components/ha-addon-picker.ts b/src/components/ha-addon-picker.ts index 8c765d9755..86a6272e8e 100644 --- a/src/components/ha-addon-picker.ts +++ b/src/components/ha-addon-picker.ts @@ -1,5 +1,5 @@ -import { html, LitElement, TemplateResult } from "lit"; import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { isComponentLoaded } from "../common/config/is_component_loaded"; import { fireEvent } from "../common/dom/fire_event"; @@ -54,9 +54,9 @@ class HaAddonPicker extends LitElement { this._getAddons(); } - protected render(): TemplateResult { + protected render() { if (!this._addons) { - return html``; + return nothing; } return html` ` - : html``; + : nothing; } if (this.stateObj.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC) { return html``; } - return html``; + return nothing; } private get _shouldRenderMJPEG() { diff --git a/src/components/ha-card.ts b/src/components/ha-card.ts index b00fa0ae51..fc95aa118d 100644 --- a/src/components/ha-card.ts +++ b/src/components/ha-card.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-card") @@ -70,11 +70,11 @@ export class HaCard extends LitElement { `; } - protected render(): TemplateResult { + protected render() { return html` ${this.header ? html`

${this.header}

` - : html``} + : nothing} `; } diff --git a/src/components/ha-config-entry-picker.ts b/src/components/ha-config-entry-picker.ts index 09bfc45b4e..b4efd43637 100644 --- a/src/components/ha-config-entry-picker.ts +++ b/src/components/ha-config-entry-picker.ts @@ -1,16 +1,16 @@ import "@material/mwc-list/mwc-list-item"; -import { html, LitElement, TemplateResult } from "lit"; import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; -import { PolymerChangedEvent } from "../polymer-types"; -import { HomeAssistant } from "../types"; -import type { HaComboBox } from "./ha-combo-box"; +import { caseInsensitiveStringCompare } from "../common/string/compare"; import { ConfigEntry, getConfigEntries } from "../data/config_entries"; import { domainToName } from "../data/integration"; -import { caseInsensitiveStringCompare } from "../common/string/compare"; +import { PolymerChangedEvent } from "../polymer-types"; +import { HomeAssistant } from "../types"; import { brandsUrl } from "../util/brands-url"; import "./ha-combo-box"; +import type { HaComboBox } from "./ha-combo-box"; export interface ConfigEntryExtended extends ConfigEntry { localized_domain_name?: string; @@ -72,9 +72,9 @@ class HaConfigEntryPicker extends LitElement { /> `; - protected render(): TemplateResult { + protected render() { if (!this._configEntries) { - return html``; + return nothing; } return html` `; diff --git a/src/components/ha-markdown.ts b/src/components/ha-markdown.ts index 4183fba672..795349d256 100644 --- a/src/components/ha-markdown.ts +++ b/src/components/ha-markdown.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "./ha-markdown-element"; @@ -15,9 +15,9 @@ export class HaMarkdown extends LitElement { @property({ type: Boolean }) public breaks = false; - protected render(): TemplateResult { + protected render() { if (!this.content) { - return html``; + return nothing; } return html` @@ -388,7 +389,7 @@ export class HaMediaPlayerBrowse extends LitElement { : ""}
` - : html``} + : nothing}
[entityId]); - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/more-info/controls/more-info-remote.ts b/src/dialogs/more-info/controls/more-info-remote.ts index dbdc2fd0c9..5198453308 100644 --- a/src/dialogs/more-info/controls/more-info-remote.ts +++ b/src/dialogs/more-info/controls/more-info-remote.ts @@ -1,12 +1,12 @@ -import { html, LitElement, TemplateResult } from "lit"; +import "@material/mwc-list/mwc-list"; +import "@material/mwc-list/mwc-list-item"; +import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; +import { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-attributes"; import { RemoteEntity, REMOTE_SUPPORT_ACTIVITY } from "../../../data/remote"; import { HomeAssistant } from "../../../types"; -import "@material/mwc-list/mwc-list-item"; -import "@material/mwc-list/mwc-list"; -import { stopPropagation } from "../../../common/dom/stop_propagation"; const filterExtraAttributes = "activity_list,current_activity"; @@ -16,9 +16,9 @@ class MoreInfoRemote extends LitElement { @property() public stateObj?: RemoteEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } const stateObj = this.stateObj; diff --git a/src/dialogs/more-info/controls/more-info-script.ts b/src/dialogs/more-info/controls/more-info-script.ts index 2f42f1b6e7..1d9ed6fb0c 100644 --- a/src/dialogs/more-info/controls/more-info-script.ts +++ b/src/dialogs/more-info/controls/more-info-script.ts @@ -1,5 +1,5 @@ import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-relative-time"; import { HomeAssistant } from "../../../types"; @@ -10,9 +10,9 @@ class MoreInfoScript extends LitElement { @property() public stateObj?: HassEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/more-info/controls/more-info-sun.ts b/src/dialogs/more-info/controls/more-info-sun.ts index 728dcfcf72..537fb95f78 100644 --- a/src/dialogs/more-info/controls/more-info-sun.ts +++ b/src/dialogs/more-info/controls/more-info-sun.ts @@ -1,5 +1,5 @@ import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { formatTime } from "../../../common/datetime/format_time"; import { formatNumber } from "../../../common/number/format_number"; @@ -12,9 +12,9 @@ class MoreInfoSun extends LitElement { @property() public stateObj?: HassEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } const risingDate = new Date(this.stateObj.attributes.next_rising); diff --git a/src/dialogs/more-info/controls/more-info-timer.ts b/src/dialogs/more-info/controls/more-info-timer.ts index 63be3032f9..cba66d5ed7 100644 --- a/src/dialogs/more-info/controls/more-info-timer.ts +++ b/src/dialogs/more-info/controls/more-info-timer.ts @@ -1,5 +1,5 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-attributes"; import { TimerEntity } from "../../../data/timer"; @@ -11,9 +11,9 @@ class MoreInfoTimer extends LitElement { @property() public stateObj?: TimerEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/more-info/controls/more-info-update.ts b/src/dialogs/more-info/controls/more-info-update.ts index de73cc1f3c..195fe6f7d5 100644 --- a/src/dialogs/more-info/controls/more-info-update.ts +++ b/src/dialogs/more-info/controls/more-info-update.ts @@ -1,12 +1,13 @@ -import "../../../components/ha-alert"; -import "../../../components/ha-faded"; import "@material/mwc-button/mwc-button"; import "@material/mwc-linear-progress/mwc-linear-progress"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import { BINARY_STATE_OFF } from "../../../common/const"; import { supportsFeature } from "../../../common/entity/supports-feature"; +import "../../../components/ha-alert"; import "../../../components/ha-checkbox"; import "../../../components/ha-circular-progress"; +import "../../../components/ha-faded"; import "../../../components/ha-formfield"; import "../../../components/ha-markdown"; import { isUnavailableState } from "../../../data/entity"; @@ -21,7 +22,6 @@ import { UPDATE_SUPPORT_SPECIFIC_VERSION, } from "../../../data/update"; import type { HomeAssistant } from "../../../types"; -import { BINARY_STATE_OFF } from "../../../common/const"; @customElement("more-info-update") class MoreInfoUpdate extends LitElement { @@ -33,13 +33,13 @@ class MoreInfoUpdate extends LitElement { @state() private _error?: string; - protected render(): TemplateResult { + protected render() { if ( !this.hass || !this.stateObj || isUnavailableState(this.stateObj.state) ) { - return html``; + return nothing; } const skippedVersion = diff --git a/src/dialogs/more-info/controls/more-info-vacuum.ts b/src/dialogs/more-info/controls/more-info-vacuum.ts index 5a183712d6..c734e0160c 100644 --- a/src/dialogs/more-info/controls/more-info-vacuum.ts +++ b/src/dialogs/more-info/controls/more-info-vacuum.ts @@ -9,7 +9,7 @@ import { mdiStop, mdiTargetVariant, } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; @@ -90,9 +90,9 @@ class MoreInfoVacuum extends LitElement { @property() public stateObj?: VacuumEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } const stateObj = this.stateObj; diff --git a/src/dialogs/more-info/controls/more-info-weather.ts b/src/dialogs/more-info/controls/more-info-weather.ts index 01a091b146..0b4a80ad93 100644 --- a/src/dialogs/more-info/controls/more-info-weather.ts +++ b/src/dialogs/more-info/controls/more-info-weather.ts @@ -11,7 +11,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property } from "lit/decorators"; import { formatDateWeekdayDay } from "../../../common/datetime/format_date"; @@ -50,9 +50,9 @@ class MoreInfoWeather extends LitElement { return false; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } const hourly = isForecastHourly(this.stateObj.attributes.forecast); diff --git a/src/dialogs/more-info/ha-more-info-history.ts b/src/dialogs/more-info/ha-more-info-history.ts index 0611b0559a..a347ac59df 100644 --- a/src/dialogs/more-info/ha-more-info-history.ts +++ b/src/dialogs/more-info/ha-more-info-history.ts @@ -1,24 +1,24 @@ import { startOfYesterday, subHours } from "date-fns/esm"; -import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { fireEvent } from "../../common/dom/fire_event"; +import { computeDomain } from "../../common/entity/compute_domain"; import "../../components/chart/state-history-charts"; +import "../../components/chart/statistics-chart"; import { + computeHistory, HistoryResult, subscribeHistoryStatesTimeWindow, - computeHistory, } from "../../data/history"; import { fetchStatistics, getStatisticMetadata, Statistics, - StatisticsTypes, StatisticsMetaData, + StatisticsTypes, } from "../../data/recorder"; import { HomeAssistant } from "../../types"; -import "../../components/chart/statistics-chart"; -import { computeDomain } from "../../common/entity/compute_domain"; declare global { interface HASSDomEvents { @@ -50,9 +50,9 @@ export class MoreInfoHistory extends LitElement { private _metadata?: Record; - protected render(): TemplateResult { + protected render() { if (!this.entityId) { - return html``; + return nothing; } return html` ${isComponentLoaded(this.hass, "history") diff --git a/src/dialogs/more-info/ha-more-info-logbook.ts b/src/dialogs/more-info/ha-more-info-logbook.ts index 0698489112..f7a3ea990a 100644 --- a/src/dialogs/more-info/ha-more-info-logbook.ts +++ b/src/dialogs/more-info/ha-more-info-logbook.ts @@ -1,5 +1,5 @@ import { startOfYesterday } from "date-fns/esm"; -import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; @@ -19,14 +19,14 @@ export class MoreInfoLogbook extends LitElement { private _entityIdAsList = memoizeOne((entityId: string) => [entityId]); - protected render(): TemplateResult { + protected render() { if (!isComponentLoaded(this.hass, "logbook") || !this.entityId) { - return html``; + return nothing; } const stateObj = this.hass.states[this.entityId]; if (!stateObj) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/more-info/ha-more-info-settings.ts b/src/dialogs/more-info/ha-more-info-settings.ts index 54dbffcb4c..6cc09a47fa 100644 --- a/src/dialogs/more-info/ha-more-info-settings.ts +++ b/src/dialogs/more-info/ha-more-info-settings.ts @@ -1,6 +1,13 @@ import "@material/mwc-tab"; import "@material/mwc-tab-bar"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + PropertyValues, + nothing, +} from "lit"; import { customElement, property, state } from "lit/decorators"; import { dynamicElement } from "../../common/dom/dynamic-element-directive"; import { @@ -25,7 +32,7 @@ export class HaMoreInfoSettings extends LitElement { protected render() { // loading. if (this.entry === undefined) { - return html``; + return nothing; } // No unique ID @@ -49,7 +56,7 @@ export class HaMoreInfoSettings extends LitElement { } if (!this._settingsElementTag) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/notifications/configurator-notification-item.ts b/src/dialogs/notifications/configurator-notification-item.ts index 2ec0c037c7..47c7be0750 100644 --- a/src/dialogs/notifications/configurator-notification-item.ts +++ b/src/dialogs/notifications/configurator-notification-item.ts @@ -1,5 +1,5 @@ import "@material/mwc-button"; -import { html, LitElement, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { computeStateDisplay } from "../../common/entity/compute_state_display"; @@ -14,9 +14,9 @@ export class HuiConfiguratorNotificationItem extends LitElement { @property() public notification?: PersitentNotificationEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.notification) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/notifications/notification-item.ts b/src/dialogs/notifications/notification-item.ts index ad767eab15..908e192514 100644 --- a/src/dialogs/notifications/notification-item.ts +++ b/src/dialogs/notifications/notification-item.ts @@ -1,5 +1,5 @@ import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { PersistentNotification } from "../../data/persistent_notification"; import { HomeAssistant } from "../../types"; @@ -20,9 +20,9 @@ export class HuiNotificationItem extends LitElement { return false; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.notification) { - return html``; + return nothing; } return "entity_id" in this.notification diff --git a/src/dialogs/notifications/persistent-notification-item.ts b/src/dialogs/notifications/persistent-notification-item.ts index 1bd0c408d8..fca3a395da 100644 --- a/src/dialogs/notifications/persistent-notification-item.ts +++ b/src/dialogs/notifications/persistent-notification-item.ts @@ -1,6 +1,6 @@ import "@material/mwc-button"; import "@polymer/paper-tooltip/paper-tooltip"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { formatDateTime } from "../../common/datetime/format_date_time"; import "../../components/ha-markdown"; @@ -15,9 +15,9 @@ export class HuiPersistentNotificationItem extends LitElement { @property() public notification?: PersistentNotification; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.notification) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/quick-bar/ha-quick-bar.ts b/src/dialogs/quick-bar/ha-quick-bar.ts index 2b86ca4351..9923b134c1 100644 --- a/src/dialogs/quick-bar/ha-quick-bar.ts +++ b/src/dialogs/quick-bar/ha-quick-bar.ts @@ -9,7 +9,7 @@ import { mdiReload, mdiServerNetwork, } from "@mdi/js"; -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; @@ -32,8 +32,8 @@ import "../../components/ha-chip"; import "../../components/ha-circular-progress"; import "../../components/ha-header-bar"; import "../../components/ha-icon-button"; -import "../../components/ha-textfield"; import "../../components/ha-list-item"; +import "../../components/ha-textfield"; import { fetchHassioAddonsInfo } from "../../data/hassio/addon"; import { domainToName } from "../../data/integration"; import { getPanelNameTranslationKey } from "../../data/panel"; @@ -136,7 +136,7 @@ export class QuickBar extends LitElement { protected render() { if (!this._open) { - return html``; + return nothing; } const items: QuickBarItem[] | undefined = this._getItems( @@ -273,9 +273,9 @@ export class QuickBar extends LitElement { } } - private _renderItem = (item: QuickBarItem, index: number): TemplateResult => { + private _renderItem = (item: QuickBarItem, index: number) => { if (!item) { - return html``; + return nothing; } return isCommandItem(item) ? this._renderCommandItem(item, index) diff --git a/src/dialogs/restart/dialog-restart.ts b/src/dialogs/restart/dialog-restart.ts index cc712f4839..506b961823 100644 --- a/src/dialogs/restart/dialog-restart.ts +++ b/src/dialogs/restart/dialog-restart.ts @@ -1,6 +1,6 @@ import "@material/mwc-list/mwc-list"; import { mdiAutoFix, mdiPower, mdiPowerCycle, mdiRefresh } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { fireEvent } from "../../common/dom/fire_event"; @@ -74,9 +74,9 @@ class DialogRestart extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._open) { - return html``; + return nothing; } const showReload = this.hass.userData?.showAdvanced; diff --git a/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts b/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts index dc0cfd1e8b..b32d0d40e5 100644 --- a/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts +++ b/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts @@ -12,7 +12,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -86,9 +86,9 @@ export class HaVoiceCommandDialog extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } return html` `; } - return html``; + return nothing; } protected firstUpdated(changedProps: PropertyValues) { diff --git a/src/onboarding/onboarding-integrations.ts b/src/onboarding/onboarding-integrations.ts index e35cdf15e2..519499721c 100644 --- a/src/onboarding/onboarding-integrations.ts +++ b/src/onboarding/onboarding-integrations.ts @@ -1,4 +1,5 @@ import "@material/mwc-button/mwc-button"; +import { mdiCheck, mdiDotsHorizontal } from "@mdi/js"; import { css, CSSResultGroup, @@ -6,12 +7,12 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { mdiCheck, mdiDotsHorizontal } from "@mdi/js"; +import { isComponentLoaded } from "../common/config/is_component_loaded"; import { fireEvent } from "../common/dom/fire_event"; import { stringCompare } from "../common/string/compare"; -import { isComponentLoaded } from "../common/config/is_component_loaded"; import { LocalizeFunc } from "../common/translations/localize"; import { ConfigEntry, getConfigEntries } from "../data/config_entries"; import { @@ -74,9 +75,9 @@ class OnboardingIntegrations extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._entries || !this._discovered) { - return html``; + return nothing; } // Render discovered and existing entries together sorted by localized title. const entries: Array<[string, TemplateResult]> = this._entries.map( diff --git a/src/panels/calendar/confirm-event-dialog-box.ts b/src/panels/calendar/confirm-event-dialog-box.ts index 77819ee774..389c753d73 100644 --- a/src/panels/calendar/confirm-event-dialog-box.ts +++ b/src/panels/calendar/confirm-event-dialog-box.ts @@ -1,13 +1,13 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-dialog"; import "../../components/ha-svg-icon"; import "../../components/ha-switch"; +import { RecurrenceRange } from "../../data/calendar"; import { HomeAssistant } from "../../types"; import { ConfirmEventDialogBoxParams } from "./show-confirm-event-dialog-box"; -import { RecurrenceRange } from "../../data/calendar"; @customElement("confirm-event-dialog-box") class ConfirmEventDialogBox extends LitElement { @@ -23,9 +23,9 @@ class ConfirmEventDialogBox extends LitElement { return true; } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` diff --git a/src/panels/calendar/dialog-calendar-event-detail.ts b/src/panels/calendar/dialog-calendar-event-detail.ts index 8bc8f81512..aba011143a 100644 --- a/src/panels/calendar/dialog-calendar-event-detail.ts +++ b/src/panels/calendar/dialog-calendar-event-detail.ts @@ -1,8 +1,8 @@ import "@material/mwc-button"; import { mdiCalendarClock, mdiClose } from "@mdi/js"; -import { addDays, isSameDay } from "date-fns/esm"; import { toDate } from "date-fns-tz"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { addDays, isSameDay } from "date-fns/esm"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { formatDate } from "../../common/datetime/format_date"; import { formatDateTime } from "../../common/datetime/format_date_time"; @@ -19,10 +19,10 @@ import { import { haStyleDialog } from "../../resources/styles"; import { HomeAssistant } from "../../types"; import "../lovelace/components/hui-generic-entity-row"; +import { renderRRuleAsText } from "./recurrence"; import { showConfirmEventDialog } from "./show-confirm-event-dialog-box"; import { CalendarEventDetailDialogParams } from "./show-dialog-calendar-event-detail"; import { showCalendarEventEditDialog } from "./show-dialog-calendar-event-editor"; -import { renderRRuleAsText } from "./recurrence"; class DialogCalendarEventDetail extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; @@ -54,9 +54,9 @@ class DialogCalendarEventDetail extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } const stateObj = this.hass.states[this._calendarId!]; return html` @@ -90,7 +90,7 @@ class DialogCalendarEventDetail extends LitElement { ? html`
${this._data.description}

` - : html``} + : nothing}
diff --git a/src/panels/calendar/dialog-calendar-event-editor.ts b/src/panels/calendar/dialog-calendar-event-editor.ts index 64a7aa3321..35660d67ae 100644 --- a/src/panels/calendar/dialog-calendar-event-editor.ts +++ b/src/panels/calendar/dialog-calendar-event-editor.ts @@ -1,5 +1,6 @@ import "@material/mwc-button"; import { mdiClose } from "@mdi/js"; +import { formatInTimeZone, toDate } from "date-fns-tz"; import { addDays, addHours, @@ -7,9 +8,8 @@ import { differenceInMilliseconds, startOfHour, } from "date-fns/esm"; -import { formatInTimeZone, toDate } from "date-fns-tz"; import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; @@ -25,8 +25,8 @@ import { CalendarEventMutableParams, createCalendarEvent, deleteCalendarEvent, - updateCalendarEvent, RecurrenceRange, + updateCalendarEvent, } from "../../data/calendar"; import { haStyleDialog } from "../../resources/styles"; import { HomeAssistant } from "../../types"; @@ -123,9 +123,9 @@ class DialogCalendarEventEditor extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } const isCreate = this._params.entry === undefined; diff --git a/src/panels/calendar/ha-full-calendar.ts b/src/panels/calendar/ha-full-calendar.ts index 56ff0fd8d7..447d2211f8 100644 --- a/src/panels/calendar/ha-full-calendar.ts +++ b/src/panels/calendar/ha-full-calendar.ts @@ -18,7 +18,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoize from "memoize-one"; @@ -104,7 +104,7 @@ export class HAFullCalendar extends LitElement { this.calendar?.updateSize(); } - protected render(): TemplateResult { + protected render() { const viewToggleButtons = this._viewToggleButtons( this.views, this.hass.localize @@ -203,7 +203,7 @@ export class HAFullCalendar extends LitElement { > ` - : html``} + : nothing} `; } diff --git a/src/panels/calendar/ha-recurrence-rule-editor.ts b/src/panels/calendar/ha-recurrence-rule-editor.ts index b7b3c03f5e..987b58ab2e 100644 --- a/src/panels/calendar/ha-recurrence-rule-editor.ts +++ b/src/panels/calendar/ha-recurrence-rule-editor.ts @@ -1,6 +1,6 @@ import type { SelectedDetail } from "@material/mwc-list"; import { formatInTimeZone, toDate } from "date-fns-tz"; -import { css, html, LitElement, PropertyValues } from "lit"; +import { css, html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import type { Options, WeekdayStr } from "rrule"; @@ -9,6 +9,7 @@ import { firstWeekdayIndex } from "../../common/datetime/first_weekday"; import { stopPropagation } from "../../common/dom/stop_propagation"; import { LocalizeKeys } from "../../common/translations/localize"; import "../../components/ha-chip"; +import "../../components/ha-date-input"; import "../../components/ha-list-item"; import "../../components/ha-select"; import type { HaSelect } from "../../components/ha-select"; @@ -18,18 +19,17 @@ import { convertFrequency, convertRepeatFrequency, DEFAULT_COUNT, + getMonthdayRepeatFromRule, + getMonthlyRepeatItems, + getMonthlyRepeatWeekdayFromRule, getWeekday, getWeekdays, - getMonthlyRepeatItems, + MonthlyRepeatItem, RepeatEnd, RepeatFrequency, ruleByWeekDay, untilValue, - MonthlyRepeatItem, - getMonthlyRepeatWeekdayFromRule, - getMonthdayRepeatFromRule, } from "./recurrence"; -import "../../components/ha-date-input"; @customElement("ha-recurrence-rule-editor") export class RecurrenceRuleEditor extends LitElement { @@ -233,7 +233,7 @@ export class RecurrenceRuleEditor extends LitElement { ` )} ` - : html``} + : nothing} `; } @@ -321,7 +321,7 @@ export class RecurrenceRuleEditor extends LitElement { @change=${this._onCountChange} > ` - : html``} + : nothing} ${this._end === "on" ? html` ` - : html``} + : nothing} `; } render() { return html` ${this.renderRepeat()} - ${this._freq === "monthly" ? this.renderMonthly() : html``} - ${this._freq === "weekly" ? this.renderWeekly() : html``} - ${this._freq === "daily" ? this.renderDaily() : html``} - ${this._freq !== "none" ? this.renderEnd() : html``} + ${this._freq === "monthly" ? this.renderMonthly() : nothing} + ${this._freq === "weekly" ? this.renderWeekly() : nothing} + ${this._freq === "daily" ? this.renderDaily() : nothing} + ${this._freq !== "none" ? this.renderEnd() : nothing} `; } diff --git a/src/panels/config/application_credentials/dialog-add-application-credential.ts b/src/panels/config/application_credentials/dialog-add-application-credential.ts index f6d017a9ee..8c1283ec8f 100644 --- a/src/panels/config/application_credentials/dialog-add-application-credential.ts +++ b/src/panels/config/application_credentials/dialog-add-application-credential.ts @@ -2,7 +2,7 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list-item"; import { mdiOpenInNew } from "@mdi/js"; import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-alert"; @@ -84,9 +84,9 @@ export class DialogAddApplicationCredential extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._params || !this._domains) { - return html``; + return nothing; } const selectedDomainName = this._params.selectedDomain ? domainToName(this.hass.localize, this._domain!) diff --git a/src/panels/config/application_credentials/ha-config-application-credentials.ts b/src/panels/config/application_credentials/ha-config-application-credentials.ts index bacd283923..da139623ee 100644 --- a/src/panels/config/application_credentials/ha-config-application-credentials.ts +++ b/src/panels/config/application_credentials/ha-config-application-credentials.ts @@ -1,5 +1,12 @@ import { mdiDelete, mdiPlus } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + PropertyValues, + nothing, +} from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -147,7 +154,7 @@ export class HaConfigApplicationCredentials extends LitElement { ` - : html``} + : nothing} ` - : html``} + : nothing} = { name: string; @@ -164,9 +164,9 @@ class HaConfigAreaPage extends SubscribeMixin(LitElement) { ]; } - protected render(): TemplateResult { + protected render() { if (!this._areas || !this._devices || !this._entities) { - return html``; + return nothing; } const area = this._area(this.areaId, this._areas); diff --git a/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts b/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts index a8e1ce3aab..54175de108 100644 --- a/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts +++ b/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts @@ -1,22 +1,22 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import "@material/mwc-list/mwc-list-item"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; +import { stopPropagation } from "../../../../common/dom/stop_propagation"; import { createCloseHeading } from "../../../../components/ha-dialog"; -import "../../../../components/ha-textfield"; import "../../../../components/ha-select"; -import { HassDialog } from "../../../../dialogs/make-dialog-manager"; -import { haStyle, haStyleDialog } from "../../../../resources/styles"; -import type { HomeAssistant } from "../../../../types"; -import type { AutomationModeDialog } from "./show-dialog-automation-mode"; +import "../../../../components/ha-textfield"; import { AUTOMATION_DEFAULT_MAX, AUTOMATION_DEFAULT_MODE, } from "../../../../data/automation"; -import { documentationUrl } from "../../../../util/documentation-url"; import { isMaxMode, MODES } from "../../../../data/script"; -import "@material/mwc-list/mwc-list-item"; -import { stopPropagation } from "../../../../common/dom/stop_propagation"; +import { HassDialog } from "../../../../dialogs/make-dialog-manager"; +import { haStyle, haStyleDialog } from "../../../../resources/styles"; +import type { HomeAssistant } from "../../../../types"; +import { documentationUrl } from "../../../../util/documentation-url"; +import type { AutomationModeDialog } from "./show-dialog-automation-mode"; @customElement("ha-dialog-automation-mode") class DialogAutomationMode extends LitElement implements HassDialog { @@ -48,9 +48,9 @@ class DialogAutomationMode extends LitElement implements HassDialog { this._opened = false; } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } return html` @@ -107,7 +107,7 @@ class DialogAutomationMode extends LitElement implements HassDialog { > ` - : html``} + : nothing} ${this.hass.localize("ui.dialogs.generic.cancel")} diff --git a/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts b/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts index 8dcf1e4219..f39223cfad 100644 --- a/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts +++ b/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts @@ -1,15 +1,15 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; +import "../../../../components/ha-alert"; import { createCloseHeading } from "../../../../components/ha-dialog"; +import "../../../../components/ha-textarea"; +import "../../../../components/ha-textfield"; import { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; import type { HomeAssistant } from "../../../../types"; import type { AutomationRenameDialog } from "./show-dialog-automation-rename"; -import "../../../../components/ha-textarea"; -import "../../../../components/ha-alert"; -import "../../../../components/ha-textfield"; @customElement("ha-dialog-automation-rename") class DialogAutomationRename extends LitElement implements HassDialog { @@ -43,9 +43,9 @@ class DialogAutomationRename extends LitElement implements HassDialog { this._opened = false; } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/automation/condition/ha-automation-condition.ts b/src/panels/config/automation/condition/ha-automation-condition.ts index d936b7a4f3..942fe074ae 100644 --- a/src/panels/config/automation/condition/ha-automation-condition.ts +++ b/src/panels/config/automation/condition/ha-automation-condition.ts @@ -2,7 +2,14 @@ import "@material/mwc-button"; import type { ActionDetail } from "@material/mwc-list"; import { mdiArrowDown, mdiArrowUp, mdiDrag, mdiPlus } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + PropertyValues, + nothing, +} from "lit"; import { customElement, property } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import memoizeOne from "memoize-one"; @@ -22,6 +29,7 @@ import { stringCompare } from "../../../../common/string/compare"; import type { LocalizeFunc } from "../../../../common/translations/localize"; import type { HaSelect } from "../../../../components/ha-select"; import { CONDITION_TYPES } from "../../../../data/condition"; +import { sortableStyles } from "../../../../resources/ha-sortable-style"; import { loadSortable, SortableInstance, @@ -35,7 +43,6 @@ import "./types/ha-automation-condition-template"; import "./types/ha-automation-condition-time"; import "./types/ha-automation-condition-trigger"; import "./types/ha-automation-condition-zone"; -import { sortableStyles } from "../../../../resources/ha-sortable-style"; @customElement("ha-automation-condition") export default class HaAutomationCondition extends LitElement { @@ -102,7 +109,7 @@ export default class HaAutomationCondition extends LitElement { protected render() { if (!Array.isArray(this.conditions)) { - return html``; + return nothing; } return html` ${this.reOrderMode && !this.nested diff --git a/src/panels/config/automation/dialog-new-automation.ts b/src/panels/config/automation/dialog-new-automation.ts index c91ad599f9..cc9183a3c8 100644 --- a/src/panels/config/automation/dialog-new-automation.ts +++ b/src/panels/config/automation/dialog-new-automation.ts @@ -7,7 +7,7 @@ import { mdiPencilOutline, mdiWeb, } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -78,9 +78,9 @@ class DialogNewAutomation extends LitElement implements HassDialog { ); }); - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } const processedBlueprints = this._processedBlueprints(this.blueprints); diff --git a/src/panels/config/automation/thingtalk/dialog-thingtalk.ts b/src/panels/config/automation/thingtalk/dialog-thingtalk.ts index 8eae2ce4b6..7b06413e2c 100644 --- a/src/panels/config/automation/thingtalk/dialog-thingtalk.ts +++ b/src/panels/config/automation/thingtalk/dialog-thingtalk.ts @@ -1,5 +1,5 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-circular-progress"; @@ -70,9 +70,9 @@ class DialogThingtalk extends LitElement { this.closeDialog(); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } if (this._placeholders) { return html` diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-tag.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-tag.ts index e9c13c24fb..be5a8c7fee 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-tag.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-tag.ts @@ -1,5 +1,5 @@ import "@material/mwc-list/mwc-list-item"; -import { css, html, LitElement, PropertyValues } from "lit"; +import { css, html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { caseInsensitiveStringCompare } from "../../../../../common/string/compare"; @@ -30,7 +30,7 @@ export class HaTagTrigger extends LitElement implements TriggerElement { protected render() { if (!this._tags) { - return html``; + return nothing; } return html` entity.entity_id === entityId) ); - protected render(): TemplateResult { + protected render() { if (!this.updateEntities?.length) { - return html``; + return nothing; } const updates = this.updateEntities; diff --git a/src/panels/config/devices/device-detail/ha-device-automation-card.ts b/src/panels/config/devices/device-detail/ha-device-automation-card.ts index dc22f8a1dc..b1b1c6c697 100644 --- a/src/panels/config/devices/device-detail/ha-device-automation-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-automation-card.ts @@ -1,4 +1,4 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-chip"; @@ -58,9 +58,9 @@ export abstract class HaDeviceAutomationCard< return false; } - protected render(): TemplateResult { + protected render() { if (this.automations.length === 0) { - return html``; + return nothing; } const automations = this._showSecondary ? this.automations diff --git a/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts b/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts index de0c862a0c..c116ef0ddd 100644 --- a/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts +++ b/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts @@ -1,5 +1,5 @@ import "@material/mwc-button/mwc-button"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-dialog"; @@ -77,9 +77,9 @@ export class DialogDeviceAutomation extends LitElement { }); } - protected render(): TemplateResult | void { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts b/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts index b437c42938..fd75189514 100644 --- a/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts @@ -1,5 +1,5 @@ import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { caseInsensitiveStringCompare } from "../../../../common/string/compare"; @@ -37,11 +37,11 @@ export class HaDeviceViaDevicesCard extends LitElement { ) ); - protected render(): TemplateResult { + protected render() { const viaDevices = this._viaDevices(this.deviceId, this.hass.devices); if (viaDevices.length === 0) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts index 93c3d6a5a9..933ed8769c 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts @@ -1,5 +1,12 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + TemplateResult, + nothing, +} from "lit"; import { customElement, state } from "lit/decorators"; import { computeStateName } from "../../../../../../common/entity/compute_state_name"; import { computeRTLDirection } from "../../../../../../common/util/compute_rtl"; @@ -39,9 +46,9 @@ class DialogMQTTDeviceDebugInfo extends LitElement { }); } - protected render(): TemplateResult { + protected render() { if (!this._params || !this._debugInfo) { - return html``; + return nothing; } const dir = computeRTLDirection(this.hass!); diff --git a/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts b/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts index 3f1f0fad16..227cfbd043 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/ha-expansion-panel"; @@ -37,9 +37,9 @@ export class HaDeviceActionsZha extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._zhaDevice) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts index 69cd2b88ec..4beb7f949d 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts @@ -1,14 +1,14 @@ +import { UnsubscribeFunc } from "home-assistant-js-websocket"; import { css, CSSResultGroup, html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/ha-expansion-panel"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; import { ConfigEntry, getConfigEntries, @@ -21,9 +21,9 @@ import { subscribeZwaveNodeStatus, ZWaveJSNodeStatus, } from "../../../../../../data/zwave_js"; +import { SubscribeMixin } from "../../../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../../../resources/styles"; import { HomeAssistant } from "../../../../../../types"; -import { SubscribeMixin } from "../../../../../../mixins/subscribe-mixin"; @customElement("ha-device-info-zwave_js") export class HaDeviceInfoZWaveJS extends SubscribeMixin(LitElement) { @@ -83,9 +83,9 @@ export class HaDeviceInfoZWaveJS extends SubscribeMixin(LitElement) { this._node = await fetchZwaveNodeStatus(this.hass, this.device.id); } - protected render(): TemplateResult { + protected render() { if (!this._node) { - return html``; + return nothing; } return html` `; } @@ -687,7 +687,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) { ` - : html``} + : nothing} `; } diff --git a/src/panels/config/hardware/dialog-hardware-available.ts b/src/panels/config/hardware/dialog-hardware-available.ts index d99a15c723..d60d801b19 100644 --- a/src/panels/config/hardware/dialog-hardware-available.ts +++ b/src/panels/config/hardware/dialog-hardware-available.ts @@ -1,5 +1,5 @@ import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -67,9 +67,9 @@ class DialogHardwareAvailable extends LitElement implements HassDialog { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._hardware) { - return html``; + return nothing; } const devices = _filterDevices( diff --git a/src/panels/config/helpers/dialog-helper-detail.ts b/src/panels/config/helpers/dialog-helper-detail.ts index 1cab181d17..9d60baf078 100644 --- a/src/panels/config/helpers/dialog-helper-detail.ts +++ b/src/panels/config/helpers/dialog-helper-detail.ts @@ -2,7 +2,14 @@ import "@material/mwc-button/mwc-button"; import { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item-base"; import "@polymer/paper-item/paper-icon-item"; import "@polymer/paper-tooltip/paper-tooltip"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + TemplateResult, + nothing, +} from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @@ -103,9 +110,9 @@ export class DialogHelperDetail extends LitElement { this._params = undefined; } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } let content: TemplateResult; diff --git a/src/panels/config/helpers/forms/ha-counter-form.ts b/src/panels/config/helpers/forms/ha-counter-form.ts index dfd594cf0b..58af320e52 100644 --- a/src/panels/config/helpers/forms/ha-counter-form.ts +++ b/src/panels/config/helpers/forms/ha-counter-form.ts @@ -1,10 +1,10 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; import "../../../../components/ha-switch"; -import "../../../../components/ha-textfield"; import type { HaSwitch } from "../../../../components/ha-switch"; +import "../../../../components/ha-textfield"; import { Counter } from "../../../../data/counter"; import { haStyle } from "../../../../resources/styles"; import { HomeAssistant } from "../../../../types"; @@ -60,9 +60,9 @@ class HaCounterForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_boolean-form.ts b/src/panels/config/helpers/forms/ha-input_boolean-form.ts index 991ee256a3..945954ca0e 100644 --- a/src/panels/config/helpers/forms/ha-input_boolean-form.ts +++ b/src/panels/config/helpers/forms/ha-input_boolean-form.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; @@ -38,9 +38,9 @@ class HaInputBooleanForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_button-form.ts b/src/panels/config/helpers/forms/ha-input_button-form.ts index c1e9302071..3c78370228 100644 --- a/src/panels/config/helpers/forms/ha-input_button-form.ts +++ b/src/panels/config/helpers/forms/ha-input_button-form.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; @@ -38,9 +38,9 @@ class HaInputButtonForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_datetime-form.ts b/src/panels/config/helpers/forms/ha-input_datetime-form.ts index c63f794a95..e427d9405d 100644 --- a/src/panels/config/helpers/forms/ha-input_datetime-form.ts +++ b/src/panels/config/helpers/forms/ha-input_datetime-form.ts @@ -1,11 +1,11 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-formfield"; import "../../../../components/ha-icon-picker"; import "../../../../components/ha-radio"; -import "../../../../components/ha-textfield"; import type { HaRadio } from "../../../../components/ha-radio"; +import "../../../../components/ha-textfield"; import { InputDateTime } from "../../../../data/input_datetime"; import { haStyle } from "../../../../resources/styles"; import { HomeAssistant } from "../../../../types"; @@ -52,9 +52,9 @@ class HaInputDateTimeForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_number-form.ts b/src/panels/config/helpers/forms/ha-input_number-form.ts index 9c53a9afbc..ac7b301352 100644 --- a/src/panels/config/helpers/forms/ha-input_number-form.ts +++ b/src/panels/config/helpers/forms/ha-input_number-form.ts @@ -1,14 +1,14 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; +import "../../../../components/ha-formfield"; import "../../../../components/ha-icon-picker"; +import "../../../../components/ha-radio"; +import type { HaRadio } from "../../../../components/ha-radio"; import "../../../../components/ha-textfield"; import { InputNumber } from "../../../../data/input_number"; import { haStyle } from "../../../../resources/styles"; import { HomeAssistant } from "../../../../types"; -import "../../../../components/ha-formfield"; -import "../../../../components/ha-radio"; -import type { HaRadio } from "../../../../components/ha-radio"; @customElement("ha-input_number-form") class HaInputNumberForm extends LitElement { @@ -67,9 +67,9 @@ class HaInputNumberForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_select-form.ts b/src/panels/config/helpers/forms/ha-input_select-form.ts index e15e1f0cf4..06c5df0cae 100644 --- a/src/panels/config/helpers/forms/ha-input_select-form.ts +++ b/src/panels/config/helpers/forms/ha-input_select-form.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-list/mwc-list-item"; import { mdiDelete } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-button"; @@ -50,9 +50,9 @@ class HaInputSelectForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_text-form.ts b/src/panels/config/helpers/forms/ha-input_text-form.ts index 400f92f012..c978c3f520 100644 --- a/src/panels/config/helpers/forms/ha-input_text-form.ts +++ b/src/panels/config/helpers/forms/ha-input_text-form.ts @@ -1,15 +1,15 @@ -import "../../../../components/ha-form/ha-form"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; +import "../../../../components/ha-form/ha-form"; +import "../../../../components/ha-formfield"; import "../../../../components/ha-icon-picker"; -import "../../../../components/ha-textfield"; +import "../../../../components/ha-radio"; import type { HaRadio } from "../../../../components/ha-radio"; +import "../../../../components/ha-textfield"; import { InputText } from "../../../../data/input_text"; import { haStyle } from "../../../../resources/styles"; import { HomeAssistant } from "../../../../types"; -import "../../../../components/ha-formfield"; -import "../../../../components/ha-radio"; @customElement("ha-input_text-form") class HaInputTextForm extends LitElement { @@ -57,9 +57,9 @@ class HaInputTextForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-schedule-form.ts b/src/panels/config/helpers/forms/ha-schedule-form.ts index 24a29809df..81d34c6c9a 100644 --- a/src/panels/config/helpers/forms/ha-schedule-form.ts +++ b/src/panels/config/helpers/forms/ha-schedule-form.ts @@ -9,7 +9,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { firstWeekdayIndex } from "../../../../common/datetime/first_weekday"; @@ -137,9 +137,9 @@ class HaScheduleForm extends LitElement { this._resizeObserver.observe(form); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-timer-form.ts b/src/panels/config/helpers/forms/ha-timer-form.ts index a0b88347ef..a19362f37d 100644 --- a/src/panels/config/helpers/forms/ha-timer-form.ts +++ b/src/panels/config/helpers/forms/ha-timer-form.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; @@ -46,9 +46,9 @@ class HaTimerForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/integrations/dialog-add-integration.ts b/src/panels/config/integrations/dialog-add-integration.ts index 00f5b8af3d..2fe114e1bf 100644 --- a/src/panels/config/integrations/dialog-add-integration.ts +++ b/src/panels/config/integrations/dialog-add-integration.ts @@ -1,7 +1,14 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list"; import Fuse from "fuse.js"; -import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { + css, + html, + LitElement, + PropertyValues, + TemplateResult, + nothing, +} from "lit"; import { customElement, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; @@ -270,9 +277,9 @@ class AddIntegrationDialog extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this._open) { - return html``; + return nothing; } const integrations = this._integrations ? this._getIntegrations() @@ -428,7 +435,7 @@ class AddIntegrationDialog extends LitElement { private _renderRow = (integration: IntegrationListItem) => { if (!integration) { - return html``; + return nothing; } return html` `; } - protected renderMeta() { + // @ts-expect-error + protected override renderMeta() { if (!this.integration) { - return html``; + return nothing; } return html` ${this.integration.cloud diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts index cff6d3bcad..89de69b387 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts @@ -1,6 +1,6 @@ import "@material/mwc-button/mwc-button"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; @@ -39,9 +39,9 @@ class DialogMatterAddDevice extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._open) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts b/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts index 1be029cfe9..a2e7c083b4 100644 --- a/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts +++ b/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts @@ -1,18 +1,21 @@ +import "@material/mwc-tab-bar/mwc-tab-bar"; +import "@material/mwc-tab/mwc-tab"; +import { mdiClose } from "@mdi/js"; import { css, CSSResultGroup, html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; -import { mdiClose } from "@mdi/js"; import { customElement, property, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-code-editor"; import { createCloseHeading } from "../../../../../components/ha-dialog"; +import "../../../../../components/ha-header-bar"; import { fetchBindableDevices, fetchGroups, @@ -22,20 +25,17 @@ import { import { haStyleDialog } from "../../../../../resources/styles"; import { HomeAssistant } from "../../../../../types"; import { sortZHADevices, sortZHAGroups } from "./functions"; -import "./zha-cluster-attributes"; -import "./zha-cluster-commands"; -import "./zha-manage-clusters"; -import "./zha-device-binding"; -import "./zha-group-binding"; -import "./zha-device-neighbors"; -import "./zha-device-signature"; import { Tab, ZHAManageZigbeeDeviceDialogParams, } from "./show-dialog-zha-manage-zigbee-device"; -import "../../../../../components/ha-header-bar"; -import "@material/mwc-tab-bar/mwc-tab-bar"; -import "@material/mwc-tab/mwc-tab"; +import "./zha-cluster-attributes"; +import "./zha-cluster-commands"; +import "./zha-device-binding"; +import "./zha-device-neighbors"; +import "./zha-device-signature"; +import "./zha-group-binding"; +import "./zha-manage-clusters"; @customElement("dialog-zha-manage-zigbee-device") class DialogZHAManageZigbeeDevice extends LitElement { @@ -87,9 +87,9 @@ class DialogZHAManageZigbeeDevice extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._device) { - return html``; + return nothing; } const tabs = this._getTabs(this._device); diff --git a/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts b/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts index 92d1d5840b..50395ccf1f 100644 --- a/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts +++ b/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; @@ -59,9 +59,9 @@ class DialogZHAReconfigureDevice extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts b/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts index a0a3695dea..b5b4087940 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts @@ -7,13 +7,15 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; import "../../../../../components/buttons/ha-call-service-button"; +import "../../../../../components/buttons/ha-progress-button"; import "../../../../../components/ha-card"; import "../../../../../components/ha-select"; -import "../../../../../components/buttons/ha-progress-button"; +import { forwardHaptic } from "../../../../../data/haptics"; import { Attribute, Cluster, @@ -24,7 +26,6 @@ import { } from "../../../../../data/zha"; import { haStyle } from "../../../../../resources/styles"; import { HomeAssistant } from "../../../../../types"; -import { forwardHaptic } from "../../../../../data/haptics"; import { formatAsPaddedHex } from "./functions"; import { ChangeEvent, @@ -63,9 +64,9 @@ export class ZHAClusterAttributes extends LitElement { super.updated(changedProperties); } - protected render(): TemplateResult { + protected render() { if (!this.device || !this.selectedCluster || !this._attributes) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts b/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts index 31298a5e0a..1d0de70fae 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts @@ -6,14 +6,14 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { property, state } from "lit/decorators"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; import "../../../../../components/buttons/ha-call-service-button"; import "../../../../../components/ha-card"; -import "../../../../../components/ha-select"; import "../../../../../components/ha-form/ha-form"; +import "../../../../../components/ha-select"; import { Cluster, Command, @@ -58,9 +58,9 @@ export class ZHAClusterCommands extends LitElement { super.updated(changedProperties); } - protected render(): TemplateResult { + protected render() { if (!this.device || !this.selectedCluster || !this._commands) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts index ab15c017d6..7bbc64fa67 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts @@ -1,30 +1,30 @@ import "@polymer/paper-input/paper-input"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; -import memoizeOne from "memoize-one"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { computeStateName } from "../../../../../common/entity/compute_state_name"; +import { stringCompare } from "../../../../../common/string/compare"; +import { slugify } from "../../../../../common/string/slugify"; import "../../../../../components/buttons/ha-call-service-button"; import "../../../../../components/entity/state-badge"; +import "../../../../../components/ha-area-picker"; import "../../../../../components/ha-card"; import "../../../../../components/ha-service-description"; import { updateDeviceRegistryEntry } from "../../../../../data/device_registry"; -import { ZHADevice } from "../../../../../data/zha"; -import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import "../../../../../components/ha-area-picker"; -import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"; -import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; import { - subscribeEntityRegistry, EntityRegistryEntry, + subscribeEntityRegistry, updateEntityRegistryEntry, } from "../../../../../data/entity_registry"; +import { ZHADevice } from "../../../../../data/zha"; +import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"; +import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; +import { haStyle } from "../../../../../resources/styles"; +import { HomeAssistant } from "../../../../../types"; import { EntityRegistryStateEntry } from "../../../devices/ha-config-device-page"; -import { stringCompare } from "../../../../../common/string/compare"; import { getIeeeTail } from "./functions"; -import { slugify } from "../../../../../common/string/slugify"; @customElement("zha-device-card") class ZHADeviceCard extends SubscribeMixin(LitElement) { @@ -64,9 +64,9 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) { ]; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.device) { - return html``; + return nothing; } const entities = this._deviceEntities( this.device.device_reg_id, diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts index e292f403f5..31ebd12be9 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts @@ -1,16 +1,16 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; -import memoizeOne from "memoize-one"; +import { html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import memoizeOne from "memoize-one"; import { computeRTLDirection } from "../../../../../common/util/compute_rtl"; -import "../../../../../components/ha-code-editor"; -import { HomeAssistant } from "../../../../../types"; import "../../../../../components/data-table/ha-data-table"; import type { DataTableColumnContainer, DataTableRowData, } from "../../../../../components/data-table/ha-data-table"; import "../../../../../components/ha-circular-progress"; +import "../../../../../components/ha-code-editor"; import { fetchDevices, ZHADevice } from "../../../../../data/zha"; +import { HomeAssistant } from "../../../../../types"; export interface DeviceRowData extends DataTableRowData { id: string; @@ -113,9 +113,9 @@ class ZHADeviceNeighbors extends LitElement { } ); - protected render(): TemplateResult { + protected render() { if (!this.device) { - return html``; + return nothing; } return html` ${!this._devices diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts index ad3ff8c5c3..42768533ce 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts @@ -1,5 +1,5 @@ import "@polymer/paper-input/paper-input"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import "../../../../../components/buttons/ha-call-service-button"; @@ -29,9 +29,9 @@ class ZHADevicePairingStatusCard extends LitElement { @state() private _showHelp = false; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.device) { - return html``; + return nothing; } return html` @@ -66,7 +66,7 @@ class ZHADevicePairingStatusCard extends LitElement { )} ` - : html``} + : nothing}
${INCOMPLETE_PAIRING_STATUSES.includes(this.device.pairing_status!) ? html` @@ -75,7 +75,7 @@ class ZHADevicePairingStatusCard extends LitElement { NWK: ${formatAsPaddedHex(this.device.nwk)}
` - : html``} + : nothing} ${this.device.pairing_status === INITIALIZED ? html` @@ -87,7 +87,7 @@ class ZHADevicePairingStatusCard extends LitElement { .showHelp=${this._showHelp} > ` - : html``} + : nothing}
`; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts index 0ce2b9767a..5d83434184 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts @@ -1,4 +1,4 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../components/ha-code-editor"; import { ZHADevice } from "../../../../../data/zha"; @@ -28,9 +28,9 @@ class ZHADeviceZigbeeInfo extends LitElement { super.updated(changedProperties); } - protected render(): TemplateResult { + protected render() { if (!this._signature) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts index 3eeb04d18b..3a7f951687 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts @@ -1,7 +1,14 @@ import "@material/mwc-button"; import { mdiDelete } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; -import { customElement, property, state, query } from "lit/decorators"; +import { + css, + CSSResultGroup, + html, + LitElement, + PropertyValues, + nothing, +} from "lit"; +import { customElement, property, query, state } from "lit/decorators"; import { HASSDomEvent } from "../../../../../common/dom/fire_event"; import { navigate } from "../../../../../common/navigate"; import { SelectionChangedEvent } from "../../../../../components/data-table/ha-data-table"; @@ -174,7 +181,7 @@ export class ZHAGroupPage extends LitElement { > ` - : html``} + : nothing}
${this.hass.localize("ui.panel.config.zha.groups.add_members")} diff --git a/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts b/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts index db9aff319b..65512ab1a2 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts @@ -1,11 +1,13 @@ import "@material/mwc-list/mwc-list-item"; +import "@material/mwc-tab-bar/mwc-tab-bar"; +import "@material/mwc-tab/mwc-tab"; import { css, CSSResultGroup, html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; @@ -20,8 +22,6 @@ import { import { haStyle } from "../../../../../resources/styles"; import { HomeAssistant } from "../../../../../types"; import { computeClusterKey } from "./functions"; -import "@material/mwc-tab-bar/mwc-tab-bar"; -import "@material/mwc-tab/mwc-tab"; import "./zha-cluster-attributes"; import "./zha-cluster-commands"; @@ -74,9 +74,9 @@ export class ZHAManageClusters extends LitElement { super.updated(changedProperties); } - protected render(): TemplateResult { + protected render() { if (!this.device || !this._clustersLoaded) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts index 6e645beb1a..392b0049a3 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiAlertCircle, mdiCheckCircle, mdiQrcodeScan } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-alert"; @@ -100,9 +100,9 @@ class DialogZWaveJSAddNode extends LitElement { @query("#pin-input") private _pinInput?: HaTextField; - protected render(): TemplateResult { + protected render() { if (!this._entryId) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-network.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-network.ts index 3cf31dc360..db11625195 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-network.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-network.ts @@ -1,8 +1,8 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-linear-progress/mwc-linear-progress"; -import { mdiStethoscope, mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; +import { mdiCheckCircle, mdiCloseCircle, mdiStethoscope } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { createCloseHeading } from "../../../../../components/ha-dialog"; @@ -50,9 +50,9 @@ class DialogZWaveJSHealNetwork extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this.entry_id) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-node.ts index f880f5c20f..776f316f44 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-node.ts @@ -1,13 +1,13 @@ -import "../../../../../components/ha-circular-progress"; import "@material/mwc-button/mwc-button"; -import { mdiStethoscope, mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { mdiCheckCircle, mdiCloseCircle, mdiStethoscope } from "@mdi/js"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; +import "../../../../../components/ha-circular-progress"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import { - DeviceRegistryEntry, computeDeviceName, + DeviceRegistryEntry, } from "../../../../../data/device_registry"; import { fetchZwaveNetworkStatus, @@ -41,9 +41,9 @@ class DialogZWaveJSHealNode extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this.device) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts index b68eb367c0..ed32965b98 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts @@ -1,29 +1,36 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list-item"; +import { mdiSwapHorizontal } from "@mdi/js"; +import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { + css, + CSSResultGroup, + html, + LitElement, + TemplateResult, + nothing, +} from "lit"; +import { customElement, property, state } from "lit/decorators"; +import { fireEvent } from "../../../../../common/dom/fire_event"; +import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-expansion-panel"; import "../../../../../components/ha-help-tooltip"; import "../../../../../components/ha-svg-icon"; -import { mdiSwapHorizontal } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; -import { customElement, property, state } from "lit/decorators"; -import { fireEvent } from "../../../../../common/dom/fire_event"; import { - DeviceRegistryEntry, computeDeviceName, + DeviceRegistryEntry, subscribeDeviceRegistry, } from "../../../../../data/device_registry"; import { - subscribeZwaveNodeStatistics, ProtocolDataRate, + RssiError, + subscribeZwaveNodeStatistics, ZWaveJSNodeStatisticsUpdatedMessage, ZWaveJSRouteStatistics, - RssiError, } from "../../../../../data/zwave_js"; import { haStyleDialog } from "../../../../../resources/styles"; import { HomeAssistant } from "../../../../../types"; import { ZWaveJSNodeStatisticsDialogParams } from "./show-dialog-zwave_js-node-statistics"; -import { createCloseHeading } from "../../../../../components/ha-dialog"; type WorkingRouteStatistics = | (ZWaveJSRouteStatistics & { @@ -69,9 +76,9 @@ class DialogZWaveJSNodeStatistics extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this.device) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts index 0c3eda988d..a973ac05c4 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; @@ -30,9 +30,9 @@ class DialogZWaveJSReinterviewNode extends LitElement { this.device_id = params.device_id; } - protected render(): TemplateResult { + protected render() { if (!this.device_id) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts index f328c97088..a7a0494e47 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle, mdiRobotDead } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; @@ -52,9 +52,9 @@ class DialogZWaveJSRemoveFailedNode extends LitElement { this.closeDialog(); } - protected render(): TemplateResult { + protected render() { if (!this.device_id) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts index bad6ef4597..8db12606c4 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts @@ -1,6 +1,6 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; @@ -40,9 +40,9 @@ class DialogZWaveJSRemoveNode extends LitElement { this.entry_id = params.entry_id; } - protected render(): TemplateResult { + protected render() { if (!this.entry_id) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts index e6d5859efa..68d0ff8235 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts @@ -1,17 +1,18 @@ -import "../../../../../components/ha-file-upload"; -import "../../../../../components/ha-form/ha-form"; -import "../../../../../components/ha-svg-icon"; import "@material/mwc-button/mwc-button"; import "@material/mwc-linear-progress/mwc-linear-progress"; import { mdiCheckCircle, mdiCloseCircle, mdiFileUpload } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; -import { customElement, property, state } from "lit/decorators"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { createCloseHeading } from "../../../../../components/ha-dialog"; +import "../../../../../components/ha-file-upload"; +import "../../../../../components/ha-form/ha-form"; +import { HaFormSchema } from "../../../../../components/ha-form/types"; +import "../../../../../components/ha-svg-icon"; import { - DeviceRegistryEntry, computeDeviceName, + DeviceRegistryEntry, } from "../../../../../data/device_registry"; import { abortZwaveNodeFirmwareUpdate, @@ -20,23 +21,22 @@ import { fetchZwaveNodeStatus, NodeFirmwareUpdateStatus, NodeStatus, - subscribeZwaveNodeStatus, subscribeZwaveNodeFirmwareUpdate, + subscribeZwaveNodeStatus, uploadFirmwareAndBeginUpdate, - ZWaveJSNodeFirmwareUpdateFinishedMessage, - ZWaveJSFirmwareUpdateProgressMessage, - ZWaveJSNodeStatusUpdatedMessage, - ZWaveJSNodeStatus, ZWaveJSControllerFirmwareUpdateFinishedMessage, + ZWaveJSFirmwareUpdateProgressMessage, + ZWaveJSNodeFirmwareUpdateFinishedMessage, + ZWaveJSNodeStatus, + ZWaveJSNodeStatusUpdatedMessage, } from "../../../../../data/zwave_js"; -import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSUpdateFirmwareNodeDialogParams } from "./show-dialog-zwave_js-update-firmware-node"; import { showAlertDialog, showConfirmationDialog, } from "../../../../../dialogs/generic/show-dialog-box"; -import { HaFormSchema } from "../../../../../components/ha-form/types"; +import { haStyleDialog } from "../../../../../resources/styles"; +import { HomeAssistant } from "../../../../../types"; +import { ZWaveJSUpdateFirmwareNodeDialogParams } from "./show-dialog-zwave_js-update-firmware-node"; const firmwareTargetSchema: HaFormSchema[] = [ { @@ -97,13 +97,13 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if ( !this.device || !this._nodeStatus || this._updateInProgress === undefined ) { - return html``; + return nothing; } const beginFirmwareUpdateHTML = html` ${this._nodeStatus.is_controller_node - ? html`` + ? nothing : html`

${this.hass.localize( "ui.panel.config.zwave_js.update_firmware.firmware_target_intro" @@ -150,7 +150,7 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement { : ""; const abortFirmwareUpdateButton = this._nodeStatus.is_controller_node - ? html`` + ? nothing : html` ${this.hass.localize( diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts index 2668262a98..5fedec41f8 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts @@ -7,17 +7,30 @@ import { mdiPlus, mdiRefresh, } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { + css, + CSSResultGroup, + html, + LitElement, + TemplateResult, + nothing, +} from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; +import { computeRTL } from "../../../../../common/util/compute_rtl"; import "../../../../../components/ha-card"; -import "../../../../../components/ha-icon-button"; import "../../../../../components/ha-expansion-panel"; import "../../../../../components/ha-fab"; import "../../../../../components/ha-help-tooltip"; +import "../../../../../components/ha-icon-button"; import "../../../../../components/ha-icon-next"; import "../../../../../components/ha-svg-icon"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { + ConfigEntry, + ERROR_STATES, + getConfigEntries, +} from "../../../../../data/config_entries"; import { fetchZwaveDataCollectionStatus, fetchZwaveNetworkStatus, @@ -32,12 +45,9 @@ import { ZWaveJSNetwork, ZwaveJSProvisioningEntry, } from "../../../../../data/zwave_js"; -import { - ConfigEntry, - getConfigEntries, - ERROR_STATES, -} from "../../../../../data/config_entries"; +import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow"; import "../../../../../layouts/hass-tabs-subpage"; +import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../../resources/styles"; import type { HomeAssistant, Route } from "../../../../../types"; import "../../../ha-config-section"; @@ -45,9 +55,6 @@ import { showZWaveJSAddNodeDialog } from "./show-dialog-zwave_js-add-node"; import { showZWaveJSHealNetworkDialog } from "./show-dialog-zwave_js-heal-network"; import { showZWaveJSRemoveNodeDialog } from "./show-dialog-zwave_js-remove-node"; import { configTabs } from "./zwave_js-config-router"; -import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow"; -import { computeRTL } from "../../../../../common/util/compute_rtl"; -import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; @customElement("zwave_js-config-dashboard") class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { @@ -97,9 +104,9 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { ]; } - protected render(): TemplateResult { + protected render() { if (!this._configEntry) { - return html``; + return nothing; } if (ERROR_STATES.includes(this._configEntry.state)) { diff --git a/src/panels/config/logs/dialog-system-log-detail.ts b/src/panels/config/logs/dialog-system-log-detail.ts index 86920b3877..cb7a3365b9 100644 --- a/src/panels/config/logs/dialog-system-log-detail.ts +++ b/src/panels/config/logs/dialog-system-log-detail.ts @@ -1,6 +1,6 @@ import { mdiClose, mdiContentCopy } from "@mdi/js"; import "@polymer/paper-tooltip/paper-tooltip"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { copyToClipboard } from "../../../common/util/copy-clipboard"; @@ -55,9 +55,9 @@ class DialogSystemLogDetail extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } const item = this._params.item; @@ -159,7 +159,7 @@ class DialogSystemLogDetail extends LitElement { ` : item.message[0]} - ${item.exception ? html`

${item.exception}
` : html``} + ${item.exception ? html`
${item.exception}
` : nothing}
`; diff --git a/src/panels/config/logs/system-log-card.ts b/src/panels/config/logs/system-log-card.ts index 1a0843c0ce..beec07abaf 100644 --- a/src/panels/config/logs/system-log-card.ts +++ b/src/panels/config/logs/system-log-card.ts @@ -1,7 +1,7 @@ import { mdiRefresh } from "@mdi/js"; import "@polymer/paper-item/paper-item"; import "@polymer/paper-item/paper-item-body"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import "../../../components/buttons/ha-call-service-button"; @@ -69,7 +69,7 @@ export class SystemLogCard extends LitElement { }) ); - protected render(): TemplateResult { + protected render() { const filteredItems = this._items ? this._getFilteredItems(this._items, this.filter.toLowerCase()) : []; @@ -134,7 +134,7 @@ export class SystemLogCard extends LitElement { : item.source[0]} ${item.count > 1 ? html` - ${this._multipleMessages(item)} ` - : html``} + : nothing} diff --git a/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts b/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts index fdf95e6351..1c5ccb8c7b 100644 --- a/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts +++ b/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts @@ -1,5 +1,5 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -55,9 +55,9 @@ export class DialogLovelaceDashboardDetail extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params || !this._data) { - return html``; + return nothing; } const defaultPanelUrlPath = this.hass.defaultPanel; const titleInvalid = !this._data.title || !this._data.title.trim(); diff --git a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts index b4d53ec211..90dac9127e 100644 --- a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts +++ b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts @@ -6,7 +6,7 @@ import { mdiPlus, } from "@mdi/js"; import "@polymer/paper-tooltip/paper-tooltip"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { html, LitElement, nothing, PropertyValues } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoize from "memoize-one"; @@ -72,7 +72,7 @@ export class HaConfigLovelaceDashboards extends LitElement { )} > ` - : html``, + : nothing, }, title: { title: this.hass.localize( @@ -242,7 +242,7 @@ export class HaConfigLovelaceDashboards extends LitElement { return result; }); - protected render(): TemplateResult { + protected render() { if (!this.hass || this._dashboards === undefined) { return html` `; } diff --git a/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts b/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts index ae19bcb0de..ee6bfb577d 100644 --- a/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts +++ b/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts @@ -1,5 +1,5 @@ import "@material/mwc-button/mwc-button"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -60,9 +60,9 @@ export class DialogLovelaceResourceDetail extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } const urlInvalid = !this._data?.url || this._data.url.trim() === ""; return html` @@ -114,7 +114,7 @@ export class DialogLovelaceResourceDetail extends LitElement { )} ` - : html``} + : nothing} ` : ""} ` - : html``} + : nothing} ; - protected render(): TemplateResult { + protected render() { if ( !this.hass || this._storageItems === undefined || @@ -113,7 +113,7 @@ class HaConfigPerson extends LitElement { > ` - : html``} + : nothing}
${this._configItems.length > 0 ? html` diff --git a/src/panels/config/repairs/dialog-integration-startup.ts b/src/panels/config/repairs/dialog-integration-startup.ts index edc9c96aa6..f9a78d2806 100644 --- a/src/panels/config/repairs/dialog-integration-startup.ts +++ b/src/panels/config/repairs/dialog-integration-startup.ts @@ -1,5 +1,5 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-card"; @@ -23,9 +23,9 @@ class DialogIntegrationStartup extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/repairs/dialog-repairs-issue.ts b/src/panels/config/repairs/dialog-repairs-issue.ts index 00daaa9393..fe6bc4b4f5 100644 --- a/src/panels/config/repairs/dialog-repairs-issue.ts +++ b/src/panels/config/repairs/dialog-repairs-issue.ts @@ -1,5 +1,5 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { formatDateNumeric } from "../../../common/datetime/format_date"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -33,9 +33,9 @@ class DialogRepairsIssue extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._issue) { - return html``; + return nothing; } const learnMoreUrlIsHomeAssistant = diff --git a/src/panels/config/repairs/dialog-system-information.ts b/src/panels/config/repairs/dialog-system-information.ts index b62ec9f410..ce2bfefd5a 100644 --- a/src/panels/config/repairs/dialog-system-information.ts +++ b/src/panels/config/repairs/dialog-system-information.ts @@ -1,6 +1,13 @@ import "@material/mwc-button/mwc-button"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + TemplateResult, + nothing, +} from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { formatDateTime } from "../../../common/datetime/format_date_time"; @@ -9,6 +16,7 @@ import { copyToClipboard } from "../../../common/util/copy-clipboard"; import { subscribePollingCollection } from "../../../common/util/subscribe-polling"; import "../../../components/ha-alert"; import "../../../components/ha-card"; +import "../../../components/ha-circular-progress"; import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-metric"; import { fetchHassioStats, HassioStats } from "../../../data/hassio/common"; @@ -27,7 +35,6 @@ import { haStyleDialog } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; import { showToast } from "../../../util/toast"; -import "../../../components/ha-circular-progress"; const sortKeys = (a: string, b: string) => { if (a === "homeassistant") { @@ -128,9 +135,9 @@ class DialogSystemInformation extends LitElement { this._supervisorStats = undefined; } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } const sections = this._getSections(); diff --git a/src/panels/config/repairs/ha-config-repairs.ts b/src/panels/config/repairs/ha-config-repairs.ts index e24a5f1dfd..7265f2f837 100644 --- a/src/panels/config/repairs/ha-config-repairs.ts +++ b/src/panels/config/repairs/ha-config-repairs.ts @@ -1,5 +1,5 @@ import "@material/mwc-list/mwc-list"; -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { relativeTime } from "../../../common/datetime/relative_time"; import { capitalizeFirstLetter } from "../../../common/string/capitalize-first-letter"; @@ -27,9 +27,9 @@ class HaConfigRepairs extends LitElement { @property({ type: Number }) public total?: number; - protected render(): TemplateResult { + protected render() { if (!this.repairsIssues?.length) { - return html``; + return nothing; } const issues = this.repairsIssues; diff --git a/src/panels/config/repairs/integrations-startup-time.ts b/src/panels/config/repairs/integrations-startup-time.ts index 411d05792d..ddb7a4c89e 100644 --- a/src/panels/config/repairs/integrations-startup-time.ts +++ b/src/panels/config/repairs/integrations-startup-time.ts @@ -5,7 +5,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-card"; @@ -39,9 +39,9 @@ class IntegrationsStartupTime extends LitElement { this._fetchSetups(); } - protected render(): TemplateResult { + protected render() { if (!this._setups) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts index 14166fe293..d09ddb57d2 100644 --- a/src/panels/config/scene/ha-scene-editor.ts +++ b/src/panels/config/scene/ha-scene-editor.ts @@ -16,7 +16,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -206,9 +206,9 @@ export class HaSceneEditor extends SubscribeMixin( ]; } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const { devices, entities } = this._getEntitiesDevices( this._entities, @@ -342,7 +342,7 @@ export class HaSceneEditor extends SubscribeMixin( ${device.entities.map((entityId) => { const entityStateObj = this.hass.states[entityId]; if (!entityStateObj) { - return html``; + return nothing; } return html` ` - : html``} + : nothing}
diff --git a/src/panels/config/users/dialog-add-user.ts b/src/panels/config/users/dialog-add-user.ts index 70761bbdd7..d1e4ded2fa 100644 --- a/src/panels/config/users/dialog-add-user.ts +++ b/src/panels/config/users/dialog-add-user.ts @@ -6,7 +6,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeRTLDirection } from "../../../common/util/compute_rtl"; @@ -80,9 +80,9 @@ export class DialogAddUser extends LitElement { }); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` ` - : html``} + : nothing} ` - : html``} + : nothing}
`; diff --git a/src/panels/logbook/ha-logbook-renderer.ts b/src/panels/logbook/ha-logbook-renderer.ts index 6877567895..aa6a64e5f2 100644 --- a/src/panels/logbook/ha-logbook-renderer.ts +++ b/src/panels/logbook/ha-logbook-renderer.ts @@ -5,8 +5,8 @@ import { CSSResultGroup, html, LitElement, + nothing, PropertyValues, - TemplateResult, } from "lit"; import { customElement, eventOptions, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -95,7 +95,7 @@ class HaLogbookRenderer extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.entries?.length) { return html`
@@ -129,12 +129,9 @@ class HaLogbookRenderer extends LitElement { `; } - private _renderLogbookItem = ( - item: LogbookEntry, - index: number - ): TemplateResult => { + private _renderLogbookItem = (item: LogbookEntry, index: number) => { if (!item || index === undefined) { - return html``; + return nothing; } const previous = this.entries[index - 1] as LogbookEntry | undefined; const seenEntityIds: string[] = []; @@ -188,7 +185,7 @@ class HaLogbookRenderer extends LitElement { ${formatDate(new Date(item.when * 1000), this.hass.locale)} ` - : html``} + : nothing}
diff --git a/src/panels/logbook/ha-logbook.ts b/src/panels/logbook/ha-logbook.ts index bfeaf28c67..6d6107f1c1 100644 --- a/src/panels/logbook/ha-logbook.ts +++ b/src/panels/logbook/ha-logbook.ts @@ -1,7 +1,7 @@ -import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { ensureArray } from "../../common/array/ensure-array"; +import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; import { throttle } from "../../common/util/throttle"; import "../../components/ha-circular-progress"; @@ -92,9 +92,9 @@ export class HaLogbook extends LitElement { 1000 ); - protected render(): TemplateResult { + protected render() { if (!isComponentLoaded(this.hass, "logbook")) { - return html``; + return nothing; } if (this._error) { diff --git a/src/panels/lovelace/badges/hui-error-badge.ts b/src/panels/lovelace/badges/hui-error-badge.ts index 375cac75ab..aa02366f26 100644 --- a/src/panels/lovelace/badges/hui-error-badge.ts +++ b/src/panels/lovelace/badges/hui-error-badge.ts @@ -1,5 +1,5 @@ import { mdiAlert } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import "../../../components/ha-label-badge"; import "../../../components/ha-svg-icon"; @@ -28,9 +28,9 @@ export class HuiErrorBadge extends LitElement implements LovelaceBadge { this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/badges/hui-state-label-badge.ts b/src/panels/lovelace/badges/hui-state-label-badge.ts index 9ccceba1e8..4d917d5dbd 100644 --- a/src/panels/lovelace/badges/hui-state-label-badge.ts +++ b/src/panels/lovelace/badges/hui-state-label-badge.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import "../../../components/entity/ha-state-label-badge"; @@ -20,9 +20,9 @@ export class HuiStateLabelBadge extends LitElement implements LovelaceBadge { this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config.entity!]; diff --git a/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts index 9c266c54ad..97541d5cc5 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts @@ -1,7 +1,7 @@ import { mdiInformation } from "@mdi/js"; import "@polymer/paper-tooltip"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { round } from "../../../../common/number/round"; @@ -52,9 +52,9 @@ class HuiEnergyCarbonGaugeCard ]; } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } if (!this._data) { @@ -64,7 +64,7 @@ class HuiEnergyCarbonGaugeCard } if (!this._data.co2SignalEntity) { - return html``; + return nothing; } const co2State = this.hass.states[this._data.co2SignalEntity]; diff --git a/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts b/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts index 46f0a317e0..552680e2e9 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts @@ -1,6 +1,6 @@ import { differenceInDays, endOfDay } from "date-fns"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { formatDate } from "../../../../common/datetime/format_date"; import { EnergyData, getEnergyDataCollection } from "../../../../data/energy"; @@ -46,9 +46,9 @@ export class HuiEnergyCompareCard ]; } - protected render(): TemplateResult { + protected render() { if (!this._startCompare || !this._endCompare) { - return html``; + return nothing; } const dayDifference = differenceInDays( diff --git a/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts b/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts index d064e44d18..251cf30506 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts @@ -1,9 +1,9 @@ -import { html, LitElement, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { HomeAssistant } from "../../../../types"; +import "../../components/hui-energy-period-selector"; import { LovelaceCard } from "../../types"; import { EnergyCardBaseConfig } from "../types"; -import "../../components/hui-energy-period-selector"; @customElement("hui-energy-date-selection-card") export class HuiEnergyDateSelectionCard @@ -22,9 +22,9 @@ export class HuiEnergyDateSelectionCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts index 5c5e93673a..5f4b012869 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts @@ -8,7 +8,7 @@ import { import { getRelativePosition } from "chart.js/helpers"; import { addHours, differenceInDays } from "date-fns/esm"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -71,9 +71,9 @@ export class HuiEnergyDevicesGraphCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts b/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts index b57b718d59..378f6e7a5f 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts @@ -13,7 +13,7 @@ import { mdiWater, } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, html, LitElement, svg } from "lit"; +import { css, html, LitElement, svg, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { formatNumber } from "../../../../common/number/format_number"; @@ -67,7 +67,7 @@ class HuiEnergyDistrubutionCard protected render() { if (!this._config) { - return html``; + return nothing; } if (!this._data) { diff --git a/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts index 266531a00f..3dd3e0ca3d 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts @@ -13,7 +13,7 @@ import { startOfToday, } from "date-fns"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -39,9 +39,9 @@ import { getEnergyGasUnit, } from "../../../../data/energy"; import { + getStatisticLabel, Statistics, StatisticsMetaData, - getStatisticLabel, } from "../../../../data/recorder"; import { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; @@ -90,9 +90,9 @@ export class HuiEnergyGasGraphCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts index 1b3897b7d1..73efe19f4a 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts @@ -1,13 +1,13 @@ import { mdiInformation } from "@mdi/js"; import "@polymer/paper-tooltip"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { formatNumber } from "../../../../common/number/format_number"; import "../../../../components/ha-card"; -import "../../../../components/ha-svg-icon"; import "../../../../components/ha-gauge"; import type { LevelDefinition } from "../../../../components/ha-gauge"; +import "../../../../components/ha-svg-icon"; import { EnergyData, getEnergyDataCollection, @@ -55,9 +55,9 @@ class HuiEnergyGridGaugeCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } if (!this._data) { @@ -74,7 +74,7 @@ class HuiEnergyGridGaugeCard let value: number | undefined; if (!gridSource) { - return html``; + return nothing; } const consumedFromGrid = calculateStatisticsSumGrowth( diff --git a/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts index fd5de64399..b027d92b49 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts @@ -1,7 +1,7 @@ import { mdiInformation } from "@mdi/js"; import "@polymer/paper-tooltip"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import "../../../../components/ha-card"; @@ -50,9 +50,9 @@ class HuiEnergySolarGaugeCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } if (!this._data) { @@ -65,7 +65,7 @@ class HuiEnergySolarGaugeCard const types = energySourcesByType(prefs); if (!types.solar) { - return html``; + return nothing; } const totalSolarProduction = calculateStatisticsSumGrowth( diff --git a/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts index 672989c0d0..6d00ed3209 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts @@ -13,7 +13,7 @@ import { startOfToday, } from "date-fns/esm"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -40,9 +40,9 @@ import { SolarSourceTypeEnergyPreference, } from "../../../../data/energy"; import { + getStatisticLabel, Statistics, StatisticsMetaData, - getStatisticLabel, } from "../../../../data/recorder"; import { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; @@ -89,9 +89,9 @@ export class HuiEnergySolarGraphCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts b/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts index 9a05d71990..a6570a4485 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts @@ -1,21 +1,14 @@ // @ts-ignore import dataTableStyles from "@material/data-table/dist/mdc.data-table.min.css"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - TemplateResult, - unsafeCSS, -} from "lit"; +import { css, CSSResultGroup, html, LitElement, unsafeCSS, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { - rgb2hex, - lab2rgb, - rgb2lab, hex2rgb, + lab2rgb, + rgb2hex, + rgb2lab, } from "../../../../common/color/convert-color"; import { labBrighten, labDarken } from "../../../../common/color/lab"; import { formatNumber } from "../../../../common/number/format_number"; @@ -67,9 +60,9 @@ export class HuiEnergySourcesTableCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } if (!this._data) { diff --git a/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts index ebe5be75a3..e65a621b15 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts @@ -13,7 +13,7 @@ import { startOfToday, } from "date-fns/esm"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -34,9 +34,9 @@ import "../../../../components/chart/ha-chart-base"; import "../../../../components/ha-card"; import { EnergyData, getEnergyDataCollection } from "../../../../data/energy"; import { + getStatisticLabel, Statistics, StatisticsMetaData, - getStatisticLabel, } from "../../../../data/recorder"; import { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; @@ -83,9 +83,9 @@ export class HuiEnergyUsageGraphCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts index 38d20d3d29..e5b751cbf9 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts @@ -13,7 +13,7 @@ import { startOfToday, } from "date-fns"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -34,14 +34,14 @@ import "../../../../components/chart/ha-chart-base"; import "../../../../components/ha-card"; import { EnergyData, - WaterSourceTypeEnergyPreference, getEnergyDataCollection, getEnergyWaterUnit, + WaterSourceTypeEnergyPreference, } from "../../../../data/energy"; import { + getStatisticLabel, Statistics, StatisticsMetaData, - getStatisticLabel, } from "../../../../data/recorder"; import { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; @@ -90,9 +90,9 @@ export class HuiEnergyWaterGraphCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-alarm-panel-card.ts b/src/panels/lovelace/cards/hui-alarm-panel-card.ts index 1f2d2bb6c5..165fb8ed8a 100644 --- a/src/panels/lovelace/cards/hui-alarm-panel-card.ts +++ b/src/panels/lovelace/cards/hui-alarm-panel-card.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -133,9 +133,9 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard { ); } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config.entity]; @@ -185,7 +185,7 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard { )}
${!stateObj.attributes.code_format - ? html`` + ? nothing : html` `} ${stateObj.attributes.code_format !== FORMAT_NUMBER - ? html`` + ? nothing : html`
${BUTTONS.map((value) => diff --git a/src/panels/lovelace/cards/hui-area-card.ts b/src/panels/lovelace/cards/hui-area-card.ts index 385e48c6bf..70a0258867 100644 --- a/src/panels/lovelace/cards/hui-area-card.ts +++ b/src/panels/lovelace/cards/hui-area-card.ts @@ -17,6 +17,7 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -33,7 +34,6 @@ import "../../../components/ha-card"; import "../../../components/ha-icon-button"; import "../../../components/ha-state-icon"; import "../../../components/ha-svg-icon"; -import "../components/hui-image"; import { AreaRegistryEntry, subscribeAreaRegistry, @@ -50,6 +50,7 @@ import { import { forwardHaptic } from "../../../data/haptics"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { HomeAssistant } from "../../../types"; +import "../components/hui-image"; import "../components/hui-warning"; import { LovelaceCard, LovelaceCardEditor } from "../types"; import { AreaCardConfig } from "./types"; @@ -318,7 +319,7 @@ export class HuiAreaCard return false; } - protected render(): TemplateResult { + protected render() { if ( !this._config || !this.hass || @@ -326,7 +327,7 @@ export class HuiAreaCard !this._devices || !this._entities ) { - return html``; + return nothing; } const entitiesByDomain = this._entitiesByDomain( diff --git a/src/panels/lovelace/cards/hui-button-card.ts b/src/panels/lovelace/cards/hui-button-card.ts index dd79487d25..3886e2b83d 100644 --- a/src/panels/lovelace/cards/hui-button-card.ts +++ b/src/panels/lovelace/cards/hui-button-card.ts @@ -8,7 +8,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, @@ -136,9 +136,9 @@ export class HuiButtonCard extends LitElement implements LovelaceCard { ); } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } const stateObj = this._config.entity ? this.hass.states[this._config.entity] diff --git a/src/panels/lovelace/cards/hui-calendar-card.ts b/src/panels/lovelace/cards/hui-calendar-card.ts index abd69bf654..c502cc1da8 100644 --- a/src/panels/lovelace/cards/hui-calendar-card.ts +++ b/src/panels/lovelace/cards/hui-calendar-card.ts @@ -4,9 +4,9 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; -import { customElement, property, state, query } from "lit/decorators"; +import { customElement, property, query, state } from "lit/decorators"; import { getColorByIndex } from "../../../common/color/colors"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; import { HASSDomEvent } from "../../../common/dom/fire_event"; @@ -118,9 +118,9 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass || !this._calendars.length) { - return html``; + return nothing; } const views: FullCalendarView[] = this._veryNarrow diff --git a/src/panels/lovelace/cards/hui-empty-state-card.ts b/src/panels/lovelace/cards/hui-empty-state-card.ts index 83f376ae12..7202ae4ff2 100644 --- a/src/panels/lovelace/cards/hui-empty-state-card.ts +++ b/src/panels/lovelace/cards/hui-empty-state-card.ts @@ -1,5 +1,5 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-card"; import { HomeAssistant } from "../../../types"; @@ -18,9 +18,9 @@ export class HuiEmptyStateCard extends LitElement implements LovelaceCard { // eslint-disable-next-line } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-entities-card.ts b/src/panels/lovelace/cards/hui-entities-card.ts index 59ccec7ae5..3d5b46449e 100644 --- a/src/panels/lovelace/cards/hui-entities-card.ts +++ b/src/panels/lovelace/cards/hui-entities-card.ts @@ -5,6 +5,7 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, state } from "lit/decorators"; import { DOMAINS_TOGGLE } from "../../../common/const"; @@ -178,9 +179,9 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this._hass) { - return html``; + return nothing; } return html` @@ -204,7 +205,7 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard { ${this._config.title}
${!this._showHeaderToggle - ? html`` + ? nothing : html` ${this._error}
`; diff --git a/src/panels/lovelace/cards/hui-markdown-card.ts b/src/panels/lovelace/cards/hui-markdown-card.ts index d03a9cd45d..59dfd15265 100644 --- a/src/panels/lovelace/cards/hui-markdown-card.ts +++ b/src/panels/lovelace/cards/hui-markdown-card.ts @@ -5,7 +5,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -72,9 +72,9 @@ export class HuiMarkdownCard extends LitElement implements LovelaceCard { this._tryDisconnect(); } - protected render(): TemplateResult { + protected render() { if (!this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-media-control-card.ts b/src/panels/lovelace/cards/hui-media-control-card.ts index 05d6faf3b2..2a021ff662 100644 --- a/src/panels/lovelace/cards/hui-media-control-card.ts +++ b/src/panels/lovelace/cards/hui-media-control-card.ts @@ -7,7 +7,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -138,9 +138,9 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const stateObj = this._stateObj; diff --git a/src/panels/lovelace/cards/hui-picture-card.ts b/src/panels/lovelace/cards/hui-picture-card.ts index ffcf4f5009..c72bf72bc9 100644 --- a/src/panels/lovelace/cards/hui-picture-card.ts +++ b/src/panels/lovelace/cards/hui-picture-card.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -78,9 +78,9 @@ export class HuiPictureCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-picture-elements-card.ts b/src/panels/lovelace/cards/hui-picture-elements-card.ts index 192569b3a9..fad22f2c66 100644 --- a/src/panels/lovelace/cards/hui-picture-elements-card.ts +++ b/src/panels/lovelace/cards/hui-picture-elements-card.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; @@ -110,9 +110,9 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-picture-entity-card.ts b/src/panels/lovelace/cards/hui-picture-entity-card.ts index c1e3efbd80..665aad7f32 100644 --- a/src/panels/lovelace/cards/hui-picture-entity-card.ts +++ b/src/panels/lovelace/cards/hui-picture-entity-card.ts @@ -5,6 +5,7 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; @@ -102,9 +103,9 @@ class HuiPictureEntityCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config.entity]; diff --git a/src/panels/lovelace/cards/hui-picture-glance-card.ts b/src/panels/lovelace/cards/hui-picture-glance-card.ts index eda0d51fec..298a745026 100644 --- a/src/panels/lovelace/cards/hui-picture-glance-card.ts +++ b/src/panels/lovelace/cards/hui-picture-glance-card.ts @@ -5,6 +5,7 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -164,9 +165,9 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-plant-status-card.ts b/src/panels/lovelace/cards/hui-plant-status-card.ts index 507d82f10a..74c080031a 100644 --- a/src/panels/lovelace/cards/hui-plant-status-card.ts +++ b/src/panels/lovelace/cards/hui-plant-status-card.ts @@ -11,7 +11,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; @@ -101,9 +101,9 @@ class HuiPlantStatusCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config!.entity]; diff --git a/src/panels/lovelace/cards/hui-shopping-list-card.ts b/src/panels/lovelace/cards/hui-shopping-list-card.ts index f1d82f45e3..2c53ce6a71 100644 --- a/src/panels/lovelace/cards/hui-shopping-list-card.ts +++ b/src/panels/lovelace/cards/hui-shopping-list-card.ts @@ -6,7 +6,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -105,9 +105,9 @@ class HuiShoppingListCard } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-stack-card.ts b/src/panels/lovelace/cards/hui-stack-card.ts index 9ad8d2ba93..28bd1c5ae5 100644 --- a/src/panels/lovelace/cards/hui-stack-card.ts +++ b/src/panels/lovelace/cards/hui-stack-card.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { property, state } from "lit/decorators"; import { LovelaceCardConfig } from "../../../data/lovelace"; @@ -68,9 +68,9 @@ export abstract class HuiStackCard } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this._cards) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-starting-card.ts b/src/panels/lovelace/cards/hui-starting-card.ts index 09bdd24079..2c7be82c53 100644 --- a/src/panels/lovelace/cards/hui-starting-card.ts +++ b/src/panels/lovelace/cards/hui-starting-card.ts @@ -6,7 +6,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -39,9 +39,9 @@ export class HuiStartingCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-statistic-card.ts b/src/panels/lovelace/cards/hui-statistic-card.ts index 951e68b6f7..ddf5651450 100644 --- a/src/panels/lovelace/cards/hui-statistic-card.ts +++ b/src/panels/lovelace/cards/hui-statistic-card.ts @@ -5,7 +5,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; @@ -123,9 +123,9 @@ export class HuiStatisticCard extends LitElement implements LovelaceCard { return size; } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } if (this._error) { diff --git a/src/panels/lovelace/cards/hui-statistics-graph-card.ts b/src/panels/lovelace/cards/hui-statistics-graph-card.ts index 997f84d2e5..d97005ffb3 100644 --- a/src/panels/lovelace/cards/hui-statistics-graph-card.ts +++ b/src/panels/lovelace/cards/hui-statistics-graph-card.ts @@ -5,7 +5,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -177,9 +177,9 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-thermostat-card.ts b/src/panels/lovelace/cards/hui-thermostat-card.ts index 956782dec3..dbeb47db18 100644 --- a/src/panels/lovelace/cards/hui-thermostat-card.ts +++ b/src/panels/lovelace/cards/hui-thermostat-card.ts @@ -15,9 +15,9 @@ import { CSSResultGroup, html, LitElement, + nothing, PropertyValues, svg, - TemplateResult, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -104,9 +104,9 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config.entity] as ClimateEntity; @@ -467,9 +467,9 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { } } - private _renderIcon(mode: string, currentMode: string): TemplateResult { + private _renderIcon(mode: string, currentMode: string) { if (!modeIcons[mode]) { - return html``; + return nothing; } return html` ; @@ -62,9 +62,9 @@ export class HuiActionEditor extends LitElement { }) ); - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const actions = this.actions ?? DEFAULT_ACTIONS; diff --git a/src/panels/lovelace/components/hui-energy-period-selector.ts b/src/panels/lovelace/components/hui-energy-period-selector.ts index b1fb786dba..ef733beeb4 100644 --- a/src/panels/lovelace/components/hui-energy-period-selector.ts +++ b/src/panels/lovelace/components/hui-energy-period-selector.ts @@ -19,8 +19,9 @@ import { startOfYear, } from "date-fns/esm"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import { firstWeekdayIndex } from "../../../common/datetime/first_weekday"; import { formatDate, formatDateMonthYear, @@ -28,15 +29,14 @@ import { formatDateYear, } from "../../../common/datetime/format_date"; import { toggleAttribute } from "../../../common/dom/toggle_attribute"; +import { computeRTLDirection } from "../../../common/util/compute_rtl"; import "../../../components/ha-button-toggle-group"; import "../../../components/ha-icon-button"; -import "../../../components/ha-icon-button-prev"; import "../../../components/ha-icon-button-next"; +import "../../../components/ha-icon-button-prev"; import { EnergyData, getEnergyDataCollection } from "../../../data/energy"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { HomeAssistant, ToggleButton } from "../../../types"; -import { computeRTLDirection } from "../../../common/util/compute_rtl"; -import { firstWeekdayIndex } from "../../../common/datetime/first_weekday"; @customElement("hui-energy-period-selector") export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) { @@ -67,9 +67,9 @@ export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) { ]; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._startDate) { - return html``; + return nothing; } const viewButtons: ToggleButton[] = [ diff --git a/src/panels/lovelace/components/hui-entities-toggle.ts b/src/panels/lovelace/components/hui-entities-toggle.ts index 7e0431b61f..8c28f4b7be 100644 --- a/src/panels/lovelace/components/hui-entities-toggle.ts +++ b/src/panels/lovelace/components/hui-entities-toggle.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { DOMAINS_TOGGLE } from "../../../common/const"; @@ -33,9 +33,9 @@ class HuiEntitiesToggle extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._toggleEntities?.length) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/components/hui-entity-editor.ts b/src/panels/lovelace/components/hui-entity-editor.ts index dbfa9b1eaf..138a88d870 100644 --- a/src/panels/lovelace/components/hui-entity-editor.ts +++ b/src/panels/lovelace/components/hui-entity-editor.ts @@ -1,5 +1,5 @@ import { mdiDrag } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import type { SortableEvent } from "sortablejs"; @@ -39,9 +39,9 @@ export class HuiEntityEditor extends LitElement { return this._entityKeys.get(action)!; } - protected render(): TemplateResult { + protected render() { if (!this.entities) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/components/hui-generic-entity-row.ts b/src/panels/lovelace/components/hui-generic-entity-row.ts index 55b6bc6cab..3d1c1e0d0c 100644 --- a/src/panels/lovelace/components/hui-generic-entity-row.ts +++ b/src/panels/lovelace/components/hui-generic-entity-row.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -40,9 +40,9 @@ class HuiGenericEntityRow extends LitElement { // Default behavior is controlled by DOMAINS_INPUT_ROW. @property({ type: Boolean }) public catchInteraction?; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.config) { - return html``; + return nothing; } const stateObj = this.config.entity ? this.hass.states[this.config.entity] @@ -153,7 +153,7 @@ class HuiGenericEntityRow extends LitElement { ` : ""}
` - : html``} + : nothing} ${this.catchInteraction ?? !DOMAINS_INPUT_ROW.includes(domain) ? html`
0 && this._ratio.h > 0 @@ -219,7 +219,7 @@ export class HuiImage extends LitElement { > ` : imageSrc === undefined - ? html`` + ? nothing : html` ({ entity_id }) ); - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config.entity ?? ""] as diff --git a/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-tile-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-tile-feature-editor.ts index 982b48ea4c..aeed477351 100644 --- a/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-tile-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-tile-feature-editor.ts @@ -1,5 +1,5 @@ import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -52,9 +52,9 @@ export class HuiVacuumCommandsTileFeatureEditor ] as const ); - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const stateObj = this.context?.entity_id diff --git a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts index 264637c16a..c338e4a8e9 100644 --- a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts @@ -1,4 +1,4 @@ -import { html, LitElement, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { assert, assign, boolean, object, optional, string } from "superstruct"; @@ -121,9 +121,9 @@ export class HuiWeatherForecastCardEditor ] as const ); - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const schema = this._schema(this.hass.localize, this._has_forecast); diff --git a/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts b/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts index 6c909c8bf1..3386d220be 100644 --- a/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts +++ b/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts @@ -1,5 +1,5 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import { createCloseHeading } from "../../../../components/ha-dialog"; @@ -32,9 +32,9 @@ export class HuiCreateDialogHeaderFooter return true; } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/editor/hui-dialog-save-config.ts b/src/panels/lovelace/editor/hui-dialog-save-config.ts index 1ebf011137..06c0dcfd0e 100644 --- a/src/panels/lovelace/editor/hui-dialog-save-config.ts +++ b/src/panels/lovelace/editor/hui-dialog-save-config.ts @@ -1,6 +1,6 @@ import "@material/mwc-button"; import { mdiHelpCircle } from "@mdi/js"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { computeRTLDirection } from "../../../common/util/compute_rtl"; @@ -46,9 +46,9 @@ export class HuiSaveConfig extends LitElement implements HassDialog { return true; } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` ` - : html``} + : nothing} `; } diff --git a/src/panels/lovelace/special-rows/hui-text-row.ts b/src/panels/lovelace/special-rows/hui-text-row.ts index b64d8a3842..aa1eabff0c 100644 --- a/src/panels/lovelace/special-rows/hui-text-row.ts +++ b/src/panels/lovelace/special-rows/hui-text-row.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import "../../../components/ha-icon"; import { LovelaceRow, TextConfig } from "../entity-rows/types"; @@ -15,9 +15,9 @@ class HuiTextRow extends LitElement implements LovelaceRow { this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/special-rows/hui-weblink-row.ts b/src/panels/lovelace/special-rows/hui-weblink-row.ts index 5af61bb49e..04d00240f0 100644 --- a/src/panels/lovelace/special-rows/hui-weblink-row.ts +++ b/src/panels/lovelace/special-rows/hui-weblink-row.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import "../../../components/ha-icon"; @@ -23,9 +23,9 @@ class HuiWeblinkRow extends LitElement implements LovelaceRow { }; } - protected render(): TemplateResult { + protected render() { if (!this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/media-browser/ha-bar-media-player.ts b/src/panels/media-browser/ha-bar-media-player.ts index ba7f1b5820..5266eebf33 100644 --- a/src/panels/media-browser/ha-bar-media-player.ts +++ b/src/panels/media-browser/ha-bar-media-player.ts @@ -18,7 +18,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -156,7 +156,7 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) { this._newMediaExpected = false; } - protected render(): TemplateResult { + protected render() { if (this._newMediaExpected) { return html`
@@ -267,7 +267,7 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) { )}
${stateObj.attributes.media_duration === Infinity - ? html`` + ? nothing : this.narrow ? html`` : html` diff --git a/src/panels/media-browser/hui-dialog-web-browser-play-media.ts b/src/panels/media-browser/hui-dialog-web-browser-play-media.ts index 78a7beb8c3..365e70dd1b 100644 --- a/src/panels/media-browser/hui-dialog-web-browser-play-media.ts +++ b/src/panels/media-browser/hui-dialog-web-browser-play-media.ts @@ -1,11 +1,4 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - TemplateResult, -} from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { createCloseHeading } from "../../components/ha-dialog"; @@ -30,9 +23,9 @@ export class HuiDialogWebBrowserPlayMedia extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params || !this._params.sourceType || !this._params.sourceUrl) { - return html``; + return nothing; } const mediaType = this._params.sourceType.split("/", 1)[0]; diff --git a/src/panels/my/ha-panel-my.ts b/src/panels/my/ha-panel-my.ts index 609aba96f2..2cfc2d7e50 100644 --- a/src/panels/my/ha-panel-my.ts +++ b/src/panels/my/ha-panel-my.ts @@ -1,5 +1,5 @@ import { sanitizeUrl } from "@braintree/sanitize-url"; -import { html, LitElement } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { @@ -406,7 +406,7 @@ class HaPanelMy extends LitElement { .hass=${this.hass} >`; } - return html``; + return nothing; } private _createRedirectUrl(): string { diff --git a/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts b/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts index d1a6ec1937..e5e9ff4abe 100644 --- a/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts +++ b/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts @@ -1,5 +1,5 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../components/ha-circular-progress"; import "../../components/ha-dialog"; @@ -67,9 +67,9 @@ class HaMfaModuleSetupFlow extends LitElement { this._opened = false; } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } return html`