From 7568ae5964a28c123a38a2eda79705a628961d11 Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Mon, 27 Feb 2023 04:11:44 -0500 Subject: [PATCH] Fix unsafe optional chaining (#15604) --- .eslintrc.json | 1 - .../integration-panels/zha/dialog-zha-reconfigure-device.ts | 2 +- src/panels/lovelace/cards/hui-gauge-card.ts | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 54c0a23818..5680879b3c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -59,7 +59,6 @@ "prefer-destructuring": "off", "no-restricted-globals": [2, "event"], "prefer-promise-reject-errors": "off", - "no-unsafe-optional-chaining": "warn", "import/prefer-default-export": "off", "import/no-default-export": "off", "import/no-unresolved": "off", 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 4c43266385..92d1d5840b 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 @@ -72,7 +72,7 @@ class DialogZHAReconfigureDevice extends LitElement { this.hass, this.hass.localize(`ui.dialogs.zha_reconfigure_device.heading`) + ": " + - (this._params?.device.user_given_name || this._params?.device.name) + (this._params.device.user_given_name || this._params.device.name) )} > ${!this._status diff --git a/src/panels/lovelace/cards/hui-gauge-card.ts b/src/panels/lovelace/cards/hui-gauge-card.ts index 975cea74d3..1da6503756 100644 --- a/src/panels/lovelace/cards/hui-gauge-card.ts +++ b/src/panels/lovelace/cards/hui-gauge-card.ts @@ -183,7 +183,7 @@ class HuiGaugeCard extends LitElement implements LovelaceCard { // new format let segments = this._config!.segments; if (segments) { - segments = [...segments].sort((a, b) => a?.from - b?.from); + segments = [...segments].sort((a, b) => a.from - b.from); for (let i = 0; i < segments.length; i++) { const segment = segments[i];