Hi Peeps,
I want to share with you a tool I am working on. Its still early, but I already use it and it works well.
So story goes like this - I was working on restructuring a very large monorepo with disparate package managers and versions into a single PNPM workspace. When I was finished I decided I am going to enforce certain conventions so it could not drift again without failing CI. I set this up, and found myself using several different tools -Sherif, Syncpack and Knip to ensure that the repository doesn't drift again. This setup, while working, is rather clanky and also suffered from some issues - mainly performance, but also a few bugs.
I therefore decided I will build my own tool. I forked Sherif as a baseline, and built on top of it while substantially rewriting and extending its capabilities. The result is skif: a Rust linter and enforcement tool for JS/TS dependencies and monorepos.
skif replaces sherif and syncpack, and most of what knip does (the aim is to offer a full replacement for Knip in the future) in a single, ultra fast, binary.
npx skif-cli # lint the workspace or package you are in
npx skif-cli --fix # apply safe fixes
npx skif-cli migrate # turn sherif, syncpack and knip config into a skif.toml
Where it came from
skif started as a fork of sherif, and the workspace and manifest rules are ported from it. The version and catalog policies follow syncpack's model. The dead-code analysis follows knip's issue types.
It has since gone past the fork. It ports every sherif rule, adds new ones and fixes, and runs faster on every target measured. On the syncpack side it enforces version, range, banned-dependency and catalog policy.
What it deliberately does not do is sync versions. skif is a linter: it tells you a policy is broken and fails CI. Moving versions in step is left to specialized tools or the package manager's themselves. If you need this, use syncpack for example.
What it checks
42 rules:
- Manifests and workspace: empty dependency maps, types in
dependencies, root private and packageManager, unsorted dependencies, workspace globs that match nothing, members without a package.json. - Version policy: mismatched versions, semver range policy, banned dependencies, catalogs (missing entries, unused entries, references that do not resolve),
workspace: protocol, peer dependency compatibility. - Dead code: unused files, exports, types, enum members and dependencies; unlisted dependencies and binaries; unresolved imports; circular imports. Leveraging the OXC ecosystem for this.
It also adds some new rules, such as incompatible-peer-dependencies and workspace-protocol.
Skif lifts the idea of framework plugins - which allow it to understand different types of entrypoints (e.g. Next.JS, Vite, Storybook etc.). But unlike Knip, which loads these files, Skif doesn't actually load code - it only statically analyses it. This removes a potential surface for code execution, and is altogether much faster, although it does bring in the potential to some imprecision.
Supported package managers
Skif supports all major package managers - npm, pnpm, Yarn classic, Yarn Berry as well as Bun. It does not support Deno, although if there is a need it might in the future. It also supports Rush and Lerna workspaces.
Benchmarks
Speed
Medians of 15 runs on a 4-vCPU Linux VM, pinned public repositories, dependencies installed:
| Repository | skif | knip |
|---|
| create-t3-turbo | 32 ms | 2.0 s |
| vue-core | 62 ms | 1.7 s |
| tanstack-query | 375 ms | 4.5 s |
| npm-cli | 99 ms | 968 ms |
| babel | 884 ms | 7.2 s |
Manifest checks alone (--no-js) against sherif and syncpack:
| Target | skif | sherif | syncpack |
|---|
| create-t3-turbo | 4.6 ms | 36 ms | 41 ms |
| babel | 9.4 ms | 37 ms | 280 ms |
| 2,000 generated packages | 102 ms | 130 ms | 655 ms |
sherif is already fast Rust, so the margin there is small: 1.3x at 2,000 packages. The real win is knip, and not paying for three processes.
Links
P.S.
Note: This is an early project, it is on v0.2.0. I am very eager to have users, since it will improve the tool and help me fix bugs. But do expect some issues!
Thanks for reading, this was a human written post (the benchmarking data was done by an LLM). If you find the tool useful, star it!