chore: Replace ts-prune with knip (#2595)

- Closes: #2593
This commit is contained in:
Dermot Duffy
2026-07-22 13:26:34 -07:00
committed by GitHub
parent 2ca4aa95e5
commit 7d66c5f005
13 changed files with 719 additions and 1437 deletions
+28
View File
@@ -0,0 +1,28 @@
{
"$schema": "./node_modules/knip/schema-jsonc.json",
// Vendored docsify assets, loaded by `<script src>` tags in `docs/index.html`.
"ignore": ["docs/js/**"],
// A TypeScript language-service plugin supplied by the `runem.lit-plugin` editor
// extension rather than by `package.json`.
"ignoreUnresolved": ["ts-lit-plugin"],
"ignoreDependencies": [
// Ambient module declarations in `src/declarations.d.ts` that other modules
// augment to add view/issue/action context properties. They are import
// specifiers but not packages.
"view",
"issue",
"action",
// Reached through the string-based `compat.extends()` call in
// `eslint.config.mjs`, which knip cannot follow.
"@typescript-eslint/eslint-plugin",
"eslint-config-prettier",
// Referenced from the `release` block in `package.json`.
"@semantic-release/github",
"conventional-changelog-conventionalcommits",
],
}
+4 -9
View File
@@ -13,7 +13,6 @@
"lovelace"
],
"type": "module",
"module": "advanced-camera-card.js",
"repository": "github:dermotduffy/advanced-camera-card",
"author": "Dermot Duffy <dermot.duffy@gmail.com>",
"license": "MIT",
@@ -53,11 +52,9 @@
"zod": "^4.3.6"
},
"devDependencies": {
"@babel/core": "^7.24.7",
"@babel/plugin-proposal-decorators": "^7.24.7",
"@babel/plugin-transform-class-properties": "^7.24.7",
"@eslint/eslintrc": "^3.3.6",
"@eslint/js": "^9.24.0",
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-json": "^6.1.0",
@@ -75,10 +72,9 @@
"conventional-changelog-conventionalcommits": "^8.0.0",
"docsify-cli": "^4.4.4",
"eslint": "^9.24.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"jsdom": "^21.1.2",
"knip": "^6.29.0",
"prettier": "^3.3.2",
"rollup": "^3.29.4",
"rollup-plugin-git-info": "^1.0.0",
@@ -88,7 +84,6 @@
"sass": "patch:sass@npm%3A1.77.4#~/.yarn/patches/sass-npm-1.77.4-13b6910aea.patch",
"semantic-release": "^24.1.1",
"semantic-release-export-data": "^1.1.0",
"ts-prune": "^0.10.3",
"type-fest": "^4.41.0",
"typescript": "^5.8.3",
"vitest": "^1.6.0",
@@ -192,7 +187,7 @@
"format": "prettier --write .",
"format-check": "prettier --check .",
"rollup": "rollup -c",
"prune": "ts-prune --error -p tsconfig.prune.json",
"prune": "knip",
"test": "vitest run",
"coverage": "vitest run --coverage"
},
+1 -1
View File
@@ -1,4 +1,4 @@
export interface LiveViewContext {
interface LiveViewContext {
// A cameraID override (used for dependencies/substreams to force a different
// camera to be live rather than the camera selected in the view).
overrides?: Map<string, string>;
+3 -3
View File
@@ -394,7 +394,7 @@ export class AdvancedCameraCardElementsConditional extends LitElement {
}
// A base class for rendering menu icons / menu state icons.
export class AdvancedCameraCardElementsBaseItem<ConfigType> extends LitElement {
class AdvancedCameraCardElementsBaseItem<ConfigType> extends LitElement {
protected _eventCategory: string;
constructor(eventCategory: string) {
@@ -432,7 +432,7 @@ export class AdvancedCameraCardElementsBaseItem<ConfigType> extends LitElement {
}
}
export class AdvancedCameraCardElementsBaseMenuItem<
class AdvancedCameraCardElementsBaseMenuItem<
ConfigType,
> extends AdvancedCameraCardElementsBaseItem<ConfigType> {
constructor() {
@@ -452,7 +452,7 @@ export class AdvancedCameraCardElementsMenuSubmenu extends AdvancedCameraCardEle
@customElement('advanced-camera-card-menu-submenu-select')
export class AdvancedCameraCardElementsMenuSubmenuSelect extends AdvancedCameraCardElementsBaseMenuItem<MenuSubmenuSelect> {}
export class AdvancedCameraCardElementsBaseStatusBarItem<
class AdvancedCameraCardElementsBaseStatusBarItem<
ConfigType,
> extends AdvancedCameraCardElementsBaseItem<ConfigType> {
constructor() {
+1 -1
View File
@@ -37,7 +37,7 @@ import { getReviewedQueryFilterFromQuery } from '../view/utils/query-filter.js';
import './carousel.js';
import './thumbnail/thumbnail.js';
export interface ThumbnailMediaSelect {
interface ThumbnailMediaSelect {
media: ViewMedia;
}
-13
View File
@@ -1,13 +0,0 @@
:host {
width: 100%;
height: 100%;
display: block;
}
advanced-camera-card-surround-basic {
// The folder will grow indefinitely in the `unconstrained` aspect ratio
// modes, the surround height needs to be limited to something reasonable in
// order for the media filter to still display somewhere the user can
// easily/continually access. See similar: gallery.scss.
max-height: 110dvh;
}
-36
View File
@@ -1,36 +0,0 @@
.heart {
position: absolute;
left: var(--start-x);
top: var(--start-y);
font-size: var(--size, 1em);
color: hsl(var(--hue, 340), var(--saturation, 80%), var(--lightness, 55%));
user-select: none;
pointer-events: none;
will-change: transform;
animation: pulse var(--pulse-duration) ease-in-out infinite;
animation-delay: var(--pulse-delay);
}
@keyframes pulse {
0% {
transform: scale(0);
opacity: 0;
}
15% {
opacity: var(--max-opacity, 1);
}
50% {
transform: scale(1.3);
}
85% {
opacity: var(--max-opacity, 1);
}
100% {
transform: scale(0);
opacity: 0;
}
}
-48
View File
@@ -1,48 +0,0 @@
.snowflake {
position: absolute;
left: var(--start-x);
color: white;
user-select: none;
pointer-events: none;
will-change: transform;
animation: fall var(--fall-duration) linear infinite;
animation-delay: var(--fall-delay);
}
@keyframes fall {
0% {
// Start above the card.
top: -2em;
transform: translateX(0);
opacity: var(--max-opacity, 1);
}
25% {
top: 25%;
transform: translateX(calc(var(--end-x) - var(--start-x) + 8px));
}
50% {
top: 50%;
transform: translateX(calc(var(--end-x) - var(--start-x) - 10px));
}
75% {
top: 75%;
transform: translateX(calc(var(--end-x) - var(--start-x) + 20px));
}
90% {
opacity: var(--max-opacity, 1);
}
100% {
// 100% ensures snowflakes fall through the entire card height
top: 100%;
transform: translateX(calc(var(--end-x) - var(--start-x)));
opacity: 0;
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { Task } from '@lit-labs/task';
import type { ReactiveControllerHost } from '@lit/reactive-element';
import type { ReactiveControllerHost } from 'lit';
import type { HomeAssistant } from '../ha/types';
+1 -1
View File
@@ -1,5 +1,5 @@
import { Task } from '@lit-labs/task';
import type { ReactiveControllerHost } from '@lit/reactive-element';
import type { ReactiveControllerHost } from 'lit';
import { afterEach, assert, describe, expect, it, vi } from 'vitest';
import { mock } from 'vitest-mock-extended';
-11
View File
@@ -1,11 +0,0 @@
{
// 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"
}
}
-1
View File
@@ -21,7 +21,6 @@ const EXCLUSIONS = [
const INCLUSIONS = ['tests/**/*.test.ts'];
// ts-prune-ignore-next
export default defineConfig({
plugins: [svgPath()],
test: {
+680 -1312
View File
File diff suppressed because it is too large Load Diff