From 8a39d18323a79b85ec1cc59bc746480f8bcf62f0 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 27 Nov 2019 22:51:03 +0100 Subject: [PATCH] Bump TypeScript to 3.7 (#4282) * Bump TypeScript to 3.7 * Update prettier to support ts 3.7 * Prettier * More prettier * Even more prettier --- cast/src/receiver/layout/hc-main.ts | 6 +- demo/src/custom-cards/card-modder.js | 2 +- demo/src/entrypoint.ts | 4 +- demo/src/stubs/history.ts | 127 +-- demo/src/stubs/lovelace.ts | 7 +- hassio/src/addon-view/hassio-addon-audio.js | 8 +- hassio/src/addon-view/hassio-addon-info.js | 5 +- hassio/src/dashboard/hassio-update.ts | 8 +- .../markdown/show-dialog-hassio-markdown.ts | 4 +- .../snapshot/show-dialog-hassio-snapshot.ts | 4 +- hassio/src/hassio-main.ts | 8 +- package.json | 24 +- src/auth/ha-auth-flow.ts | 16 +- src/auth/ha-authorize.ts | 4 +- src/common/datetime/format_date.ts | 4 +- src/common/datetime/format_date_time.ts | 4 +- src/common/datetime/format_time.ts | 4 +- src/common/dom/apply_themes_on_element.ts | 2 +- src/common/dom/setup-leaflet-map.ts | 4 +- src/components/entity/ha-chart-base.js | 4 +- src/components/ha-camera-stream.ts | 5 +- src/components/ha-climate-state.js | 20 +- src/components/ha-water_heater-state.js | 8 +- src/data/camera.ts | 4 +- src/data/conversation.ts | 2 +- src/data/device_automation.ts | 20 +- src/data/hassio.ts | 4 +- .../dialog-config-entry-system-options.ts | 4 +- ...show-dialog-config-entry-system-options.ts | 4 +- .../config-flow/show-dialog-config-flow.ts | 4 +- .../show-dialog-data-entry-flow.ts | 4 +- .../config-flow/show-dialog-options-flow.ts | 4 +- .../show-dialog-device-registry-detail.ts | 4 +- .../show-dialog-domain-toggler.ts | 4 +- .../show-ha-voice-command-dialog.ts | 4 +- .../show-dialog-zha-device-info.ts | 4 +- src/entrypoints/authorize.ts | 4 +- src/entrypoints/core.ts | 6 +- src/fake_data/provide_hass.ts | 37 +- src/layouts/home-assistant.ts | 11 +- src/layouts/partial-panel-resolver.ts | 52 +- src/onboarding/ha-onboarding.ts | 8 +- src/onboarding/onboarding-integrations.ts | 4 +- .../show-dialog-area-registry-detail.ts | 4 +- .../config/automation/ha-automation-picker.ts | 4 +- .../automation/show-dialog-thingtalk.ts | 4 +- .../show-dialog-cloud-certificate.ts | 4 +- .../show-dialog-manage-cloudhook.ts | 4 +- src/panels/config/cloud/ha-config-cloud.ts | 12 +- .../show-dialog-entity-registry-detail.ts | 4 +- src/panels/config/ha-panel-config.ts | 64 +- src/panels/config/js/condition/device.tsx | 4 +- src/panels/config/js/script/device.tsx | 4 +- src/panels/config/js/trigger/device.tsx | 4 +- src/panels/config/person/ha-config-person.ts | 6 +- .../person/show-dialog-person-detail.ts | 4 +- .../config/users/ha-config-user-picker.js | 4 +- src/panels/config/zha/ha-config-zha.ts | 7 +- src/panels/config/zha/zha-config-panel.ts | 8 +- src/panels/config/zwave/zwave-log.js | 4 +- .../logs/show-dialog-system-log-detail.ts | 4 +- .../lovelace/cards/hui-alarm-panel-card.ts | 4 +- .../lovelace/cards/hui-entities-card.ts | 4 +- .../lovelace/cards/hui-entity-button-card.ts | 4 +- src/panels/lovelace/cards/hui-gauge-card.ts | 4 +- src/panels/lovelace/cards/hui-glance-card.ts | 4 +- .../lovelace/cards/hui-history-graph-card.js | 4 +- src/panels/lovelace/cards/hui-iframe-card.ts | 4 +- src/panels/lovelace/cards/hui-light-card.ts | 10 +- src/panels/lovelace/cards/hui-map-card.ts | 4 +- .../lovelace/cards/hui-markdown-card.ts | 4 +- .../lovelace/cards/hui-media-control-card.js | 4 +- src/panels/lovelace/cards/hui-picture-card.ts | 4 +- .../lovelace/cards/hui-picture-entity-card.ts | 8 +- .../lovelace/cards/hui-picture-glance-card.ts | 4 +- .../lovelace/cards/hui-plant-status-card.ts | 4 +- src/panels/lovelace/cards/hui-sensor-card.ts | 14 +- .../lovelace/cards/hui-shopping-list-card.ts | 4 +- .../lovelace/cards/hui-thermostat-card.ts | 12 +- .../cards/hui-weather-forecast-card.ts | 8 +- .../common/generate-lovelace-config.ts | 18 +- src/panels/lovelace/common/load-resources.ts | 6 +- .../card-editor/show-edit-card-dialog.ts | 4 +- .../card-editor/show-move-card-view-dialog.ts | 4 +- .../show-edit-lovelace-dialog.ts | 4 +- .../select-view/show-select-view-dialog.ts | 4 +- .../editor/show-save-config-dialog.ts | 4 +- .../view-editor/show-edit-view-dialog.ts | 4 +- src/panels/lovelace/hui-root.ts | 14 +- src/panels/mailbox/ha-panel-mailbox.js | 4 +- src/panels/map/ha-entity-marker.js | 4 +- .../profile/ha-mfa-module-setup-flow.js | 8 +- src/panels/profile/ha-mfa-modules-card.js | 4 +- src/state/auth-mixin.ts | 4 +- src/state/disconnect-toast-mixin.ts | 4 +- src/state/more-info-mixin.ts | 4 +- src/state/notification-mixin.ts | 4 +- src/util/custom-panel/load-custom-panel.ts | 4 +- src/util/hass-translation.ts | 4 +- yarn.lock | 932 +++++++++++++----- 100 files changed, 1165 insertions(+), 600 deletions(-) diff --git a/cast/src/receiver/layout/hc-main.ts b/cast/src/receiver/layout/hc-main.ts index ccb20f5aa5..93d91f2375 100644 --- a/cast/src/receiver/layout/hc-main.ts +++ b/cast/src/receiver/layout/hc-main.ts @@ -175,9 +175,9 @@ export class HcMain extends HassElement { } catch (err) { // Generate a Lovelace config. this._unsubLovelace = () => undefined; - const { - generateLovelaceConfigFromHass, - } = await import("../../../../src/panels/lovelace/common/generate-lovelace-config"); + const { generateLovelaceConfigFromHass } = await import( + "../../../../src/panels/lovelace/common/generate-lovelace-config" + ); this._handleNewLovelaceConfig( await generateLovelaceConfigFromHass(this.hass!) ); diff --git a/demo/src/custom-cards/card-modder.js b/demo/src/custom-cards/card-modder.js index 82f0411115..aaec2b7322 100644 --- a/demo/src/custom-cards/card-modder.js +++ b/demo/src/custom-cards/card-modder.js @@ -53,7 +53,7 @@ class CardModder extends LitElement { for (var k in this._config.style) { if (window.cardTools.hasTemplate(this._config.style[k])) this.templated.push(k); - this.card.style.setProperty(k, ''); + this.card.style.setProperty(k, ""); target.style.setProperty( k, window.cardTools.parseTemplate(this._config.style[k]) diff --git a/demo/src/entrypoint.ts b/demo/src/entrypoint.ts index 456a9923ed..bacc0978a8 100644 --- a/demo/src/entrypoint.ts +++ b/demo/src/entrypoint.ts @@ -12,5 +12,7 @@ import "./resources/hademo-icons"; /* polyfill for paper-dropdown */ setTimeout(() => { - import(/* webpackChunkName: "polyfill-web-animations-next" */ "web-animations-js/web-animations-next-lite.min"); + import( + /* webpackChunkName: "polyfill-web-animations-next" */ "web-animations-js/web-animations-next-lite.min" + ); }, 1000); diff --git a/demo/src/stubs/history.ts b/demo/src/stubs/history.ts index c0364760a8..84ef96619a 100644 --- a/demo/src/stubs/history.ts +++ b/demo/src/stubs/history.ts @@ -65,74 +65,79 @@ const generateHistory = (state, deltas) => { const incrementalUnits = ["clients", "queries", "ads"]; export const mockHistory = (mockHass: MockHomeAssistant) => { - mockHass.mockAPI(new RegExp("history/period/.+"), ( - hass, - // @ts-ignore - method, - path, - // @ts-ignore - parameters - ) => { - const params = parseQuery(path.split("?")[1]); - const entities = params.filter_entity_id.split(","); + mockHass.mockAPI( + new RegExp("history/period/.+"), + ( + hass, + // @ts-ignore + method, + path, + // @ts-ignore + parameters + ) => { + const params = parseQuery(path.split("?")[1]); + const entities = params.filter_entity_id.split(","); - const results: HassEntity[][] = []; + const results: HassEntity[][] = []; - for (const entityId of entities) { - const state = hass.states[entityId]; + for (const entityId of entities) { + const state = hass.states[entityId]; - if (!state) { - continue; - } + if (!state) { + continue; + } - if (!state.attributes.unit_of_measurement) { - results.push(generateHistory(state, [state.state])); - continue; - } + if (!state.attributes.unit_of_measurement) { + results.push(generateHistory(state, [state.state])); + continue; + } - const numberState = Number(state.state); + const numberState = Number(state.state); - if (isNaN(numberState)) { - // tslint:disable-next-line - console.log( - "Ignoring state with unparsable state but with a unit", - entityId, - state + if (isNaN(numberState)) { + // tslint:disable-next-line + console.log( + "Ignoring state with unparsable state but with a unit", + entityId, + state + ); + continue; + } + + const statesToGenerate = 15; + let genFunc; + + if (incrementalUnits.includes(state.attributes.unit_of_measurement)) { + let initial = Math.floor( + numberState * 0.4 + numberState * Math.random() * 0.2 + ); + const diff = Math.max( + 1, + Math.floor((numberState - initial) / statesToGenerate) + ); + genFunc = () => { + initial += diff; + return Math.min(numberState, initial); + }; + } else { + const diff = Math.floor( + numberState * (numberState > 80 ? 0.05 : 0.5) + ); + genFunc = () => + numberState - diff + Math.floor(Math.random() * 2 * diff); + } + + results.push( + generateHistory( + { + entity_id: state.entity_id, + attributes: state.attributes, + }, + Array.from({ length: statesToGenerate }, genFunc) + ) ); - continue; } - - const statesToGenerate = 15; - let genFunc; - - if (incrementalUnits.includes(state.attributes.unit_of_measurement)) { - let initial = Math.floor( - numberState * 0.4 + numberState * Math.random() * 0.2 - ); - const diff = Math.max( - 1, - Math.floor((numberState - initial) / statesToGenerate) - ); - genFunc = () => { - initial += diff; - return Math.min(numberState, initial); - }; - } else { - const diff = Math.floor(numberState * (numberState > 80 ? 0.05 : 0.5)); - genFunc = () => - numberState - diff + Math.floor(Math.random() * 2 * diff); - } - - results.push( - generateHistory( - { - entity_id: state.entity_id, - attributes: state.attributes, - }, - Array.from({ length: statesToGenerate }, genFunc) - ) - ); + return results; } - return results; - }); + ); }; diff --git a/demo/src/stubs/lovelace.ts b/demo/src/stubs/lovelace.ts index 0170e272f2..138a15aff4 100644 --- a/demo/src/stubs/lovelace.ts +++ b/demo/src/stubs/lovelace.ts @@ -12,9 +12,10 @@ export const mockLovelace = ( localizePromise: Promise ) => { hass.mockWS("lovelace/config", () => - Promise.all([selectedDemoConfig, localizePromise]).then( - ([config, localize]) => config.lovelace(localize) - ) + Promise.all([ + selectedDemoConfig, + localizePromise, + ]).then(([config, localize]) => config.lovelace(localize)) ); hass.mockWS("lovelace/config/save", () => Promise.resolve()); diff --git a/hassio/src/addon-view/hassio-addon-audio.js b/hassio/src/addon-view/hassio-addon-audio.js index 96275cd107..84ec925d80 100644 --- a/hassio/src/addon-view/hassio-addon-audio.js +++ b/hassio/src/addon-view/hassio-addon-audio.js @@ -44,9 +44,7 @@ class HassioAddonAudio extends EventsMixin(PolymerElement) { selected="{{selectedInput}}" > - [[item.name]] + [[item.name]] @@ -57,9 +55,7 @@ class HassioAddonAudio extends EventsMixin(PolymerElement) { selected="{{selectedOutput}}" > - [[item.name]] + [[item.name]] diff --git a/hassio/src/addon-view/hassio-addon-info.js b/hassio/src/addon-view/hassio-addon-info.js index 10df924f6e..449b85a8cc 100644 --- a/hassio/src/addon-view/hassio-addon-info.js +++ b/hassio/src/addon-view/hassio-addon-info.js @@ -569,7 +569,10 @@ class HassioAddonInfo extends EventsMixin(PolymerElement) { openChangelog() { this.hass .callApi("get", `hassio/addons/${this.addonSlug}/changelog`) - .then((resp) => resp, () => "Error getting changelog") + .then( + (resp) => resp, + () => "Error getting changelog" + ) .then((content) => { showHassioMarkdownDialog(this, { title: "Changelog", diff --git a/hassio/src/dashboard/hassio-update.ts b/hassio/src/dashboard/hassio-update.ts index 3414c5fdf7..78fc65cc32 100644 --- a/hassio/src/dashboard/hassio-update.ts +++ b/hassio/src/dashboard/hassio-update.ts @@ -74,9 +74,7 @@ export class HassioUpdate extends LitElement { this.supervisorInfo.version, this.supervisorInfo.last_version, "hassio/supervisor/update", - `https://github.com//home-assistant/hassio/releases/tag/${ - this.supervisorInfo.last_version - }` + `https://github.com//home-assistant/hassio/releases/tag/${this.supervisorInfo.last_version}` )} ${this.hassOsInfo ? this._renderUpdateCard( @@ -84,9 +82,7 @@ export class HassioUpdate extends LitElement { this.hassOsInfo.version, this.hassOsInfo.version_latest, "hassio/hassos/update", - `https://github.com//home-assistant/hassos/releases/tag/${ - this.hassOsInfo.version_latest - }` + `https://github.com//home-assistant/hassos/releases/tag/${this.hassOsInfo.version_latest}` ) : ""} diff --git a/hassio/src/dialogs/markdown/show-dialog-hassio-markdown.ts b/hassio/src/dialogs/markdown/show-dialog-hassio-markdown.ts index c3e9713689..80cadefbd2 100644 --- a/hassio/src/dialogs/markdown/show-dialog-hassio-markdown.ts +++ b/hassio/src/dialogs/markdown/show-dialog-hassio-markdown.ts @@ -12,7 +12,9 @@ export const showHassioMarkdownDialog = ( fireEvent(element, "show-dialog", { dialogTag: "dialog-hassio-markdown", dialogImport: () => - import(/* webpackChunkName: "dialog-hassio-markdown" */ "./dialog-hassio-markdown"), + import( + /* webpackChunkName: "dialog-hassio-markdown" */ "./dialog-hassio-markdown" + ), dialogParams, }); }; diff --git a/hassio/src/dialogs/snapshot/show-dialog-hassio-snapshot.ts b/hassio/src/dialogs/snapshot/show-dialog-hassio-snapshot.ts index 0823fb9f59..478f295b7d 100644 --- a/hassio/src/dialogs/snapshot/show-dialog-hassio-snapshot.ts +++ b/hassio/src/dialogs/snapshot/show-dialog-hassio-snapshot.ts @@ -12,7 +12,9 @@ export const showHassioSnapshotDialog = ( fireEvent(element, "show-dialog", { dialogTag: "dialog-hassio-snapshot", dialogImport: () => - import(/* webpackChunkName: "dialog-hassio-snapshot" */ "./dialog-hassio-snapshot"), + import( + /* webpackChunkName: "dialog-hassio-snapshot" */ "./dialog-hassio-snapshot" + ), dialogParams, }); }; diff --git a/hassio/src/hassio-main.ts b/hassio/src/hassio-main.ts index 33bf94e573..1b1257b06c 100644 --- a/hassio/src/hassio-main.ts +++ b/hassio/src/hassio-main.ts @@ -56,12 +56,16 @@ class HassioMain extends ProvideHassLitMixin(HassRouterPage) { addon: { tag: "hassio-addon-view", load: () => - import(/* webpackChunkName: "hassio-addon-view" */ "./addon-view/hassio-addon-view"), + import( + /* webpackChunkName: "hassio-addon-view" */ "./addon-view/hassio-addon-view" + ), }, ingress: { tag: "hassio-ingress-view", load: () => - import(/* webpackChunkName: "hassio-ingress-view" */ "./ingress-view/hassio-ingress-view"), + import( + /* webpackChunkName: "hassio-ingress-view" */ "./ingress-view/hassio-ingress-view" + ), }, }, }; diff --git a/package.json b/package.json index e4133dd657..7aafc6f63f 100644 --- a/package.json +++ b/package.json @@ -105,15 +105,15 @@ "xss": "^1.0.6" }, "devDependencies": { - "@babel/core": "^7.4.0", - "@babel/plugin-external-helpers": "^7.2.0", - "@babel/plugin-proposal-class-properties": "^7.4.0", - "@babel/plugin-proposal-decorators": "^7.4.0", - "@babel/plugin-proposal-object-rest-spread": "^7.4.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/plugin-transform-react-jsx": "^7.3.0", - "@babel/preset-env": "^7.4.2", - "@babel/preset-typescript": "^7.4.0", + "@babel/core": "^7.7.4", + "@babel/plugin-external-helpers": "^7.7.4", + "@babel/plugin-proposal-class-properties": "^7.7.4", + "@babel/plugin-proposal-decorators": "^7.7.4", + "@babel/plugin-proposal-object-rest-spread": "^7.7.4", + "@babel/plugin-syntax-dynamic-import": "^7.7.4", + "@babel/plugin-transform-react-jsx": "^7.7.4", + "@babel/preset-env": "^7.7.4", + "@babel/preset-typescript": "^7.7.4", "@types/chai": "^4.1.7", "@types/chromecast-caf-receiver": "^3.0.12", "@types/chromecast-caf-sender": "^1.0.1", @@ -155,18 +155,18 @@ "merge-stream": "^1.0.1", "mocha": "^6.0.2", "parse5": "^5.1.0", - "prettier": "^1.16.4", + "prettier": "^1.19.1", "raw-loader": "^2.0.0", "reify": "^0.18.1", "require-dir": "^1.2.0", "sinon": "^7.3.1", "terser-webpack-plugin": "^1.2.3", "ts-mocha": "^6.0.0", - "tslint": "^5.14.0", + "tslint": "^5.20.1", "tslint-config-prettier": "^1.18.0", "tslint-eslint-rules": "^5.4.0", "tslint-plugin-prettier": "^2.0.1", - "typescript": "^3.6.3", + "typescript": "^3.7.2", "web-component-tester": "^6.9.2", "webpack": "^4.40.2", "webpack-cli": "^3.3.9", diff --git a/src/auth/ha-auth-flow.ts b/src/auth/ha-auth-flow.ts index afebe018be..c13df3d769 100644 --- a/src/auth/ha-auth-flow.ts +++ b/src/auth/ha-auth-flow.ts @@ -98,9 +98,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) { `; @@ -229,9 +227,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) { } private _computeStepDescription(step: DataEntryFlowStepForm) { - const resourceKey = `ui.panel.page-authorize.form.providers.${ - step.handler[0] - }.step.${step.step_id}.description`; + const resourceKey = `ui.panel.page-authorize.form.providers.${step.handler[0]}.step.${step.step_id}.description`; const args: string[] = []; const placeholders = step.description_placeholders || {}; Object.keys(placeholders).forEach((key) => { @@ -245,9 +241,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) { // Returns a callback for ha-form to calculate labels per schema object return (schema) => this.localize( - `ui.panel.page-authorize.form.providers.${step.handler[0]}.step.${ - step.step_id - }.data.${schema.name}` + `ui.panel.page-authorize.form.providers.${step.handler[0]}.step.${step.step_id}.data.${schema.name}` ); } @@ -255,9 +249,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) { // Returns a callback for ha-form to calculate error messages return (error) => this.localize( - `ui.panel.page-authorize.form.providers.${ - step.handler[0] - }.error.${error}` + `ui.panel.page-authorize.form.providers.${step.handler[0]}.error.${error}` ); } diff --git a/src/auth/ha-authorize.ts b/src/auth/ha-authorize.ts index d5ba17aa2d..e026a69bf0 100644 --- a/src/auth/ha-authorize.ts +++ b/src/auth/ha-authorize.ts @@ -11,7 +11,9 @@ import "./ha-auth-flow"; import { AuthProvider, fetchAuthProviders } from "../data/auth"; import { registerServiceWorker } from "../util/register-service-worker"; -import(/* webpackChunkName: "pick-auth-provider" */ "../auth/ha-pick-auth-provider"); +import( + /* webpackChunkName: "pick-auth-provider" */ "../auth/ha-pick-auth-provider" +); interface QueryParams { client_id?: string; diff --git a/src/common/datetime/format_date.ts b/src/common/datetime/format_date.ts index dc86b708cd..813500ff4a 100644 --- a/src/common/datetime/format_date.ts +++ b/src/common/datetime/format_date.ts @@ -10,11 +10,11 @@ function toLocaleDateStringSupportsOptions() { return false; } -export default (toLocaleDateStringSupportsOptions() +export default toLocaleDateStringSupportsOptions() ? (dateObj: Date, locales: string) => dateObj.toLocaleDateString(locales, { year: "numeric", month: "long", day: "numeric", }) - : (dateObj: Date) => fecha.format(dateObj, "mediumDate")); + : (dateObj: Date) => fecha.format(dateObj, "mediumDate"); diff --git a/src/common/datetime/format_date_time.ts b/src/common/datetime/format_date_time.ts index bbbb5520a3..e8a02139d2 100644 --- a/src/common/datetime/format_date_time.ts +++ b/src/common/datetime/format_date_time.ts @@ -10,7 +10,7 @@ function toLocaleStringSupportsOptions() { return false; } -export default (toLocaleStringSupportsOptions() +export default toLocaleStringSupportsOptions() ? (dateObj: Date, locales: string) => dateObj.toLocaleString(locales, { year: "numeric", @@ -19,4 +19,4 @@ export default (toLocaleStringSupportsOptions() hour: "numeric", minute: "2-digit", }) - : (dateObj: Date) => fecha.format(dateObj, "haDateTime")); + : (dateObj: Date) => fecha.format(dateObj, "haDateTime"); diff --git a/src/common/datetime/format_time.ts b/src/common/datetime/format_time.ts index db38b0a558..2b747723a7 100644 --- a/src/common/datetime/format_time.ts +++ b/src/common/datetime/format_time.ts @@ -10,10 +10,10 @@ function toLocaleTimeStringSupportsOptions() { return false; } -export default (toLocaleTimeStringSupportsOptions() +export default toLocaleTimeStringSupportsOptions() ? (dateObj: Date, locales: string) => dateObj.toLocaleTimeString(locales, { hour: "numeric", minute: "2-digit", }) - : (dateObj: Date) => fecha.format(dateObj, "shortTime")); + : (dateObj: Date) => fecha.format(dateObj, "shortTime"); diff --git a/src/common/dom/apply_themes_on_element.ts b/src/common/dom/apply_themes_on_element.ts index 5d5222ca7c..0e43f30bb1 100644 --- a/src/common/dom/apply_themes_on_element.ts +++ b/src/common/dom/apply_themes_on_element.ts @@ -60,7 +60,7 @@ export const applyThemesOnElement = ( element.updateStyles(styles); } else if (window.ShadyCSS) { // implement updateStyles() method of Polymer elements - window.ShadyCSS.styleSubtree(/** @type {!HTMLElement} */ (element), styles); + window.ShadyCSS.styleSubtree(/** @type {!HTMLElement} */ element, styles); } if (!updateMeta) { diff --git a/src/common/dom/setup-leaflet-map.ts b/src/common/dom/setup-leaflet-map.ts index d0532721a6..abf9008295 100644 --- a/src/common/dom/setup-leaflet-map.ts +++ b/src/common/dom/setup-leaflet-map.ts @@ -11,7 +11,9 @@ export const setupLeafletMap = async ( throw new Error("Cannot setup Leaflet map on disconnected element"); } // tslint:disable-next-line - const Leaflet = (await import(/* webpackChunkName: "leaflet" */ "leaflet")) as LeafletModuleType; + const Leaflet = (await import( + /* webpackChunkName: "leaflet" */ "leaflet" + )) as LeafletModuleType; Leaflet.Icon.Default.imagePath = "/static/images/leaflet/images/"; const map = Leaflet.map(mapElement); diff --git a/src/components/entity/ha-chart-base.js b/src/components/entity/ha-chart-base.js index 2621feee3e..37eea60bea 100644 --- a/src/components/entity/ha-chart-base.js +++ b/src/components/entity/ha-chart-base.js @@ -215,7 +215,9 @@ class HaChartBase extends mixinBehaviors( } if (scriptsLoaded === null) { - scriptsLoaded = import(/* webpackChunkName: "load_chart" */ "../../resources/ha-chart-scripts.js"); + scriptsLoaded = import( + /* webpackChunkName: "load_chart" */ "../../resources/ha-chart-scripts.js" + ); } scriptsLoaded.then((ChartModule) => { this.ChartClass = ChartModule.default; diff --git a/src/components/ha-camera-stream.ts b/src/components/ha-camera-stream.ts index e91b63cf8b..1faea13c46 100644 --- a/src/components/ha-camera-stream.ts +++ b/src/components/ha-camera-stream.ts @@ -122,8 +122,9 @@ class HaCameraStream extends LitElement { private async _startHls(): Promise { // tslint:disable-next-line - const Hls = ((await import(/* webpackChunkName: "hls.js" */ "hls.js")) as any) - .default as HLSModule; + const Hls = ((await import( + /* webpackChunkName: "hls.js" */ "hls.js" + )) as any).default as HLSModule; let hlsSupported = Hls.isSupported(); const videoEl = this._videoEl; diff --git a/src/components/ha-climate-state.js b/src/components/ha-climate-state.js index 569014fcc8..9586157d48 100644 --- a/src/components/ha-climate-state.js +++ b/src/components/ha-climate-state.js @@ -72,9 +72,7 @@ class HaClimateState extends LocalizeMixin(PolymerElement) { computeCurrentStatus(hass, stateObj) { if (!hass || !stateObj) return null; if (stateObj.attributes.current_temperature != null) { - return `${stateObj.attributes.current_temperature} ${ - hass.config.unit_system.temperature - }`; + return `${stateObj.attributes.current_temperature} ${hass.config.unit_system.temperature}`; } if (stateObj.attributes.current_humidity != null) { return `${stateObj.attributes.current_humidity} %`; @@ -89,22 +87,16 @@ class HaClimateState extends LocalizeMixin(PolymerElement) { stateObj.attributes.target_temp_low != null && stateObj.attributes.target_temp_high != null ) { - return `${stateObj.attributes.target_temp_low}-${ - stateObj.attributes.target_temp_high - } ${hass.config.unit_system.temperature}`; + return `${stateObj.attributes.target_temp_low}-${stateObj.attributes.target_temp_high} ${hass.config.unit_system.temperature}`; } if (stateObj.attributes.temperature != null) { - return `${stateObj.attributes.temperature} ${ - hass.config.unit_system.temperature - }`; + return `${stateObj.attributes.temperature} ${hass.config.unit_system.temperature}`; } if ( stateObj.attributes.target_humidity_low != null && stateObj.attributes.target_humidity_high != null ) { - return `${stateObj.attributes.target_humidity_low}-${ - stateObj.attributes.target_humidity_high - }%`; + return `${stateObj.attributes.target_humidity_low}-${stateObj.attributes.target_humidity_high}%`; } if (stateObj.attributes.humidity != null) { return `${stateObj.attributes.humidity} %`; @@ -121,9 +113,7 @@ class HaClimateState extends LocalizeMixin(PolymerElement) { const stateString = localize(`state.climate.${stateObj.state}`); return stateObj.attributes.hvac_action ? `${localize( - `state_attributes.climate.hvac_action.${ - stateObj.attributes.hvac_action - }` + `state_attributes.climate.hvac_action.${stateObj.attributes.hvac_action}` )} (${stateString})` : stateString; } diff --git a/src/components/ha-water_heater-state.js b/src/components/ha-water_heater-state.js index 42e8f09669..82c523614e 100644 --- a/src/components/ha-water_heater-state.js +++ b/src/components/ha-water_heater-state.js @@ -58,14 +58,10 @@ class HaWaterHeaterState extends LocalizeMixin(PolymerElement) { stateObj.attributes.target_temp_low != null && stateObj.attributes.target_temp_high != null ) { - return `${stateObj.attributes.target_temp_low} - ${ - stateObj.attributes.target_temp_high - } ${hass.config.unit_system.temperature}`; + return `${stateObj.attributes.target_temp_low} - ${stateObj.attributes.target_temp_high} ${hass.config.unit_system.temperature}`; } if (stateObj.attributes.temperature != null) { - return `${stateObj.attributes.temperature} ${ - hass.config.unit_system.temperature - }`; + return `${stateObj.attributes.temperature} ${hass.config.unit_system.temperature}`; } return ""; diff --git a/src/data/camera.ts b/src/data/camera.ts index 94c5853ee5..6118745cf6 100644 --- a/src/data/camera.ts +++ b/src/data/camera.ts @@ -19,9 +19,7 @@ export interface Stream { } export const computeMJPEGStreamUrl = (entity: CameraEntity) => - `/api/camera_proxy_stream/${entity.entity_id}?token=${ - entity.attributes.access_token - }`; + `/api/camera_proxy_stream/${entity.entity_id}?token=${entity.attributes.access_token}`; export const fetchThumbnailUrlWithCache = ( hass: HomeAssistant, diff --git a/src/data/conversation.ts b/src/data/conversation.ts index 4a4c629d92..6f57fe5cb2 100644 --- a/src/data/conversation.ts +++ b/src/data/conversation.ts @@ -3,7 +3,7 @@ import { HomeAssistant } from "../types"; interface ProcessResults { card: { [key: string]: { [key: string]: string } }; speech: { - [SpeechType in "plain" | "ssml"]: { extra_data: any; speech: string } + [SpeechType in "plain" | "ssml"]: { extra_data: any; speech: string }; }; } diff --git a/src/data/device_automation.ts b/src/data/device_automation.ts index 58be904d62..2653171643 100644 --- a/src/data/device_automation.ts +++ b/src/data/device_automation.ts @@ -107,9 +107,7 @@ export const localizeDeviceAutomationAction = ( state ? computeStateName(state) : "", "subtype", hass.localize( - `component.${action.domain}.device_automation.action_subtype.${ - action.subtype - }` + `component.${action.domain}.device_automation.action_subtype.${action.subtype}` ) ); }; @@ -122,16 +120,12 @@ export const localizeDeviceAutomationCondition = ( ? hass.states[condition.entity_id] : undefined; return hass.localize( - `component.${condition.domain}.device_automation.condition_type.${ - condition.type - }`, + `component.${condition.domain}.device_automation.condition_type.${condition.type}`, "entity_name", state ? computeStateName(state) : "", "subtype", hass.localize( - `component.${condition.domain}.device_automation.condition_subtype.${ - condition.subtype - }` + `component.${condition.domain}.device_automation.condition_subtype.${condition.subtype}` ) ); }; @@ -142,16 +136,12 @@ export const localizeDeviceAutomationTrigger = ( ) => { const state = trigger.entity_id ? hass.states[trigger.entity_id] : undefined; return hass.localize( - `component.${trigger.domain}.device_automation.trigger_type.${ - trigger.type - }`, + `component.${trigger.domain}.device_automation.trigger_type.${trigger.type}`, "entity_name", state ? computeStateName(state) : "", "subtype", hass.localize( - `component.${trigger.domain}.device_automation.trigger_subtype.${ - trigger.subtype - }` + `component.${trigger.domain}.device_automation.trigger_subtype.${trigger.subtype}` ) ); }; diff --git a/src/data/hassio.ts b/src/data/hassio.ts index f041fc992a..46cbf64515 100644 --- a/src/data/hassio.ts +++ b/src/data/hassio.ts @@ -149,9 +149,7 @@ export const createHassioSession = async (hass: HomeAssistant) => { "POST", "hassio/ingress/session" ); - document.cookie = `ingress_session=${ - response.data.session - };path=/api/hassio_ingress/`; + document.cookie = `ingress_session=${response.data.session};path=/api/hassio_ingress/`; }; export const reloadHassioAddons = (hass: HomeAssistant) => diff --git a/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts b/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts index 2950d4c61a..a8c987d216 100644 --- a/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts +++ b/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts @@ -98,9 +98,7 @@ class DialogConfigEntrySystemOptions extends LitElement { "ui.dialogs.config_entry_system_options.enable_new_entities_description", "integration", this.hass.localize( - `component.${ - this._params.entry.domain - }.config.title` + `component.${this._params.entry.domain}.config.title` ) || this._params.entry.domain )}