Results of running ts-prune.

This commit is contained in:
Dermot Duffy
2023-01-30 21:11:21 -08:00
parent f3149d2ff3
commit a9074bd44e
27 changed files with 116 additions and 161 deletions
+1
View File
@@ -10,6 +10,7 @@ export const log = (cardWideConfig?: CardWideConfig, ...args: unknown[]) => {
* For debug purposes only.
* @param seconds
*/
// ts-prune-ignore-next
export const sleep = async (seconds: number) => {
await new Promise((r) => setTimeout(r, seconds * 1000));
};
+1 -1
View File
@@ -7,7 +7,7 @@ const deviceSchema = z.object({
config_entries: z.string().array(),
manufacturer: z.string().nullable(),
})
export const deviceListSchema = deviceSchema.array();
const deviceListSchema = deviceSchema.array();
export type DeviceList = z.infer<typeof deviceListSchema>;
/**
+1 -1
View File
@@ -205,7 +205,7 @@ function computeStyle(state: HassEntity): StyleInfo {
* @param stateObj The HassEntity object from `hass.states`.
* @returns A string state, e.g. 'on'.
*/
export const computeActiveState = (stateObj: HassEntity): string => {
const computeActiveState = (stateObj: HassEntity): string => {
const domain = stateObj.entity_id.split('.')[0];
let state = stateObj.state;
+2 -6
View File
@@ -4,11 +4,7 @@ import {
HassEntityBase
} from 'home-assistant-js-websocket';
export const UPDATE_SUPPORT_INSTALL = 1;
export const UPDATE_SUPPORT_SPECIFIC_VERSION = 2;
export const UPDATE_SUPPORT_PROGRESS = 4;
export const UPDATE_SUPPORT_BACKUP = 8;
export const UPDATE_SUPPORT_RELEASE_NOTES = 16;
const UPDATE_SUPPORT_PROGRESS = 4;
interface UpdateEntityAttributes extends HassEntityAttributeBase {
auto_update: boolean | null;
@@ -28,7 +24,7 @@ export interface UpdateEntity extends HassEntityBase {
export const supportsFeature = (stateObj: HassEntity, feature: number): boolean =>
((stateObj.attributes.supported_features ?? 0) & feature) !== 0;
export const updateUsesProgress = (entity: UpdateEntity): boolean =>
const updateUsesProgress = (entity: UpdateEntity): boolean =>
supportsFeature(entity, UPDATE_SUPPORT_PROGRESS) &&
typeof entity.attributes.in_progress === 'number';
-19
View File
@@ -21,22 +21,3 @@ export const alarmPanelIcon = (state?: string) => {
return 'mdi:shield';
}
};
export const alarmPanelIconAction = (state?: string) => {
switch (state) {
case 'armed_away':
return 'mdi:shield-lock-outline';
case 'armed_vacation':
return 'mdi:shield-airplane-outline';
case 'armed_home':
return 'mdi:shield-home-outline';
case 'armed_night':
return 'mdi:shield-moon-outline';
case 'armed_custom_bypass':
return 'mdi:shield-half-full';
case 'disarmed':
return 'mdi:shield-off-outline';
default:
return 'mdi:shield-outline';
}
};
-24
View File
@@ -87,27 +87,3 @@ export const coverIcon = (state?: string, entity?: HassEntity): string => {
return 'mdi:window-open';
}
};
export const computeOpenIcon = (stateObj: HassEntity): string => {
switch (stateObj.attributes.device_class) {
case 'awning':
case 'curtain':
case 'door':
case 'gate':
return 'mdi:arrow-expand-horizontal';
default:
return 'mdi:arrow-up';
}
};
export const computeCloseIcon = (stateObj: HassEntity): string => {
switch (stateObj.attributes.device_class) {
case 'awning':
case 'curtain':
case 'door':
case 'gate':
return 'mdi:arrow-collapse-horizontal';
default:
return 'mdi:arrow-down';
}
};
+1 -1
View File
@@ -70,7 +70,7 @@ const batteryStateIcon = (
return batteryIcon(battery, batteryCharging);
};
export const batteryIcon = (
const batteryIcon = (
batteryState: number | string,
batteryCharging?: boolean,
) => {
+1 -1
View File
@@ -2,7 +2,7 @@
// to give a cleaner UI appearance, see:
// https://github.com/dermotduffy/frigate-hass-card/issues/856
export const MEDIA_LOAD_CONTROLS_HIDE_SECONDS = 2;
export const MEDIA_SEEK_CONTROLS_HIDE_SECONDS = 1;
const MEDIA_SEEK_CONTROLS_HIDE_SECONDS = 1;
/**
* Temporarily hide media controls.
+1 -1
View File
@@ -8,7 +8,7 @@ import { HomeAssistant } from 'custom-card-helpers';
* @param thumbnailURL The thumbnail URL.
* @returns A base64 encoded data URL for the thumbnail.
*/
export const fetchThumbnail = async (
const fetchThumbnail = async (
hass: HomeAssistant,
thumbnailURL: string,
): Promise<string | null> => {