✨ Add knip for unused dependency and dead code detection

- Add check:knip using --include dependencies,exports,files
  (skips the noisy 'types' category, which produces false positives
  for libraries whose exported types are part of the public API)
- Remove tslib and type-fest (both caught as unused by knip)
- Add 'knip' to cspell word list
- No knip config file: the --include flag keeps the scope targeted
  without boilerplate, matching the 'keep it simple' principle
- Document in project-specs.md (CHECK section) and README.md
This commit is contained in:
tmu committed 2026-09-04 23:08:56 +02:00
1 parent 3fa72820df
commit ec98223f8d
5 files changed
+947 -37

No files matched your search

+3 -3
View File
@@ -35,8 +35,9 @@
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"check": "npm run check:tsc && npm run check:oxlint && npm run check:oxfmt && npm run check:cspell && npm run check:outdated",
"check": "npm run check:tsc && npm run check:oxlint && npm run check:oxfmt && npm run check:cspell && npm run check:knip && npm run check:outdated",
"check:cspell": "cspell lint ${LEFTHOOK_FILES:-.}",
"check:knip": "knip --include dependencies,exports,files",
"check:outdated": "check-outdated --ignore-pre-releases --ignore-packages @oxfmt/binding-darwin-arm64,@oxfmt/binding-darwin-x64,@oxfmt/binding-linux-arm64-gnu,@oxfmt/binding-linux-arm64-musl,@oxfmt/binding-linux-x64-gnu,@oxfmt/binding-linux-x64-musl,@oxfmt/binding-win32-x64-msvc,@oxlint/binding-darwin-arm64,@oxlint/binding-darwin-x64,@oxlint/binding-linux-arm64-gnu,@oxlint/binding-linux-arm64-musl,@oxlint/binding-linux-x64-gnu,@oxlint/binding-linux-x64-musl,@oxlint/binding-win32-x64-msvc",
"check:oxfmt": "oxfmt --check ${LEFTHOOK_FILES:-.}",
"check:oxlint": "oxlint ${LEFTHOOK_FILES:-src}",
@@ -60,12 +61,11 @@
"check-outdated": "^3.0.0",
"cspell": "^10.2.1",
"expect-type": "1.4.0",
"knip": "^6.34.0",
"lefthook": "^2.1.12",
"oxfmt": "^0.66.0",
"oxlint": "^1.81.0",
"publint": "^0.3.24",
"tslib": "^2.8.1",
"type-fest": "^5.9.0",
"typescript": "^7.0.2"
},
"optionalDependencies": {