Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-gs committed Jun 3, 2024
1 parent f6f6cd8 commit 32229c7
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 26 deletions.
8 changes: 4 additions & 4 deletions src/components/MapCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ export default class MapCard extends LitElement {
const {
latitude,
longitude,
passive,
//passive,
icon,
radius,
//radius,
entity_picture,
gps_accuracy: gpsAccuracy,
//gps_accuracy: gpsAccuracy,
friendly_name
} = stateObj.attributes;
const state = hass.formatEntityState(stateObj);
Expand All @@ -229,7 +229,7 @@ export default class MapCard extends LitElement {
entity.marker.addTo(map);
return entity;
} catch (e){
console.error("Entity: " + configEntity.id + " skipped due to missing data");
console.error("Entity: " + configEntity.id + " skipped due to missing data", e);
HaMapUtilities.renderWarningOnMap(this.map, "Entity: " + configEntity.id + " could not be loaded. See console for details.");
return null;
}
Expand Down
13 changes: 0 additions & 13 deletions src/configs/EntityConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,3 @@ export default class EntityConfig {
return "#" + ((1 << 24) * Math.random() | 0).toString(16).padStart(6, "0");
}
}

class LayerConfig {
/** @type {String} */
url;
/** @type {Object} */
options;

constructor(url, options, attribution = null) {
this.url = url;
this.options = {...{attribution: attribution}, ...options};
}

}
1 change: 1 addition & 0 deletions src/configs/MapConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import EntityConfig from "./EntityConfig.js"
import TileLayerConfig from "./TileLayerConfig.js"
import WmsLayerConfig from "./WmsLayerConfig.js"
import HaMapUtilities from "../util/HaMapUtilities.js";

export default class MapConfig {
/** @type {String} */
Expand Down
1 change: 1 addition & 0 deletions src/models/Entity.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import EntityHistory from "../models/EntityHistory.js";
import HaMapUtilities from "../util/HaMapUtilities.js";
import L from 'leaflet';


export default class Entity {
Expand Down
1 change: 1 addition & 0 deletions src/models/EntityHistory.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import L from 'leaflet';

export default class EntityHistory {

Expand Down
16 changes: 9 additions & 7 deletions src/services/HaLinkedEntityService.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default class HaLinkedEntityService {
constructor(hass, entity, suffix = 'hours ago') {
// Store ref to HASS
this.hass = hass;
suffix;
}

// Don't wait, we'll fire events when ready
Expand Down Expand Up @@ -62,13 +63,14 @@ export default class HaLinkedEntityService {
}

disconnect() {
this.listeners = {};
// Unsub
for (let [k, conn] of Object.entries(this.connections)) {
conn.then(unsub => unsub());
}
this.listeners = {};
// Unsub
for (let [k, conn] of Object.entries(this.connections)) {
k
conn.then(unsub => unsub());
}

this.connections = {};
HaMapUtilities.debug("[HaLinkedEntityService] Disconnecting");
this.connections = {};
HaMapUtilities.debug("[HaLinkedEntityService] Disconnecting");
}
}
6 changes: 4 additions & 2 deletions src/util/HaMapUtilities.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import L from 'leaflet';

/**
* Shared utility methods for HaMapCard
*/
Expand Down Expand Up @@ -31,7 +33,7 @@ export default class HaMapUtilities {
var unit = parts[1];

// Create a new Date object for the current time
var date = new Date();
const date = new Date();

// Subtract the appropriate amount of time
if (unit.startsWith('second')) {
Expand All @@ -52,7 +54,7 @@ export default class HaMapUtilities {
return date;
} else {
// If the input string is not a relative timestamp, try to parse it as an absolute date
var date = new Date(inputStr);
const date = new Date(inputStr);
if (isNaN(date.getTime())) {
// If the date could not be parsed, throw an error
throw new Error("Invalid input string for Date: " + inputStr);
Expand Down

0 comments on commit 32229c7

Please sign in to comment.