Fix promise constructors with returns (#15486)
This commit is contained in:
parent
05f2fb896c
commit
7adb49c772
|
@ -59,7 +59,6 @@
|
|||
"prefer-destructuring": "off",
|
||||
"no-restricted-globals": [2, "event"],
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"no-promise-executor-return": "warn",
|
||||
"no-unsafe-optional-chaining": "warn",
|
||||
"prefer-regex-literals": ["warn"],
|
||||
"import/prefer-default-export": "off",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import "@lit-labs/virtualizer";
|
||||
import { mdiArrowDown, mdiArrowUp } from "@mdi/js";
|
||||
import deepClone from "deep-clone-simple";
|
||||
import {
|
||||
|
@ -21,16 +22,15 @@ import { styleMap } from "lit/directives/style-map";
|
|||
import memoizeOne from "memoize-one";
|
||||
import { restoreScroll } from "../../common/decorators/restore-scroll";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
import "../search-input";
|
||||
import { debounce } from "../../common/util/debounce";
|
||||
import { nextRender } from "../../common/util/render-status";
|
||||
import { haStyleScrollbar } from "../../resources/styles";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import "../ha-checkbox";
|
||||
import type { HaCheckbox } from "../ha-checkbox";
|
||||
import "../ha-svg-icon";
|
||||
import "../search-input";
|
||||
import { filterData, sortData } from "./sort-filter";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import "@lit-labs/virtualizer";
|
||||
|
||||
declare global {
|
||||
// for fire event
|
||||
|
@ -461,7 +461,9 @@ export class HaDataTable extends LitElement {
|
|||
const elapsed = curTime - startTime;
|
||||
|
||||
if (elapsed < 100) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100 - elapsed));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 100 - elapsed);
|
||||
});
|
||||
}
|
||||
if (this.curRequest !== curRequest) {
|
||||
return;
|
||||
|
|
|
@ -282,7 +282,9 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
|
|||
|
||||
private async _navigateAwayClose() {
|
||||
// allow new page to open before closing dialog
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 0);
|
||||
});
|
||||
fireEvent(this, "close-dialog");
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,9 @@ export const checkForEntityUpdates = async (
|
|||
});
|
||||
|
||||
// there is no reliable way to know if all the updates are done updating, so we just wait a bit for now...
|
||||
await new Promise((r) => setTimeout(r, 10000));
|
||||
await new Promise((r) => {
|
||||
setTimeout(r, 10000);
|
||||
});
|
||||
|
||||
unsubscribeEvents();
|
||||
|
||||
|
|
|
@ -467,7 +467,9 @@ class MoreInfoClimate extends LitElement {
|
|||
// We reset stateObj to re-sync the inputs with the state. It will be out
|
||||
// of sync if our service call did not result in the entity to be turned
|
||||
// on. Since the state is not changing, the resync is not called automatic.
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 2000);
|
||||
});
|
||||
|
||||
// No need to resync if we received a new state.
|
||||
if (this.stateObj !== curState) {
|
||||
|
|
|
@ -147,7 +147,9 @@ class MoreInfoHumidifier extends LitElement {
|
|||
// We reset stateObj to re-sync the inputs with the state. It will be out
|
||||
// of sync if our service call did not result in the entity to be turned
|
||||
// on. Since the state is not changing, the resync is not called automatic.
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 2000);
|
||||
});
|
||||
|
||||
// No need to resync if we received a new state.
|
||||
if (this.stateObj !== curState) {
|
||||
|
|
|
@ -323,7 +323,9 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
|||
// Load config strings for integrations
|
||||
(this as any)._loadFragmentTranslations(this.hass!.language, "config");
|
||||
// Make sure hass is initialized + the config/user callbacks have called.
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -315,7 +315,9 @@ export class HuiDialogEditCard
|
|||
|
||||
private async _confirmCancel() {
|
||||
// Make sure the open state of this dialog is handled before the open state of confirm dialog
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 0);
|
||||
});
|
||||
const confirm = await showConfirmationDialog(this, {
|
||||
title: this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.unsaved_changes"
|
||||
|
|
|
@ -162,7 +162,9 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) {
|
|||
<div class="controls-progress">
|
||||
${until(
|
||||
// Only show spinner after 500ms
|
||||
new Promise((resolve) => setTimeout(resolve, 500)).then(
|
||||
new Promise((resolve) => {
|
||||
setTimeout(resolve, 500);
|
||||
}).then(
|
||||
() => html`<ha-circular-progress active></ha-circular-progress>`
|
||||
)
|
||||
)}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { atLeastVersion } from "../common/config/version";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { computeLocalize, LocalizeFunc } from "../common/translations/localize";
|
||||
import {
|
||||
computeRTLDirection,
|
||||
|
@ -16,14 +17,13 @@ import {
|
|||
} from "../data/translation";
|
||||
import { translationMetadata } from "../resources/translations-metadata";
|
||||
import { Constructor, HomeAssistant } from "../types";
|
||||
import { storeState } from "../util/ha-pref-storage";
|
||||
import {
|
||||
getLocalLanguage,
|
||||
getTranslation,
|
||||
getUserLocale,
|
||||
} from "../util/common-translation";
|
||||
import { storeState } from "../util/ha-pref-storage";
|
||||
import { HassBaseEl } from "./hass-base-mixin";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
|
||||
declare global {
|
||||
// for fire event
|
||||
|
@ -373,7 +373,9 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
|
|||
// overwritten when we call _updateHass the second time!
|
||||
|
||||
// Allow hass to be updated
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 0);
|
||||
});
|
||||
|
||||
if (language !== (this.hass ?? this._pendingHass).language) {
|
||||
// the language was changed, abort
|
||||
|
|
Loading…
Reference in New Issue