Skip to content

Repository files navigation

DeleteIt

Find what your codebase no longer needs.

npx deleteit

DeleteIt demo

Quick Start

npx deleteit
npx deleteit ./packages/web
npx deleteit --json
npx deleteit --ci

For a local checkout:

pnpm install
pnpm build
pnpm test
pnpm test:real
pnpm benchmark -- path/to/your/project

What it detects

  • Unused JavaScript and TypeScript files.
  • Unused named/default exports, top-level functions, and classes.
  • Unused npm dependencies.
  • Environment variables declared in .env, .env.*, or .env.example but not statically accessed.
  • Potentially removable non-empty lines and their percentage of the scanned codebase.

The scanner understands ESM, CommonJS require, type-only imports, literal dynamic imports, re-exports, barrel files, package main / module / browser / exports / bin / types, tsconfig/jsconfig aliases, workspace packages, and common Vite, Next.js, Jest, Vitest, and ESLint conventions.

Example output

Unused exports
  OldUserService                     src/services/old.ts:12 HIGH

Unused functions / classes
  LegacyParser                       src/parsers/legacy.ts:4 HIGH

Unused environment variables
  OLD_API_URL                        .env, .env.example MEDIUM

Confidence levels

  • HIGH: the scanner found complete static evidence that no reachable entrypoint, import, or reference uses the item.
  • MEDIUM: static evidence suggests it is unused, but runtime conventions may still apply.
  • LOW: an ambiguous signal is worth reviewing, but should not be treated as safe to delete.

CLI options

Command Description
deleteit Scan the current directory
deleteit <path> Scan a project directory
deleteit .deleteit Scan the current directory using a .deleteit JSON config when present
deleteit --json Print machine-readable JSON
deleteit --ci Exit with code 1 when findings exist
deleteit --fix Reserved; no files are changed in v0.1.1
deleteit --help Show help
deleteit --version Show version

Optional .deleteit configuration:

{
  "ignore": ["generated/**", "vendor/**"],
  "entrypoints": ["src/worker.ts"]
}

CI usage

- run: pnpm dlx deleteit --ci

The repository itself tests Node 20, 22, and 24 on Ubuntu, Windows, and macOS through GitHub Actions.

Safety and false positives

DeleteIt prefers missing dead code over incorrectly marking live code as removable.

It does not automatically delete code in v0.1.1. Review every finding, especially MEDIUM and LOW confidence results, generated files, runtime reflection, plugin loading, and externally consumed package APIs.

Limitations

  • V0.1.1 supports JavaScript and TypeScript only.
  • Non-literal dynamic imports are protected conservatively.
  • Runtime reflection, generated code, undocumented CLI conventions, and external consumers cannot always be proven statically.
  • Unresolved generated imports, runtime reflection, and custom framework conventions remain intentionally conservative.
  • --fix is a safe placeholder and does not mutate files.

Roadmap

  • Reviewable fix previews before any mutation.
  • More framework-specific route and generated-code conventions.
  • Optional Markdown/HTML reports.

Contributing

See CONTRIBUTING.md, SECURITY.md, and the issue templates. Keep changes small, add regression coverage for analysis behavior, and preserve the low false-positive bar.

About

Find what your codebase no longer needs.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages