Skip to content

Commit 02c9264

Browse files
author
Ondrej Machala
committed
chore: add knip and eslint-plugin-lit
- Configure knip with strict rules (all set to error) - Add eslint-plugin-lit for Lit-specific linting - Add to pre-commit hook and CI pipeline - Fix detected issues: remove unused exports and files
1 parent f439e7a commit 02c9264

File tree

9 files changed

+407
-49
lines changed

9 files changed

+407
-49
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
- name: Type check
3939
run: pnpm typecheck
4040

41+
- name: Check unused code
42+
run: pnpm knip
43+
4144
- name: Test with coverage
4245
run: pnpm vitest run --coverage
4346

eslint.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
import eslint from '@eslint/js';
33
import tseslint from 'typescript-eslint';
44
import prettierConfig from 'eslint-config-prettier';
5+
import litPlugin from 'eslint-plugin-lit';
56

67
export default tseslint.config(
78
eslint.configs.recommended,
89
...tseslint.configs.strictTypeChecked,
910
...tseslint.configs.stylisticTypeChecked,
1011
prettierConfig,
12+
litPlugin.configs['flat/recommended'],
1113
{
1214
languageOptions: {
1315
parserOptions: {

knip.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@5/schema.json",
3+
"entry": ["src/treemap-card.ts", "src/index.ts"],
4+
"project": ["src/**/*.ts"],
5+
"ignore": ["src/**/*.test.ts"],
6+
"ignoreDependencies": [],
7+
"rules": {
8+
"files": "error",
9+
"dependencies": "error",
10+
"devDependencies": "error",
11+
"optionalPeerDependencies": "error",
12+
"unlisted": "error",
13+
"binaries": "error",
14+
"unresolved": "error",
15+
"exports": "error",
16+
"nsExports": "error",
17+
"classMembers": "error",
18+
"types": "error",
19+
"nsTypes": "error",
20+
"enumMembers": "error",
21+
"duplicates": "error"
22+
}
23+
}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"lint:fix": "eslint src/ --fix",
1919
"format": "prettier --write .",
2020
"format:check": "prettier --check .",
21-
"check": "pnpm typecheck && pnpm format:check && pnpm lint && pnpm test:run",
21+
"knip": "knip",
22+
"check": "pnpm typecheck && pnpm format:check && pnpm lint && pnpm knip && pnpm test:run",
2223
"fix": "pnpm format && pnpm lint:fix",
2324
"prepare": "simple-git-hooks"
2425
},
@@ -41,7 +42,9 @@
4142
"custom-card-helpers": "^1.9.0",
4243
"eslint": "^9.16.0",
4344
"eslint-config-prettier": "^9.1.0",
45+
"eslint-plugin-lit": "^2.1.1",
4446
"jsdom": "^25.0.0",
47+
"knip": "^5.80.0",
4548
"prettier": "^3.7.4",
4649
"simple-git-hooks": "^2.11.1",
4750
"typescript": "^5.7.0",

0 commit comments

Comments
 (0)