Skip to main content

Migrating from unimported

unimported reports dangling files, unused dependencies, and unresolved imports. rev-dep covers all three and folds them into one config with the rest of its checks.

Why migrate​

  • unimported is archived. It is no longer maintained and its README points elsewhere - so moving off it is overdue.
  • Speed and a single pass. rev-dep is Go-based - faster on large repos.
  • More checks. On top of unimported's three, rev-dep adds unused exports, missing dependencies, circular imports, and architecture rules.

What carries over, what changes​

  • Covered well: unimported (orphan) files, unused dependencies, unresolved imports.
  • Entry points. unimported derives entry files (or you set entry); rev-dep uses prodEntryPoints/devEntryPoints the same way to anchor reachability.
  • Autofix. unimported's --fix removes dangling files; rev-dep's orphanFilesDetection autofix does the same under config run --fix.

Feature mapping​

unimportedrev-dep
unimported filesorphanFilesDetection
unused dependenciesunusedNodeModulesDetection
unresolved importsunresolvedImportsDetection
entryprodEntryPoints / devEntryPoints
ignoreUnimportedorphan validEntryPoints / ignoreEntryPoints
ignoreUnusedexcludeModules
ignoreUnresolvedignoreImports on unresolvedImportsDetection
ignorePatternsignoreFiles
aliasestsconfig.json paths (read automatically)
--fixconfig run --fix (orphan files)

Translating your config​

A .unimportedrc.json:

{
"entry": ["src/index.ts"],
"ignorePatterns": ["**/*.stories.tsx"],
"ignoreUnused": ["husky"],
"ignoreUnresolved": ["virtual:*"]
}

becomes a rev-dep.config.jsonc:

{
"ignoreFiles": ["**/*.stories.tsx"],
"rules": [
{
"path": ".",
"prodEntryPoints": ["src/index.ts"],
"unresolvedImportsDetection": {
"enabled": true,
"ignoreImports": ["virtual:*"]
},
"unusedNodeModulesDetection": {
"enabled": true,
"excludeModules": ["husky"]
},
"orphanFilesDetection": {
"enabled": true,
"autofix": true
}
}
]
}

Running it​

# unimported
npx unimported

# rev-dep
rev-dep config run
rev-dep config run --fix # removes dangling files

Next steps​