Skip to content

dittoryFind Repetitive Patterns

A static analysis CLI for TypeScript projects that detects parameters that always receive the same value.

Quick Start

sh
$ npx dittory ./src --min=3
sh
$ pnpm dlx dittory ./src --min=3
sh
$ yarn dlx dittory ./src --min=3
sh
$ bunx dittory ./src --min=3

Example Output

Button src/components/Button.tsx:15
Constant Arguments:
  - variant = "primary"
Usages (5):
  - src/pages/Home.tsx:23
  - src/pages/About.tsx:45
  - src/pages/Contact.tsx:12
  - src/features/auth/Login.tsx:67
  - src/features/auth/Register.tsx:89


fetchUser src/api/users.ts:42
Constant Arguments:
  - includeProfile = true
  - cache = false
Usages (3):
  - src/hooks/useUser.ts:18
  - src/pages/Profile.tsx:31
  - src/components/UserCard.tsx:55


---
Found 2 function(s) with constant arguments out of 24 function(s).

Why dittory?

When a prop or argument is always passed the same value across your codebase, it's often a sign that:

  • The parameter could be removed and replaced with a default value
  • The API could be simplified by eliminating unnecessary options
  • There's copy-paste code that should be refactored

Released under the MIT License.