Skip to main content

Migrating from ts-prune

ts-prune finds exported TypeScript/JavaScript code that isn't used anywhere. rev-dep does the same with unusedExportsDetection, and adds the rest of a dependency-hygiene suite.

Why migrate​

  • ts-prune is in maintenance mode. Its own README no longer accepts feature work - so moving off it is overdue.
  • Speed. rev-dep is written in Go and runs in a single parallel pass - faster on large codebases.
  • More than unused exports. ts-prune does one thing. rev-dep also covers orphan files, unused/missing dependencies, circular imports, and architecture rules - replacing several tools at once.

What carries over, what changes​

  • Covered well: unused exports (named, default, types, re-exports).
  • Different model: ts-prune walks your tsconfig includes; rev-dep walks the graph from entry points. Define prodEntryPoints/devEntryPoints so the exports that form your public API aren't reported.
  • Note: ts-prune's "(used in module)" marker (exports referenced only in their own file) has no direct flag in rev-dep, which reports an export as unused when no other file imports it.

Feature mapping​

ts-prunerev-dep
unused exportsunusedExportsDetection
-u, --unusedInModule (skip in-module uses)default behavior (only cross-file usage counts)
-e, --error (non-zero exit)config run exits non-zero on findings
-autofix removes the unused export (--fix)

Translating your config​

A .ts-prunerc:

{
"project": "tsconfig.json",
"ignore": "src/generated",
"skip": "\\.stories\\.tsx$"
}

becomes a rev-dep.config.jsonc:

{
"rules": [
{
"path": ".",
"prodEntryPoints": ["src/index.ts"],
"devEntryPoints": ["**/*.test.ts"],
"unusedExportsDetection": {
"enabled": true,
"autofix": true,
"ignoreFiles": ["src/generated/**", "**/*.stories.tsx"]
}
}
]
}
ts-prune optionrev-dep equivalent
-p, --projectrev-dep reads tsconfig.json automatically (--tsconfig-json to override)
-i, --ignore / -s, --skip (regex)ignoreFiles / ignoreExports / ignore (globs)

ts-prune uses regular expressions; rev-dep uses glob patterns. See unused exports options and Ignoring files.

Running it​

# ts-prune
npx ts-prune

# rev-dep
rev-dep config run
rev-dep config run --fix # auto-removes unused exports

Next steps​