✨ 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:
1 parent
3fa72820df
commit
ec98223f8d
5 files changed
+947
-37
No files matched your search
+9
-1
@@ -217,7 +217,7 @@ script does not belong in the standard pipeline.
|
||||
### CHECK
|
||||
|
||||
- `check`: Run all checks in order — `check:oxlint`, `check:oxfmt`,
|
||||
`check:tsc`, `check:cspell`, `check:outdated`.
|
||||
`check:tsc`, `check:cspell`, `check:knip`, `check:outdated`.
|
||||
- `check:oxlint`: `oxlint ${LEFTHOOK_FILES:-src}` — lints `src/`
|
||||
by default; when invoked from the lefthook pre-commit hook with
|
||||
`LEFTHOOK_FILES` set to the staged-files list, lints only those
|
||||
@@ -239,6 +239,14 @@ script does not belong in the standard pipeline.
|
||||
- `check:cspell`: `cspell lint ${LEFTHOOK_FILES:-.}` — walks the
|
||||
project root by default; from lefthook, only the staged files.
|
||||
- `check:outdated`: `check-outdated --ignore-pre-releases --ignore-packages @oxfmt/binding-*,@oxlint/binding-*`. The oxc native bindings are declared as `optionalDependencies` so the correct one is selected per platform automatically; the `*`-platform bindings show as "not installed" on the current platform and are explicitly ignored here.
|
||||
- `check:knip`: `knip --include dependencies,exports,files` — finds
|
||||
unused dependencies, value exports, and source files. The
|
||||
scoped `--include` list intentionally omits the `types`
|
||||
category, which produces systematic false positives for
|
||||
libraries whose exported types (e.g. `Matcher`, `Pattern`) are
|
||||
part of the public API and not consumed internally. The
|
||||
targeted scope keeps the signal high (real unused-dep
|
||||
detection) without config-file boilerplate.
|
||||
|
||||
### FIX
|
||||
|
||||
|
||||
Reference in new issue
Block a user