From af2de2cc10091134fd68866eff97e70b387db4f6 Mon Sep 17 00:00:00 2001 From: Josh Willox Date: Tue, 14 Feb 2023 23:19:13 +1100 Subject: [PATCH] refactor: reformat and sort imports --- README.md | 36 +++++++++++++++---------------- hacs.json | 2 +- info.md | 36 +++++++++++++++++-------------- src/canary-card.ts | 8 +++---- src/const.ts | 4 ++-- src/main.ts | 2 +- src/modules/generic-card.ts | 8 +++---- src/modules/generic-entity-row.ts | 10 ++++----- src/modules/glance-card.ts | 2 +- src/modules/vertical-stack.ts | 4 ++-- src/modules/warning.ts | 2 +- src/secondary-info.ts | 4 ++-- src/types.ts | 2 +- 13 files changed, 62 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index 208f3f0c..bac64b8f 100644 --- a/README.md +++ b/README.md @@ -13,24 +13,24 @@ This plugin could be thought of as almost a staging ground for features that if Much like [card-mod] Canary extends the default lovelace cards, so you don't need to actually define a `canary-card` for these options to work. The options are added to their respective cards as 'extensions'. -### Available Extensions - -* [Generic Entity Row](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row) - * [`secondary_info`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#secondary_info) - * [`canary_style`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#canary_style) - * [`canary_theme`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#canary_theme) - * [`hide_warning`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#hide_warning) -* [Generic Card](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card) - * [`no_card`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#no_card) - * [`canary_style`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#canary_style) - * [`canary_theme`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#canary_theme) -* [Glance Card](https://github.com/jcwillox/lovelace-canary/wiki/Glance-Card) - * [`align`](https://github.com/jcwillox/lovelace-canary/wiki/Glance-Card#align) -* [Vertical Stack](https://github.com/jcwillox/lovelace-canary/wiki/Vertical-Stack) - * [`in_card`](https://github.com/jcwillox/lovelace-canary/wiki/Vertical-Stack#in_card) -* [Canary Card](https://github.com/jcwillox/lovelace-canary/wiki/Canary-Card) - * `style` - * `theme` +### Available Extensions + +- [Generic Entity Row](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row) + - [`secondary_info`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#secondary_info) + - [`canary_style`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#canary_style) + - [`canary_theme`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#canary_theme) + - [`hide_warning`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#hide_warning) +- [Generic Card](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card) + - [`no_card`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#no_card) + - [`canary_style`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#canary_style) + - [`canary_theme`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#canary_theme) +- [Glance Card](https://github.com/jcwillox/lovelace-canary/wiki/Glance-Card) + - [`align`](https://github.com/jcwillox/lovelace-canary/wiki/Glance-Card#align) +- [Vertical Stack](https://github.com/jcwillox/lovelace-canary/wiki/Vertical-Stack) + - [`in_card`](https://github.com/jcwillox/lovelace-canary/wiki/Vertical-Stack#in_card) +- [Canary Card](https://github.com/jcwillox/lovelace-canary/wiki/Canary-Card) + - `style` + - `theme` For more information head over to the [wiki](https://github.com/jcwillox/lovelace-canary/wiki). diff --git a/hacs.json b/hacs.json index 3eb36023..e44b5bfd 100644 --- a/hacs.json +++ b/hacs.json @@ -1,3 +1,3 @@ { "name": "Canary" -} \ No newline at end of file +} diff --git a/info.md b/info.md index 91457154..a5747ce1 100644 --- a/info.md +++ b/info.md @@ -1,12 +1,15 @@ ### Highlights #### Template Secondary Info + #### Vertical Stack in Card + #### Glance Card Entities Alignment + ### Info @@ -16,22 +19,23 @@ Much like [card-mod] Canary extends the default lovelace cards, so you don't nee Check out the [documentation] for the configuration options and examples. Available Extensions: -* [Generic Entity Row](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row) - * [`secondary_info`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#secondary_info) - * [`canary_style`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#canary_style) - * [`canary_theme`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#canary_theme) - * [`hide_warning`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#hide_warning) -* [Generic Card](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card) - * [`no_card`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#no_card) - * [`canary_style`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#canary_style) - * [`canary_theme`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#canary_theme) -* [Glance Card](https://github.com/jcwillox/lovelace-canary/wiki/Glance-Card) - * [`align`](https://github.com/jcwillox/lovelace-canary/wiki/Glance-Card#align) -* [Vertical Stack](https://github.com/jcwillox/lovelace-canary/wiki/Vertical-Stack) - * [`in_card`](https://github.com/jcwillox/lovelace-canary/wiki/Vertical-Stack#in_card) -* [Canary Card](https://github.com/jcwillox/lovelace-canary/wiki/Canary-Card) - * `style` - * `theme` + +- [Generic Entity Row](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row) + - [`secondary_info`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#secondary_info) + - [`canary_style`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#canary_style) + - [`canary_theme`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#canary_theme) + - [`hide_warning`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Entity-Row#hide_warning) +- [Generic Card](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card) + - [`no_card`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#no_card) + - [`canary_style`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#canary_style) + - [`canary_theme`](https://github.com/jcwillox/lovelace-canary/wiki/Generic-Card#canary_theme) +- [Glance Card](https://github.com/jcwillox/lovelace-canary/wiki/Glance-Card) + - [`align`](https://github.com/jcwillox/lovelace-canary/wiki/Glance-Card#align) +- [Vertical Stack](https://github.com/jcwillox/lovelace-canary/wiki/Vertical-Stack) + - [`in_card`](https://github.com/jcwillox/lovelace-canary/wiki/Vertical-Stack#in_card) +- [Canary Card](https://github.com/jcwillox/lovelace-canary/wiki/Canary-Card) + - `style` + - `theme` [card-mod]: https://github.com/thomasloven/lovelace-card-mod [documentation]: https://github.com/jcwillox/lovelace-canary/wiki diff --git a/src/canary-card.ts b/src/canary-card.ts index 5aead514..a5fda7c8 100644 --- a/src/canary-card.ts +++ b/src/canary-card.ts @@ -1,13 +1,13 @@ import { hass } from "card-tools/src/hass"; -import { property, state } from "lit/decorators.js"; -import { LitElement } from "lit"; import { + HomeAssistant, + LovelaceCard, applyThemesOnElement, computeCardSize, createThing, - HomeAssistant, - LovelaceCard } from "custom-card-helpers"; +import { LitElement } from "lit"; +import { property, state } from "lit/decorators.js"; import type { CanaryCardConfig } from "./types"; export class CanaryCard extends LitElement implements LovelaceCard { diff --git a/src/const.ts b/src/const.ts index b563495d..6101407d 100644 --- a/src/const.ts +++ b/src/const.ts @@ -4,7 +4,7 @@ export const DEFAULT_SECONDARY_INFO = [ "last-triggered", "position", "tilt-position", - "brightness" + "brightness", ]; // language=CSS @@ -17,5 +17,5 @@ export const VERTICAL_STACK_IN_CARD_STYLE = ` export const NO_CARD_STYLE = { boxShadow: "none", background: "none", - border: "none" + border: "none", }; diff --git a/src/main.ts b/src/main.ts index c5e6dc34..d367b262 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,5 @@ -import { name } from "../package.json"; import { fireEvent } from "custom-card-helpers"; +import { name } from "../package.json"; // allow dynamic updating of secondary info. import "./secondary-info"; diff --git a/src/modules/generic-card.ts b/src/modules/generic-card.ts index 4b929e38..e41b066f 100644 --- a/src/modules/generic-card.ts +++ b/src/modules/generic-card.ts @@ -1,10 +1,10 @@ -import { extensionEnabled, findConfig, moduleEnabled } from "../utils"; -import { mapStyle } from "../styles"; -import { NO_CARD_STYLE } from "../const"; import { hass } from "card-tools/src/hass"; -import { createModule } from "../module"; import { applyThemesOnElement } from "custom-card-helpers"; import { StyleInfo } from "lit/directives/style-map.js"; +import { NO_CARD_STYLE } from "../const"; +import { createModule } from "../module"; +import { mapStyle } from "../styles"; +import { extensionEnabled, findConfig, moduleEnabled } from "../utils"; const MODULE = "generic-card"; const ELEMENT = "ha-card"; diff --git a/src/modules/generic-entity-row.ts b/src/modules/generic-entity-row.ts index 64f1e3ef..0daf1a5d 100644 --- a/src/modules/generic-entity-row.ts +++ b/src/modules/generic-entity-row.ts @@ -1,12 +1,12 @@ +import { hass, provideHass } from "card-tools/src/hass"; import { hasOldTemplate } from "card-tools/src/old-templates"; -import { DEFAULT_SECONDARY_INFO } from "../const"; import { hasTemplate } from "card-tools/src/templates"; -import { hass, provideHass } from "card-tools/src/hass"; -import { extensionEnabled, moduleEnabled } from "../utils"; -import { createModule } from "../module"; -import { mapStyle } from "../styles"; import { applyThemesOnElement } from "custom-card-helpers"; import { StyleInfo } from "lit/directives/style-map.js"; +import { DEFAULT_SECONDARY_INFO } from "../const"; +import { createModule } from "../module"; +import { mapStyle } from "../styles"; +import { extensionEnabled, moduleEnabled } from "../utils"; const MODULE = "generic-entity-row"; const ELEMENT = "hui-generic-entity-row"; diff --git a/src/modules/glance-card.ts b/src/modules/glance-card.ts index 192a6d6b..a4df4521 100644 --- a/src/modules/glance-card.ts +++ b/src/modules/glance-card.ts @@ -1,5 +1,5 @@ -import { extensionEnabled, moduleEnabled } from "../utils"; import { createModule } from "../module"; +import { extensionEnabled, moduleEnabled } from "../utils"; const MODULE = "glance-card"; const ELEMENT = "hui-glance-card"; diff --git a/src/modules/vertical-stack.ts b/src/modules/vertical-stack.ts index 8528051f..c2ac6e2d 100644 --- a/src/modules/vertical-stack.ts +++ b/src/modules/vertical-stack.ts @@ -1,7 +1,7 @@ +import { LovelaceCard } from "custom-card-helpers"; import { NO_CARD_STYLE, VERTICAL_STACK_IN_CARD_STYLE } from "../const"; -import { extensionEnabled, moduleEnabled } from "../utils"; import { createModule } from "../module"; -import { LovelaceCard } from "custom-card-helpers"; +import { extensionEnabled, moduleEnabled } from "../utils"; const MODULE = "vertical-stack"; const ELEMENT = "hui-vertical-stack-card"; diff --git a/src/modules/warning.ts b/src/modules/warning.ts index fd62fecd..d6687f50 100644 --- a/src/modules/warning.ts +++ b/src/modules/warning.ts @@ -1,5 +1,5 @@ -import { extensionEnabled, findConfig, moduleEnabled } from "../utils"; import { createModule } from "../module"; +import { extensionEnabled, findConfig, moduleEnabled } from "../utils"; const MODULE = "warning"; const ELEMENT = "hui-warning"; diff --git a/src/secondary-info.ts b/src/secondary-info.ts index 29ad1819..c2a71d9d 100644 --- a/src/secondary-info.ts +++ b/src/secondary-info.ts @@ -1,7 +1,7 @@ -import { subscribeRenderTemplate } from "card-tools/src/templates.js"; import { parseOldTemplate } from "card-tools/src/old-templates"; -import { oldExtractEntities } from "./templates"; +import { subscribeRenderTemplate } from "card-tools/src/templates.js"; import { HomeAssistant } from "custom-card-helpers"; +import { oldExtractEntities } from "./templates"; interface SecondaryInfoConfig { template: Record | string; diff --git a/src/types.ts b/src/types.ts index d6cb0500..ce041853 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,6 +1,6 @@ import { HomeAssistant, LovelaceCard } from "custom-card-helpers"; -import { LitElement, PropertyValues } from "lit"; import { LovelaceCardConfig } from "custom-card-helpers/src/types"; +import { LitElement, PropertyValues } from "lit"; import { StyleInfo } from "lit/directives/style-map.js"; declare global {