chore: replace depcheck with knip - #330
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning MetaMask internal reviewing guidelines:
Ignoring alerts on:
|
c6ce5d5 to
8e8ab88
Compare
8e8ab88 to
0fa1ca9
Compare
0fa1ca9 to
e6b288c
Compare
e6b288c to
483699b
Compare
483699b to
9409f44
Compare
The merge-base changed after approval.
9409f44 to
c5dcd6a
Compare
c5dcd6a to
17da708
Compare
17da708 to
9cecd71
Compare
|
@SocketSecurity ignore npm/@emnapi/core@1.11.2 |
9cecd71 to
bef90f9
Compare
bef90f9 to
ab85ef4
Compare
ab85ef4 to
ad4538b
Compare
ad4538b to
4bfabba
Compare
Core dropped depcheck for knip, so match it. depcheck ^1.4.7 removed, along with .depcheckrc.json knip ^6.23.0 added, with knip.config.mts Scripts follow core's shape: lint:dependencies bakes in `yarn dedupe --check` and a separate lint:dependencies:fix runs the writing form, rather than passing --check through from `lint`. The config is nine lines rather than core's 292, because that file is almost entirely per workspace tuning for a monorepo and this is a single package. Only the two lavamoat packages need ignoring: both are wired in through the Yarn plugin and the lavamoat.allowScripts field rather than imported, so knip cannot see the usage. Switching also turned up dead weight that depcheck had been hiding. Its ignore list included ts-node, which nothing references: it is not a peer of ts-jest, appears nowhere outside its own package.json entry, and core does not carry it. Removed rather than re-ignored. knip requires Node ^20.19.0 || >=22.12.0. Only the Lint job runs it, and that job is pinned to 22.x, so this is safe ahead of the Node floor bump.
4bfabba to
aabee68
Compare
Core dropped
depcheckforknip, so match it. Sits below the Node bump so it lands with the rest of the tooling alignment.depcheck@^1.4.7+.depcheckrc.jsonknip@^6.23.0+knip.config.mtsScripts follow core's shape:
lint:dependenciesbakes inyarn dedupe --check, with a separatelint:dependencies:fixfor the writing form, rather than threading--checkthrough fromlint.Config is nine lines, not core's 292
Core's
knip.config.mtsis almost entirely per-workspace tuning for a monorepo. This is a single package, so it needs an entry pair and two ignores:Both lavamoat packages are wired in through the Yarn plugin and the
lavamoat.allowScriptsfield rather than imported, so knip can't see the usage.It found dead weight depcheck was hiding
The old
.depcheckrc.jsonignore list includedts-node. Nothing references it: it isn't a peer ofts-jest, appears nowhere outside its ownpackage.jsonentry, and core doesn't carry it. Removed rather than re-ignored.Node requirement
knip needs
^20.19.0 || >=22.12.0. Only the Lint job runs it and that job is pinned to22.x, so this is safe ahead of the Node floor bump in the next PR.Note
Low Risk
Tooling-only change to dev dependency lint; no runtime or library API changes.
Overview
Aligns dependency linting with MetaMask core by replacing
depcheckand.depcheckrc.jsonwithknipand a smallknip.config.mts. Entries aresrc/index.tsandsrc/node.ts; Lavamoat packages stay onignoreDependenciesbecause they are wired via Yarn/Lavamoat config, not imports.Lint scripts now run
knip --config knip.config.mts --dependenciesplusyarn dedupe --checkunderlint:dependencies, withlint:dependencies:fixfor the writable dedupe path used fromlint:fix. The top-levellintscript no longer passes--checkinto the dependencies step separately.ts-nodeis removed from devDependencies (nothing in the repo referenced it; it had only been masked by depcheck ignores). Lockfile churn reflects dropping depcheck’s dependency tree and adding knip’s (oxc-parser/resolver, etc.).Reviewed by Cursor Bugbot for commit aabee68. Bugbot is set up for automated code reviews on this repo. Configure here.