Skip to content

Commit 6cb2dcf

Browse files
authored
Merge pull request #783 from cr7pt0gr4ph7/cleanup-trailing-spaces
chore: Remove trailing whitespace
2 parents 3a5548f + 725a3f1 commit 6cb2dcf

20 files changed

+125
-129
lines changed

src/battery-provider.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ import { EntityRegistryDisplayEntry, HomeAssistantExt } from "./type-extensions"
77
/**
88
* Properties which should be copied over to individual entities from the card
99
*/
10-
const entititesGlobalProps: (keyof IBatteryEntityConfig)[] = [
11-
"bulk_rename",
12-
"charging_state",
13-
"colors",
10+
const entititesGlobalProps: (keyof IBatteryEntityConfig)[] = [
11+
"bulk_rename",
12+
"charging_state",
13+
"colors",
1414
"debug",
1515
"default_state_formatting",
1616
"extend_entity_data",
17-
"icon",
18-
"non_battery_entity",
19-
"round",
20-
"secondary_info",
21-
"state_map",
22-
"tap_action",
23-
"value_override",
17+
"icon",
18+
"non_battery_entity",
19+
"round",
20+
"secondary_info",
21+
"state_map",
22+
"tap_action",
23+
"value_override",
2424
"unit",
2525
];
2626

src/colors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const getGradientColors = (config: IColorSteps[], level: number): string => {
5656

5757
// if values were used we should respect them and calculate gradient between them
5858
if (config.every(s => s.value != undefined)) {
59-
59+
6060
const first = config[0];
6161
if (level <= first.value!) {
6262
return first.color;

src/custom-elements/battery-state-card.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class BatteryStateCard extends LovelaceCard<IBatteryCardConfig> {
9393
this.style.display = "none";
9494
return html``;
9595
}
96-
96+
9797
this.style.removeProperty("display");
9898

9999
return cardHtml(this);
@@ -108,9 +108,9 @@ export class BatteryStateCard extends LovelaceCard<IBatteryCardConfig> {
108108
*
109109
* Home Assistant uses this to automatically distribute all cards over
110110
* the available columns. One is equal 50px.
111-
*
112-
* Unfortunatelly this func is called only once when layout is being
113-
* rendered thus in case of dynamic number of entities (based on filters)
111+
*
112+
* Unfortunatelly this func is called only once when layout is being
113+
* rendered thus in case of dynamic number of entities (based on filters)
114114
* we cannot provide any reasonable estimation.
115115
*/
116116
getCardSize() {

src/custom-elements/battery-state-entity.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class BatteryStateEntity extends LovelaceCard<IBatteryEntityConfig> {
9898
this.state = state;
9999
this.unit = unit;
100100
this.stateNumeric = level;
101-
101+
102102
const isCharging = getChargingState(this.config, this.state, this.hass);
103103
this.entityData["charging"] = isCharging ? (this.config.charging_state?.secondary_info_text || "Charging") : "" // todo: think about i18n
104104

@@ -170,8 +170,8 @@ export class BatteryStateEntity extends LovelaceCard<IBatteryEntityConfig> {
170170

171171
if (entityDisplayEntry) {
172172
this.entityData["display"] = entityDisplayEntry;
173-
this.entityData["device"] = entityDisplayEntry.device_id
174-
? this.hass.devices && this.hass.devices[entityDisplayEntry.device_id]
173+
this.entityData["device"] = entityDisplayEntry.device_id
174+
? this.hass.devices && this.hass.devices[entityDisplayEntry.device_id]
175175
: undefined;
176176

177177
const area_id = entityDisplayEntry.area_id || (<DeviceRegistryEntry>this.entityData["device"])?.area_id;

src/custom-elements/battery-state-entity.views.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const relativeTimeTag = new RegExp("<rt>([^<]+)</rt>", "g");
66

77
/**
88
* Replaces temporary RT tages with proper HA "relative-time" ones
9-
*
9+
*
1010
* @param text Text to be processed
1111
* @param hass HomeAssistant instance
1212
* @returns Rendered templates
@@ -28,7 +28,7 @@ const replaceTags = (text: string, hass?: HomeAssistant): TemplateResult[] => {
2828

2929
currentPos += matchPos + matches[0].length;
3030
}
31-
31+
3232
if (currentPos < text.length) {
3333
result.push(html`${text.substring(currentPos, text.length)}`);
3434
}
@@ -64,14 +64,14 @@ const unit = (unit: string | undefined) => unit && html`&nbsp;${unit}`;
6464

6565
export const debugOutput = (content: string) => {
6666

67-
const actions = [{
68-
text: "Show / hide",
69-
action: (e: MouseEvent) => {
67+
const actions = [{
68+
text: "Show / hide",
69+
action: (e: MouseEvent) => {
7070
const debugContent = <HTMLElement>(<HTMLElement>e.currentTarget)?.parentElement?.parentElement?.querySelector(".debug_expand");
7171
if (debugContent) {
7272
debugContent.style.display = debugContent.style.display === "none" ? "block" : "none";
7373
}
74-
}
74+
}
7575
}];
7676

7777
if (navigator.clipboard) {

src/custom-elements/shared.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
:host(.clickable),
2+
:host(.clickable),
33
.clickable {
44
cursor: pointer;
55
}

src/rich-string-processor.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const validEntityDomains = [
2323
"scene",
2424
"script",
2525
"select",
26-
"sensor",
26+
"sensor",
2727
"switch",
2828
"update",
2929
"weather",
@@ -187,7 +187,7 @@ const availableProcessors: IMap<IProcessorCtor> = {
187187
return Math.round(100 / thresholds.length * result).toString();
188188
}
189189
},
190-
"abs": () =>
190+
"abs": () =>
191191
val => Math.abs(Number(val)).toString(),
192192
"equals": (params) => {
193193
const chunks = params.split(",");
@@ -207,7 +207,7 @@ const availableProcessors: IMap<IProcessorCtor> = {
207207
const addend = Number(params);
208208

209209
return val => isNaN(addend) ? val : (Number(val) + addend).toString();
210-
},
210+
},
211211
"reltime": () => {
212212
return val => {
213213
const unixTime = Date.parse(val);
@@ -229,4 +229,3 @@ interface IProcessor {
229229
interface IProcessorCtor {
230230
(params: string): IProcessor | undefined
231231
}
232-

src/sorting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import { isNumber, log, safeGetConfigArrayOfObjects, toNumber } from "./utils";
6666

6767
return result;
6868
});
69-
}
69+
}
7070

7171
/**
7272
* Number comparer

src/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ export const safeGetArray = <T>(val: T | T[] | undefined): T[] => {
5858

5959
/**
6060
* Converts config value to array of specified objects.
61-
*
62-
* ISimplifiedArray config object supports simple list of strings or even an individual item. This function
61+
*
62+
* ISimplifiedArray config object supports simple list of strings or even an individual item. This function
6363
* ensures we're getting an array in all situations.
64-
*
64+
*
6565
* E.g. all of the below are valid entries and can be converted to objects
6666
* 1. Single string
6767
* my_setting: "name"
@@ -78,7 +78,7 @@ export const safeGetArray = <T>(val: T | T[] | undefined): T[] => {
7878
* - by: "name"
7979
* - by: "sort"
8080
* desc: true
81-
*
81+
*
8282
* @param value Config array
8383
* @param defaultKey Key of the object to populate
8484
* @returns Array of objects
@@ -137,7 +137,7 @@ export const getRegexFromString = (ruleVal: string): RegExp | null => {
137137
if (ruleVal[0] == "/" && ruleVal[ruleVal.length - 1] == "/") {
138138
return new RegExp(ruleVal.substr(1, ruleVal.length - 2));
139139
}
140-
else {
140+
else {
141141
let matches = ruleVal.match(regexPattern)
142142
if (matches && matches.length == 3) {
143143
return new RegExp(matches[1], matches[2]);

test/card/filters.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test("Include via entity_id and exclude via state - empty result", async () => {
5959
await cardElem.cardUpdated;
6060

6161
const card = new CardElements(cardElem);
62-
62+
6363
expect(card.itemsCount).toBe(0);
6464
// we expect to not have any content
6565
expect(cardElem.shadowRoot!.childElementCount).toBe(0);
@@ -93,6 +93,6 @@ test.each([
9393
await cardElem.cardUpdated;
9494

9595
const card = new CardElements(cardElem);
96-
96+
9797
expect(card.itemsCount).toBe(numOfRenderedEntities);
9898
});

0 commit comments

Comments
 (0)