chore: Enforce consistent type imports via @typescript-eslint/consistent-type-imports (#2545)
This commit is contained in:
committed by
dermotduffy
parent
8f4ebcc0de
commit
7dc29865b8
@@ -1,8 +1,8 @@
|
||||
import { isTruthy } from '../../utils/basic';
|
||||
import { ViewItem, ViewMedia, ViewMediaSourceOptions } from '../../view/item';
|
||||
import type { ViewItem, ViewMedia, ViewMediaSourceOptions } from '../../view/item';
|
||||
import { ViewItemClassifier } from '../../view/item-classifier';
|
||||
import { BrowseMediaViewItemFactory } from './item-factory';
|
||||
import { BrowseMediaMetadata, RichBrowseMedia } from './types';
|
||||
import type { BrowseMediaMetadata, RichBrowseMedia } from './types';
|
||||
|
||||
export const getViewMediaFromBrowseMediaArray = (
|
||||
browseMedia: RichBrowseMedia<BrowseMediaMetadata>[],
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import { ViewItem, ViewMediaSourceOptions, ViewMediaType } from '../../view/item';
|
||||
import {
|
||||
ViewMediaType,
|
||||
type ViewItem,
|
||||
type ViewMediaSourceOptions,
|
||||
} from '../../view/item';
|
||||
import { BrowseMediaEventViewMedia, BrowseMediaViewFolder } from './item';
|
||||
import {
|
||||
BrowseMediaMetadata,
|
||||
MEDIA_CLASS_IMAGE,
|
||||
MEDIA_CLASS_VIDEO,
|
||||
RichBrowseMedia,
|
||||
type BrowseMediaMetadata,
|
||||
type RichBrowseMedia,
|
||||
} from './types';
|
||||
|
||||
export class BrowseMediaViewItemFactory {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { format } from 'date-fns';
|
||||
import { isEqual } from 'lodash-es';
|
||||
|
||||
import { FolderPathComponent } from '../../card-controller/folders/types';
|
||||
import { FolderConfig } from '../../config/schema/folders';
|
||||
import type { FolderPathComponent } from '../../card-controller/folders/types';
|
||||
import type { FolderConfig } from '../../config/schema/folders';
|
||||
import { formatDateAndTime } from '../../utils/basic';
|
||||
import {
|
||||
EventViewMedia,
|
||||
ViewFolder,
|
||||
ViewMedia,
|
||||
ViewMediaSourceOptions,
|
||||
ViewMediaType,
|
||||
type EventViewMedia,
|
||||
type ViewMediaSourceOptions,
|
||||
type ViewMediaType,
|
||||
} from '../../view/item';
|
||||
import { BrowseMediaMetadata, RichBrowseMedia } from './types';
|
||||
import type { BrowseMediaMetadata, RichBrowseMedia } from './types';
|
||||
|
||||
interface MediaClassBrowserSetting {
|
||||
icon: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { orderBy } from 'lodash-es';
|
||||
|
||||
import { BrowseMediaMetadata, RichBrowseMedia } from './types';
|
||||
import type { BrowseMediaMetadata, RichBrowseMedia } from './types';
|
||||
|
||||
// Unlike sorting of view items (see card-controller/view/sort.ts), for browse
|
||||
// media we often need to sort by most recent first to apply an item count
|
||||
|
||||
@@ -2,14 +2,14 @@ import { add } from 'date-fns';
|
||||
import { chunk } from 'lodash-es';
|
||||
|
||||
import { allPromises } from '../../utils/basic';
|
||||
import { HomeAssistant } from '../types';
|
||||
import type { HomeAssistant } from '../types';
|
||||
import { homeAssistantWSRequest } from '../ws-request';
|
||||
import {
|
||||
BROWSE_MEDIA_CACHE_SECONDS,
|
||||
BrowseMedia,
|
||||
BrowseMediaCache,
|
||||
browseMediaSchema,
|
||||
RichBrowseMedia,
|
||||
type BrowseMedia,
|
||||
type BrowseMediaCache,
|
||||
type RichBrowseMedia,
|
||||
} from './types';
|
||||
|
||||
type RichMetadataGenerator<M> = (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { rangesOverlap } from '../../camera-manager/range';
|
||||
import { BrowseMediaMetadata, RichBrowseMedia } from './types';
|
||||
import type { BrowseMediaMetadata, RichBrowseMedia } from './types';
|
||||
|
||||
/**
|
||||
* A utility method to determine if a browse media object matches against a
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { isHARelativeURL } from './is-ha-relative-url';
|
||||
import { HomeAssistant } from './types';
|
||||
import type { HomeAssistant } from './types';
|
||||
|
||||
/**
|
||||
* Ensure URLs use the correct HA URL (relevant for Chromecast where the default
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RecoverableHealthInterface, UnlistenCallback } from '../../health';
|
||||
import { HASSWebSocketSubscriptionStatus } from './subscription-manager';
|
||||
import type { RecoverableHealthInterface, UnlistenCallback } from '../../health';
|
||||
import type { HASSWebSocketSubscriptionStatus } from './subscription-manager';
|
||||
|
||||
// One keyed subscription that is currently failing, with the most recent
|
||||
// rejection reason and attempt count.
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Connection } from 'home-assistant-js-websocket';
|
||||
import type { Connection } from 'home-assistant-js-websocket';
|
||||
|
||||
import {
|
||||
GetKeyCallback,
|
||||
KeyedSubscriptionManager,
|
||||
type GetKeyCallback,
|
||||
} from '../../utils/concurrency/keyed-subscription-manager';
|
||||
import { RetryTimer } from '../../utils/retry-timer';
|
||||
import { isHassReady } from '../is-hass-ready';
|
||||
import { HASSSource, HASSUnlistenCallback } from '../source';
|
||||
import { HomeAssistant } from '../types';
|
||||
import { HASSWebSocketLiveness, HASSWebSocketOpenCallback } from './types';
|
||||
import type { HASSSource, HASSUnlistenCallback } from '../source';
|
||||
import type { HomeAssistant } from '../types';
|
||||
import type { HASSWebSocketLiveness, HASSWebSocketOpenCallback } from './types';
|
||||
|
||||
const RETRY_BASE_SECONDS = 1;
|
||||
const RETRY_MAX_SECONDS = 300;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Connection } from 'home-assistant-js-websocket';
|
||||
import type { Connection } from 'home-assistant-js-websocket';
|
||||
|
||||
/**
|
||||
* Types describing the caller-supplied callbacks for opening and closing a
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { Endpoint } from '../types';
|
||||
import type { Endpoint } from '../types';
|
||||
import { canonicalizeHAURL } from './canonical-url';
|
||||
import { ResolvedMediaCache, resolveMedia } from './resolved-media';
|
||||
import { HomeAssistant } from './types';
|
||||
import { resolveMedia, type ResolvedMediaCache } from './resolved-media';
|
||||
import type { HomeAssistant } from './types';
|
||||
|
||||
export const getMediaDownloadPath = async (
|
||||
hass: HomeAssistant,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { HassEntity } from 'home-assistant-js-websocket';
|
||||
import type { HassEntity } from 'home-assistant-js-websocket';
|
||||
|
||||
import { computeDomain } from './compute-domain.js';
|
||||
import { Entity } from './registry/entity/types.js';
|
||||
import { HomeAssistant } from './types.js';
|
||||
import type { Entity } from './registry/entity/types.js';
|
||||
import type { HomeAssistant } from './types.js';
|
||||
|
||||
/**
|
||||
* Get the translation of an entity state. Inspired by:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { HassEventBase } from 'home-assistant-js-websocket';
|
||||
import type { HassEventBase } from 'home-assistant-js-websocket';
|
||||
import { isEqualWith } from 'lodash-es';
|
||||
|
||||
import { HAEventContextFilter } from '../config/schema/common/ha-event';
|
||||
import type { HAEventContextFilter } from '../config/schema/common/ha-event';
|
||||
import { isRecord } from '../utils/basic';
|
||||
|
||||
// A plain object (HA/Python `dict`), excluding arrays -- the distinction HA's
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
import { ZodSchema } from 'zod';
|
||||
import type { ZodSchema } from 'zod';
|
||||
|
||||
import { localize } from '../localize/localize';
|
||||
import { AdvancedCameraCardError, Endpoint } from '../types';
|
||||
import { AdvancedCameraCardError, type Endpoint } from '../types';
|
||||
import { homeAssistantGetSignedURLIfNecessary } from './sign-path';
|
||||
import { HomeAssistant } from './types';
|
||||
import type { HomeAssistant } from './types';
|
||||
|
||||
/**
|
||||
* Fetch a JSON response from a signed or unsigned endpoint and validate it
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ValidHassDomEvent } from './types';
|
||||
import type { ValidHassDomEvent } from './types';
|
||||
|
||||
/**
|
||||
* Fire an event has per Home Assistant frontend specifications. All events
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HomeAssistant } from './types';
|
||||
import type { HomeAssistant } from './types';
|
||||
|
||||
/**
|
||||
* Get entities from the HASS object.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HomeAssistant } from './types';
|
||||
import type { HomeAssistant } from './types';
|
||||
|
||||
/**
|
||||
* Get the title of an entity.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { HassEntity } from 'home-assistant-js-websocket';
|
||||
import type { HassEntity } from 'home-assistant-js-websocket';
|
||||
|
||||
import { HassStateDifference, HomeAssistant } from './types';
|
||||
import type { HassStateDifference, HomeAssistant } from './types';
|
||||
|
||||
/**
|
||||
* Get the difference between two hass objects.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { computeDomain } from './compute-domain';
|
||||
import { isTriggeredState } from './is-triggered-state';
|
||||
import { HassStateDifference } from './types';
|
||||
import type { HassStateDifference } from './types';
|
||||
|
||||
// New state must be a real timestamp: `unavailable` means the entity went
|
||||
// offline, `unknown` means it has no recorded fire -- neither is a fresh fire.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { HomeAssistant } from '../types.js';
|
||||
import type { HomeAssistant } from '../types.js';
|
||||
import { homeAssistantWSRequest } from '../ws-request.js';
|
||||
import { IntegrationManifest, integrationManifestSchema } from './types.js';
|
||||
import { integrationManifestSchema, type IntegrationManifest } from './types.js';
|
||||
|
||||
export const getIntegrationManifest = async (
|
||||
hass: HomeAssistant,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getHassDifferences } from './get-hass-differences';
|
||||
import { HomeAssistant } from './types';
|
||||
import type { HomeAssistant } from './types';
|
||||
|
||||
/**
|
||||
* Determine if two hass objects are different for a list of entities.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { STATE_RUNNING } from 'home-assistant-js-websocket';
|
||||
|
||||
import { HomeAssistant } from './types';
|
||||
import type { HomeAssistant } from './types';
|
||||
|
||||
// HA is "ready" when the WebSocket is connected AND integrations have finished
|
||||
// loading (`config.state === STATE_RUNNING`). HA exposes the WebSocket before
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { errorToConsole } from '../../../utils/basic';
|
||||
import { HomeAssistant } from '../../types';
|
||||
import type { HomeAssistant } from '../../types';
|
||||
import { homeAssistantWSRequest } from '../../ws-request';
|
||||
import { Device, DeviceCache, DeviceList, deviceListSchema } from './types';
|
||||
import {
|
||||
deviceListSchema,
|
||||
type Device,
|
||||
type DeviceCache,
|
||||
type DeviceList,
|
||||
} from './types';
|
||||
|
||||
export class DeviceRegistryManager {
|
||||
private _cache: DeviceCache;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { errorToConsole } from '../../../utils/basic.js';
|
||||
import { HomeAssistant } from '../../types.js';
|
||||
import type { HomeAssistant } from '../../types.js';
|
||||
import { homeAssistantWSRequest } from '../../ws-request.js';
|
||||
import {
|
||||
Entity,
|
||||
EntityCache,
|
||||
EntityList,
|
||||
entityListSchema,
|
||||
EntityRegistryManager,
|
||||
entitySchema,
|
||||
type Entity,
|
||||
type EntityCache,
|
||||
type EntityList,
|
||||
type EntityRegistryManager,
|
||||
} from './types.js';
|
||||
|
||||
// This class manages interactions with entities, caching results and fetching
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { Cache } from '../../../cache/cache';
|
||||
import { HomeAssistant } from '../../types';
|
||||
import type { HomeAssistant } from '../../types';
|
||||
|
||||
export const entitySchema = z.object({
|
||||
config_entry_id: z.string().nullable(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { LRUCache } from '../cache/lru';
|
||||
import { errorToConsole } from '../utils/basic';
|
||||
import { HomeAssistant, ResolvedMedia, resolvedMediaSchema } from './types';
|
||||
import { resolvedMediaSchema, type HomeAssistant, type ResolvedMedia } from './types';
|
||||
import { homeAssistantWSRequest } from './ws-request';
|
||||
|
||||
// It's important the cache size be at least as large as the largest likely
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { localize } from '../localize/localize';
|
||||
import { AdvancedCameraCardError, CardHelpers, LovelaceCardWithEditor } from '../types';
|
||||
import {
|
||||
AdvancedCameraCardError,
|
||||
type CardHelpers,
|
||||
type LovelaceCardWithEditor,
|
||||
} from '../types';
|
||||
|
||||
class HomeAssistantElementsLoadError extends AdvancedCameraCardError {
|
||||
constructor() {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { SignedPath, signedPathSchema, type Endpoint } from '../types';
|
||||
import { HomeAssistant } from './types';
|
||||
import { signedPathSchema, type Endpoint, type SignedPath } from '../types';
|
||||
import type { HomeAssistant } from './types';
|
||||
import { homeAssistantWSRequest } from './ws-request';
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { HomeAssistant } from './types';
|
||||
import type { HomeAssistant } from './types';
|
||||
|
||||
/**
|
||||
* `HASSSource` is the observer-pattern API that `HASSManager` exposes for any
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HassEntity } from 'home-assistant-js-websocket';
|
||||
import type { HassEntity } from 'home-assistant-js-websocket';
|
||||
|
||||
/**
|
||||
* Determine if a state object supports a given feature.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
Auth,
|
||||
Connection,
|
||||
HassConfig,
|
||||
|
||||
+6
-3
@@ -1,6 +1,9 @@
|
||||
import { EnabledProxyConfig, ResolvedProxyConfig } from '../config/schema/common/proxy';
|
||||
import { Endpoint } from '../types';
|
||||
import { HomeAssistant } from './types';
|
||||
import type {
|
||||
EnabledProxyConfig,
|
||||
ResolvedProxyConfig,
|
||||
} from '../config/schema/common/proxy';
|
||||
import type { Endpoint } from '../types';
|
||||
import type { HomeAssistant } from './types';
|
||||
|
||||
export const HASS_WEB_PROXY_DOMAIN = 'hass_web_proxy';
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { MessageBase } from 'home-assistant-js-websocket';
|
||||
import { ZodSchema } from 'zod';
|
||||
import type { MessageBase } from 'home-assistant-js-websocket';
|
||||
import type { ZodSchema } from 'zod';
|
||||
|
||||
import { localize } from '../localize/localize';
|
||||
import { AdvancedCameraCardError } from '../types';
|
||||
import { HomeAssistant } from './types';
|
||||
import type { HomeAssistant } from './types';
|
||||
|
||||
/**
|
||||
* Make a HomeAssistant websocket request. May throw.
|
||||
|
||||
Reference in New Issue
Block a user