Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"plugin:@typescript-eslint/recommended",
"plugin:wc/recommended",
"plugin:lit/recommended",
"prettier",
"prettier/@typescript-eslint"
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand Down Expand Up @@ -85,6 +84,25 @@
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/naming-convention": [
0,
{
"selector": "default",
"format": ["camelCase", "snake_case"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": ["variable"],
"format": ["camelCase", "snake_case", "UPPER_CASE"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": "typeLike",
"format": ["PascalCase"]
}
],
"lit/attribute-value-entities": 0
},
"plugins": ["disable", "import", "lit", "prettier", "@typescript-eslint"],
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ jobs:
- name: Build resources
run: ./node_modules/.bin/gulp gen-icons-json build-translations gather-gallery-demos
- name: Run eslint
run: ./node_modules/.bin/eslint '{**/src,src}/**/*.{js,ts,html}' --ignore-path .gitignore
run: yarn run lint:eslint
- name: Run tsc
run: ./node_modules/.bin/tsc
run: yarn run lint:types
- name: Run prettier
run: yarn run lint:prettier
test:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 1 addition & 3 deletions cast/src/launcher/layout/hc-cast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ class HcCast extends LitElement {
const error =
this.castManager.castState === "NO_DEVICES_AVAILABLE"
? html`
<p>
There were no suitable Chromecast devices to cast to found.
</p>
<p>There were no suitable Chromecast devices to cast to found.</p>
`
: undefined;

Expand Down
4 changes: 1 addition & 3 deletions cast/src/launcher/layout/hc-connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ export class HcConnect extends LitElement {
</div>
<div class="card-actions">
<a href="/">
<mwc-button>
Retry
</mwc-button>
<mwc-button> Retry </mwc-button>
</a>
<div class="spacer"></div>
<mwc-button @click=${this._handleLogout}>Log out</mwc-button>
Expand Down
4 changes: 1 addition & 3 deletions demo/src/stubs/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
export const mockTranslations = (hass: MockHomeAssistant) => {
hass.mockWS(
"frontend/get_translations",
(/* msg: {language: string, category: string} */) => {
return { resources: {} };
}
(/* msg: {language: string, category: string} */) => ({ resources: {} })
);
};
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-alarm-panel-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,8 @@ class DemoAlarmPanelEntity extends LitElement {
}
}

customElements.define("demo-hui-alarm-panel-card", DemoAlarmPanelEntity);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-alarm-panel-card": DemoAlarmPanelEntity;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-conditional-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,8 @@ class DemoConditional extends LitElement {
}
}

customElements.define("demo-hui-conditional-card", DemoConditional);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-conditional-card": DemoConditional;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-entities-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,8 @@ class DemoEntities extends LitElement {
}
}

customElements.define("demo-hui-entities-card", DemoEntities);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-entities-card": DemoEntities;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-entity-button-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,8 @@ class DemoButtonEntity extends LitElement {
}
}

customElements.define("demo-hui-entity-button-card", DemoButtonEntity);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-entity-button-card": DemoButtonEntity;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-entity-filter-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,8 @@ class DemoEntityFilter extends LitElement {
}
}

customElements.define("demo-hui-entity-filter-card", DemoEntityFilter);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-entity-filter-card": DemoEntityFilter;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-gauge-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,8 @@ class DemoGaugeEntity extends LitElement {
}
}

customElements.define("demo-hui-gauge-card", DemoGaugeEntity);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-gauge-card": DemoGaugeEntity;
}
}
10 changes: 7 additions & 3 deletions gallery/src/demos/demo-hui-glance-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ const CONFIGS = [
name:
- light.kitchen_lights
- entity: lock.kitchen_door
name:
name:
- light.ceiling_lights
`,
},
{
heading: "Custom tap action",
config: `
- type: glance
columns: 4
columns: 4
entities:
- entity: lock.kitchen_door
name: Custom
Expand Down Expand Up @@ -232,4 +232,8 @@ class DemoGlanceEntity extends LitElement {
}
}

customElements.define("demo-hui-glance-card", DemoGlanceEntity);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-glance-card": DemoGlanceEntity;
}
}
10 changes: 10 additions & 0 deletions gallery/src/demos/demo-hui-grid-and-stack-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const CONFIGS = [
heading: "Columns 4",
config: `
- type: grid
columns: 4
cards:
- type: entity
entity: light.kitchen_lights
Expand Down Expand Up @@ -142,6 +143,15 @@ const CONFIGS = [
entity: light.kitchen_lights
`,
},
{
heading: "Size for single card",
config: `
- type: grid
cards:
- type: entity
entity: light.kitchen_lights
`,
},

{
heading: "Vertical Stack",
Expand Down
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-iframe-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ class DemoIframe extends LitElement {
}
}

customElements.define("demo-hui-iframe-card", DemoIframe);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-iframe-card": DemoIframe;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-light-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,8 @@ class DemoLightEntity extends LitElement {
}
}

customElements.define("demo-hui-light-card", DemoLightEntity);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-light-card": DemoLightEntity;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-map-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,8 @@ class DemoMap extends LitElement {
}
}

customElements.define("demo-hui-map-card", DemoMap);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-map-card": DemoMap;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-markdown-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,8 @@ class DemoMarkdown extends LitElement {
}
}

customElements.define("demo-hui-markdown-card", DemoMarkdown);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-markdown-card": DemoMarkdown;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-media-control-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,8 @@ class DemoHuiMediaControlCard extends LitElement {
}
}

customElements.define("demo-hui-media-control-card", DemoHuiMediaControlCard);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-media-control-card": DemoHuiMediaControlCard;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-media-player-rows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,8 @@ class DemoHuiMediaPlayerRow extends LitElement {
}
}

customElements.define("demo-hui-media-player-row", DemoHuiMediaPlayerRow);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-media-player-row": DemoHuiMediaPlayerRow;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-picture-elements-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,8 @@ class DemoPictureElements extends LitElement {
}
}

customElements.define("demo-hui-picture-elements-card", DemoPictureElements);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-picture-elements-card": DemoPictureElements;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-picture-entity-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,8 @@ class DemoPictureEntity extends LitElement {
}
}

customElements.define("demo-hui-picture-entity-card", DemoPictureEntity);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-picture-entity-card": DemoPictureEntity;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-picture-glance-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,8 @@ class DemoPictureGlance extends LitElement {
}
}

customElements.define("demo-hui-picture-glance-card", DemoPictureGlance);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-picture-glance-card": DemoPictureGlance;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-plant-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ export class DemoPlantEntity extends LitElement {
}
}

customElements.define("demo-hui-plant-card", DemoPlantEntity);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-plant-card": DemoPlantEntity;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-shopping-list-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ class DemoShoppingListEntity extends LitElement {
}
}

customElements.define("demo-hui-shopping-list-card", DemoShoppingListEntity);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-shopping-list-card": DemoShoppingListEntity;
}
}
6 changes: 5 additions & 1 deletion gallery/src/demos/demo-hui-thermostat-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,8 @@ class DemoThermostatEntity extends LitElement {
}
}

customElements.define("demo-hui-thermostat-card", DemoThermostatEntity);
declare global {
interface HTMLElementTagNameMap {
"demo-hui-thermostat-card": DemoThermostatEntity;
}
}
5 changes: 5 additions & 0 deletions gallery/src/demos/demo-integration-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ const nameAsDomainEntry = createConfigEntry("ESPHome");
const longNameEntry = createConfigEntry(
"Entry with a super long name that is going to the next line"
);
const longNonBreakingNameEntry = createConfigEntry(
"EntryWithASuperLongNameThatDoesNotBreak"
);
const configPanelEntry = createConfigEntry("Config Panel", {
domain: "mqtt",
localized_domain_name: "MQTT",
Expand Down Expand Up @@ -141,6 +144,7 @@ const configEntries: Array<{
{ items: [optionsFlowEntry] },
{ items: [nameAsDomainEntry] },
{ items: [longNameEntry] },
{ items: [longNonBreakingNameEntry] },
{ items: [setupErrorEntry] },
{ items: [migrationErrorEntry] },
{ items: [setupRetryEntry] },
Expand All @@ -154,6 +158,7 @@ const configEntries: Array<{
setupErrorEntry,
migrationErrorEntry,
longNameEntry,
longNonBreakingNameEntry,
setupRetryEntry,
failedUnloadEntry,
notLoadedEntry,
Expand Down
8 changes: 2 additions & 6 deletions hassio/src/addon-store/hassio-addon-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ class HassioAddonRepositoryEl extends LitElement {
const repo = this.repo;
let _addons = this.addons;
if (!this.hass.userData?.showAdvanced) {
_addons = _addons.filter((addon) => {
return !addon.advanced;
});
_addons = _addons.filter((addon) => !addon.advanced);
}
const addons = this._getAddons(_addons, this.filter);

Expand All @@ -68,9 +66,7 @@ class HassioAddonRepositoryEl extends LitElement {
}
return html`
<div class="content">
<h1>
${repo.name}
</h1>
<h1>${repo.name}</h1>
<div class="card-group">
${addons.map(
(addon) => html`
Expand Down
11 changes: 4 additions & 7 deletions hassio/src/addon-store/hassio-addon-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ class HassioAddonStore extends LitElement {
main-page
supervisor
>
<span slot="header">
${this.supervisor.localize("panel.store")}
</span>
<span slot="header"> ${this.supervisor.localize("panel.store")} </span>
<ha-button-menu
corner="BOTTOM_START"
slot="toolbar-icon"
Expand Down Expand Up @@ -154,8 +152,8 @@ class HassioAddonStore extends LitElement {
repositories: HassioAddonRepository[],
addons: HassioAddonInfo[],
filter?: string
) => {
return repositories.sort(sortRepos).map((repo) => {
) =>
repositories.sort(sortRepos).map((repo) => {
const filteredAddons = addons.filter(
(addon) => addon.repository === repo.slug
);
Expand All @@ -171,8 +169,7 @@ class HassioAddonStore extends LitElement {
></hassio-addon-repository>
`
: html``;
});
}
})
);

private _handleAction(ev: CustomEvent<ActionDetail>) {
Expand Down
Loading