chore: Enforce a few house rules via eslint (#2539)

This commit is contained in:
Dermot Duffy
2026-06-30 17:45:13 -07:00
committed by dermotduffy
parent 5572ec728e
commit 921d45e577
100 changed files with 479 additions and 295 deletions
+1 -1
View File
@@ -112,7 +112,7 @@ export class AdvancedCameraCardImageUpdatingPlayer
() => dispatchMediaPlayEvent(this),
() => dispatchMediaPauseEvent(this),
// Clear image load errors on each timer tick so the next render retries
// the <img> — but only for modes where the underlying URL genuinely
// the <img> -- but only for modes where the underlying URL genuinely
// changes between ticks (camera/entity snapshots). For mode: url, the
// same static URL will fail the same way every time, so clearing the
// error just causes a visible flicker (notification → blank <img> →
+5 -5
View File
@@ -233,7 +233,7 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
private _setViewCameraID(cameraID?: string | null): void {
if (cameraID) {
this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({
void this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({
params: {
camera: cameraID,
},
@@ -319,9 +319,9 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
const controller = this._mediaLoadedInfoSinkController.get()?.mediaPlayerController;
// Fire-and-forget; the `volumechange` event drives the re-render.
if (controller?.isMuted()) {
controller.unmute();
void controller.unmute();
} else {
controller?.mute();
void controller?.mute();
}
}
@@ -478,7 +478,7 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
const selectedCameraIndex = this._getSelectedCameraIndex();
if (this.viewFilterCameraID) {
this._mediaActionsController.setTarget(
void this._mediaActionsController.setTarget(
selectedCameraIndex,
// Camera in this carousel is only selected if the camera from the
// view matches the filtered camera.
@@ -486,7 +486,7 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
);
} else {
// Carousel is not filtered, so the targeted camera is always selected.
this._mediaActionsController.setTarget(selectedCameraIndex, true);
void this._mediaActionsController.setTarget(selectedCameraIndex, true);
}
this._mediaHeightController.setSelected(selectedCameraIndex);
+1 -1
View File
@@ -103,7 +103,7 @@ export class AdvancedCameraCardLiveGrid extends LitElement {
protected willUpdate(changedProps: PropertyValues): void {
if (changedProps.has('viewManagerEpoch') && this._needsGrid()) {
import('../media-grid.js');
void import('../media-grid.js');
}
}
+1 -1
View File
@@ -81,7 +81,7 @@ export class AdvancedCameraCardLive extends LitElement {
// from a hidden live view. Treat the live view as having no selected
// camera unless it is the active view.
const view = this.viewManagerEpoch?.manager.getView();
this._microphoneActionsController.setSelectedCamera(
void this._microphoneActionsController.setSelectedCamera(
view?.is('live') ? view.camera ?? null : null,
);
}
@@ -140,7 +140,7 @@ export class AdvancedCameraCardGo2RTC extends LitElement implements MediaPlayer
// VideoRTC owns the transition: it updates microphoneStream, swaps the
// track on the pre-armed transceiver, and validates against stale async
// completions before any reconnect fallback. Fire-and-forget is fine.
/* async */ this._player.setMicrophoneStream(this.microphoneStream ?? null);
void this._player.setMicrophoneStream(this.microphoneStream ?? null);
}
}
@@ -271,7 +271,7 @@ export class VideoRTC extends HTMLElement {
/**
* Owns the microphone stream transition end-to-end: updates the property,
* extracts the outbound audio track, and swaps it onto the pre-armed audio
* transceiver via `replaceTrack` — no SDP renegotiation, no visible reload.
* transceiver via `replaceTrack` -- no SDP renegotiation, no visible reload.
*
* Falls back to a full reconnect if `replaceTrack` rejects, but only when
* the rejection still describes the current desired state. The transceiver
@@ -410,8 +410,8 @@ export class VideoRTC extends HTMLElement {
*/
disconnectedCallback() {
// Synchronous manager-side cleanup by aborting the load's signal. The
// signal's abort listeners — registered by the card-root listener and
// any sinks in the bubble path — fire even though `parentNode` is
// signal's abort listeners -- registered by the card-root listener and
// any sinks in the bubble path -- fire even though `parentNode` is
// already null, because abort is plain JS, not DOM-event-bound.
this._abortController?.abort();
this._abortController = null;
@@ -833,7 +833,7 @@ export class VideoRTC extends HTMLElement {
// Always pre-arm a single outbound audio transceiver so the SDP advertises
// the slot from the start. With the slot in place, the mic track can be
// attached/detached later via `setMicrophoneStream` (replaceTrack) without
// renegotiating — avoiding a visible reload of this cell each time grid
// renegotiating -- avoiding a visible reload of this cell each time grid
// selection moves the mic between cameras.
//
// Pure SDP allocation: the kind-only `addTransceiver('audio', ...)` form
+1 -1
View File
@@ -200,7 +200,7 @@ export class AdvancedCameraCardLiveWebRTCCard extends LitElement implements Medi
public updated(): void {
// Extract the video component after it has been rendered and generate the
// media load event.
this.updateComplete.then(() => {
void this.updateComplete.then(() => {
this._videoRTC = this.renderRoot?.querySelector('#webrtc') ?? null;
const video = this._getVideo();
if (video) {
+1 -1
View File
@@ -60,7 +60,7 @@ export class AdvancedCameraCardLoading extends LitElement {
}
private _startEffect(effect: EffectName): void {
this.effectsManager?.startEffect(effect, { fadeIn: false });
void this.effectsManager?.startEffect(effect, { fadeIn: false });
this._effectName = effect;
}
+1 -1
View File
@@ -76,7 +76,7 @@ class AdvancedCameraCardMediaFilter extends ScopedRegistryHost(LitElement) {
this.cameraManager,
this.foldersManager,
);
this._mediaFilterController.computeMetadataOptions(this.cameraManager);
void this._mediaFilterController.computeMetadataOptions(this.cameraManager);
}
// The first time the viewManager is set, compute the initial default selections.
+1 -1
View File
@@ -87,7 +87,7 @@ export class AdvancedCameraCardSubmenuSelectButton extends LitElement {
}
if (!this._optionTitles) {
this._refreshOptionTitles();
void this._refreshOptionTitles();
}
const entityID = this.submenuSelect.entity;
+1 -1
View File
@@ -66,7 +66,7 @@ export class AdvancedCameraCardSurround extends LitElement {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected willUpdate(_changedProperties: PropertyValues): void {
if (this.timelineConfig?.mode && this.timelineConfig.mode !== 'none') {
import('./timeline-core.js');
void import('./timeline-core.js');
}
}
@@ -62,7 +62,7 @@ export class AdvancedCameraCardThumbnailFeatureThumbnail extends LitElement {
this._embedThumbnailTask?.status === TaskStatus.INITIAL &&
entries.some((entry) => entry.isIntersecting)
) {
this._embedThumbnailTask?.run();
void this._embedThumbnailTask?.run();
}
}
+1 -1
View File
@@ -277,7 +277,7 @@ export class AdvancedCameraCardTimelineCore extends LitElement {
this._controller.setView(this.viewManagerEpoch ?? null),
);
} else {
this._controller.setView(this.viewManagerEpoch ?? null);
void this._controller.setView(this.viewManagerEpoch ?? null);
}
}
+6 -6
View File
@@ -93,7 +93,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
(this._selected !== null && this._media?.[this._selected]?.getID()) || null,
callback: () => {
this._mediaHeightController.recalculate();
this._seekHandler();
void this._seekHandler();
},
});
@@ -388,7 +388,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
?.context?.mediaViewer?.seek?.getTime() !==
this.viewManagerEpoch?.oldView?.context?.mediaViewer?.seek?.getTime()
) {
this._seekHandler();
void this._seekHandler();
}
}
}
@@ -397,7 +397,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
if (!this._media?.length || this._selected === null) {
this._mediaActionsController.unsetTarget();
} else {
this._mediaActionsController.setTarget(
void this._mediaActionsController.setTarget(
this._selected,
// Camera in this carousel is only selected if the camera from the view
// matches the filtered camera.
@@ -438,16 +438,16 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
const seekTimeInMedia = selectedMedia.includesTime(seek);
this.toggleAttribute('unseekable', !seekTimeInMedia);
if (!seekTimeInMedia && !mediaPlayerController.isPaused()) {
mediaPlayerController.pause();
void mediaPlayerController.pause();
} else if (seekTimeInMedia && mediaPlayerController.isPaused()) {
mediaPlayerController.play();
void mediaPlayerController.play();
}
const seekTime =
(await this.cameraManager?.getMediaSeekTime(selectedMedia, seek)) ?? null;
if (seekTime !== null) {
mediaPlayerController.seek(seekTime);
void mediaPlayerController.seek(seekTime);
}
}
+1 -1
View File
@@ -72,7 +72,7 @@ export class AdvancedCameraCardViewerGrid extends LitElement {
protected willUpdate(changedProps: PropertyValues): void {
if (changedProps.has('viewManagerEpoch') && this._needsGrid()) {
import('../media-grid.js');
void import('../media-grid.js');
}
}
+3 -3
View File
@@ -157,11 +157,11 @@ export class AdvancedCameraCardViewerProvider extends LitElement implements Medi
changedProps.has('resolvedMediaCache') ||
changedProps.has('hass')
) {
this._resolveURL();
void this._resolveURL();
}
if (changedProps.has('viewerConfig') && this.viewerConfig?.zoomable) {
import('../zoomer.js');
void import('../zoomer.js');
}
}
@@ -290,7 +290,7 @@ export class AdvancedCameraCardViewerProvider extends LitElement implements Medi
.targetID=${mediaID}
@click=${() => {
if (this.viewerConfig?.snapshot_click_plays_clip) {
this._switchToRelatedClipView();
void this._switchToRelatedClipView();
}
}}
></advanced-camera-card-image-player>`}
+5 -5
View File
@@ -90,16 +90,16 @@ export class AdvancedCameraCardViews extends LitElement {
if (changedProps.has('viewManagerEpoch') || changedProps.has('config')) {
const view = this.viewManagerEpoch?.manager.getView();
if (view?.is('live') || this._shouldLivePreload()) {
import('./live/index.js');
void import('./live/index.js');
}
if (view?.isGalleryView()) {
import('./gallery/gallery.js');
void import('./gallery/gallery.js');
} else if (view?.isViewerView()) {
import('./viewer/index.js');
void import('./viewer/index.js');
} else if (view?.is('image')) {
import('./image.js');
void import('./image.js');
} else if (view?.is('timeline')) {
import('./timeline.js');
void import('./timeline.js');
}
}