chore: Replace deprecated 'node' module resolution with 'bundler' and tighten compiler options (#2594)

This commit is contained in:
Dermot Duffy
2026-07-22 12:12:00 -07:00
committed by GitHub
parent 87ecbc7e45
commit 2ca4aa95e5
13 changed files with 29 additions and 29 deletions
+1 -1
View File
@@ -192,7 +192,7 @@
"format": "prettier --write .", "format": "prettier --write .",
"format-check": "prettier --check .", "format-check": "prettier --check .",
"rollup": "rollup -c", "rollup": "rollup -c",
"prune": "ts-prune --error", "prune": "ts-prune --error -p tsconfig.prune.json",
"test": "vitest run", "test": "vitest run",
"coverage": "vitest run --coverage" "coverage": "vitest run --coverage"
}, },
@@ -18,7 +18,6 @@ export class StatusBarItemManager {
this._api = api; this._api = api;
} }
private _items: StatusBarItem[] = [];
private _dynamicItems: StatusBarItem[] = []; private _dynamicItems: StatusBarItem[] = [];
public addDynamicStatusBarItem(item: StatusBarItem): void { public addDynamicStatusBarItem(item: StatusBarItem): void {
+1 -1
View File
@@ -1,4 +1,4 @@
import type { StyleInfo } from 'lit/directives/style-map'; import type { StyleInfo } from 'lit/directives/style-map.js';
import { configDefaults, type AdvancedCameraCardConfig } from '../config/schema/types'; import { configDefaults, type AdvancedCameraCardConfig } from '../config/schema/types';
import type { ThemeConfig, ThemeName } from '../config/schema/view'; import type { ThemeConfig, ThemeName } from '../config/schema/view';
+1 -1
View File
@@ -1,4 +1,4 @@
import type { StyleInfo } from 'lit/directives/style-map'; import type { StyleInfo } from 'lit/directives/style-map.js';
import type { CameraManager } from '../camera-manager/manager'; import type { CameraManager } from '../camera-manager/manager';
import type { CallManager } from '../card-controller/call/manager'; import type { CallManager } from '../card-controller/call/manager';
-2
View File
@@ -7,7 +7,6 @@ import type {
PTZControlsConfig, PTZControlsConfig,
PTZControlType, PTZControlType,
} from '../../config/schema/common/controls/ptz.js'; } from '../../config/schema/common/controls/ptz.js';
import type { HomeAssistant } from '../../ha/types.js';
import type { Interaction } from '../../types.js'; import type { Interaction } from '../../types.js';
import { import {
createPTZControlsAction, createPTZControlsAction,
@@ -20,7 +19,6 @@ export class PTZController {
private _host: HTMLElement; private _host: HTMLElement;
private _config: PTZControlsConfig | null = null; private _config: PTZControlsConfig | null = null;
private _hass: HomeAssistant | null = null;
private _cameraManager: CameraManager | null = null; private _cameraManager: CameraManager | null = null;
private _cameraID: string | null = null; private _cameraID: string | null = null;
+1 -9
View File
@@ -1,7 +1,3 @@
import type {
CreatePluginType,
LoosePluginType,
} from 'embla-carousel/components/Plugins';
import { import {
html, html,
LitElement, LitElement,
@@ -18,14 +14,10 @@ import carouselStyle from '../scss/carousel.scss';
import { import {
CarouselController, CarouselController,
type CarouselDirection, type CarouselDirection,
type EmblaCarouselPlugins,
} from '../utils/embla/carousel-controller'; } from '../utils/embla/carousel-controller';
import { getTextDirection } from '../utils/text-direction'; import { getTextDirection } from '../utils/text-direction';
export type EmblaCarouselPlugins = CreatePluginType<
LoosePluginType,
Record<string, unknown>
>[];
@customElement('advanced-camera-card-carousel') @customElement('advanced-camera-card-carousel')
export class AdvancedCameraCardCarousel extends LitElement { export class AdvancedCameraCardCarousel extends LitElement {
@property({ attribute: true, reflect: true }) @property({ attribute: true, reflect: true })
-1
View File
@@ -51,7 +51,6 @@ export class AdvancedCameraCardSelect extends ScopedRegistryHost(LitElement) {
@property({ attribute: true, type: Boolean }) @property({ attribute: true, type: Boolean })
public clearable?: boolean = false; public clearable?: boolean = false;
private _previouslyReportedValue?: SelectValues;
private _refSelect: Ref<SelectElement> = createRef(); private _refSelect: Ref<SelectElement> = createRef();
static elementDefinitions = { static elementDefinitions = {
+1 -1
View File
@@ -4,7 +4,7 @@ import {
differenceInSeconds, differenceInSeconds,
format, format,
} from 'date-fns'; } from 'date-fns';
import type { StyleInfo } from 'lit/directives/style-map'; import type { StyleInfo } from 'lit/directives/style-map.js';
import { isEqualWith, mergeWith, round, uniq } from 'lodash-es'; import { isEqualWith, mergeWith, round, uniq } from 'lodash-es';
import { AdvancedCameraCardError } from '../types'; import { AdvancedCameraCardError } from '../types';
+5 -6
View File
@@ -1,9 +1,8 @@
import EmblaCarousel, { type EmblaCarouselType } from 'embla-carousel'; import EmblaCarousel, {
type EmblaCarouselType,
type EmblaPluginType,
} from 'embla-carousel';
import { WheelGesturesPlugin } from 'embla-carousel-wheel-gestures'; import { WheelGesturesPlugin } from 'embla-carousel-wheel-gestures';
import type {
CreatePluginType,
LoosePluginType,
} from 'embla-carousel/components/Plugins';
import { isEqual } from 'lodash-es'; import { isEqual } from 'lodash-es';
import type { TransitionEffect } from '../../config/schema/common/transition-effect.js'; import type { TransitionEffect } from '../../config/schema/common/transition-effect.js';
@@ -16,7 +15,7 @@ export interface CarouselSelected {
element: HTMLElement; element: HTMLElement;
} }
type EmblaCarouselPlugins = CreatePluginType<LoosePluginType, Record<string, unknown>>[]; export type EmblaCarouselPlugins = EmblaPluginType[];
export type CarouselDirection = 'vertical' | 'horizontal'; export type CarouselDirection = 'vertical' | 'horizontal';
-1
View File
@@ -7,7 +7,6 @@ import type { HomeAssistant } from '../../../../src/ha/types';
export class EntityRegistryManagerMock implements EntityRegistryManager { export class EntityRegistryManagerMock implements EntityRegistryManager {
private _cache = new EntityCache(); private _cache = new EntityCache();
private _fetchedEntityList = false;
constructor(data?: Entity[]) { constructor(data?: Entity[]) {
data?.forEach((entity) => { data?.forEach((entity) => {
+1 -2
View File
@@ -1,5 +1,4 @@
import type { EmblaCarouselType, EmblaEventType } from 'embla-carousel'; import type { EmblaCarouselType, EmblaEventType, EngineType } from 'embla-carousel';
import type { EngineType } from 'embla-carousel/components/Engine';
import { vi } from 'vitest'; import { vi } from 'vitest';
import { mock } from 'vitest-mock-extended'; import { mock } from 'vitest-mock-extended';
+7 -3
View File
@@ -2,11 +2,12 @@
"compilerOptions": { "compilerOptions": {
"target": "es2021", "target": "es2021",
"module": "es2020", "module": "es2020",
"moduleResolution": "node", "moduleResolution": "bundler",
"verbatimModuleSyntax": true, "verbatimModuleSyntax": true,
"isolatedModules": true,
"lib": ["es2021", "dom", "dom.iterable"], "lib": ["es2021", "dom", "dom.iterable"],
"noEmit": true, "noEmit": true,
"noErrorTruncation": false, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
@@ -15,8 +16,11 @@
"skipLibCheck": true, "skipLibCheck": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"experimentalDecorators": true, "experimentalDecorators": true,
// Lit's @property installs an accessor on the prototype. Class field
// semantics would define an own property on each instance that shadows it,
// so property writes would no longer trigger a render.
"useDefineForClassFields": false,
"esModuleInterop": true, "esModuleInterop": true,
"sourceMap": true,
"plugins": [ "plugins": [
{ {
"name": "ts-lit-plugin", "name": "ts-lit-plugin",
+11
View File
@@ -0,0 +1,11 @@
{
// ts-prune analyzes with its own bundled TypeScript 4.5, which predates the
// "bundler" resolution mode. It does not recognize the value and falls back to a
// mode that cannot resolve directory imports, which makes every index.ts barrel
// look unimported and its exports look unused. Give it a mode it understands.
// Related: https://github.com/dermotduffy/advanced-camera-card/issues/2593
"extends": "./tsconfig.json",
"compilerOptions": {
"moduleResolution": "node"
}
}