npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@alwalxed/efkt

v0.15.0

Published

Scan, categorize, and export every useEffect in your React project

Readme

efkt

Scan, categorize, and export every useEffect in your React project.

npm version npm downloads license


efkt is a lightweight CLI that parses your React codebase, classifies every useEffect by dependency shape and cleanup pattern, and outputs clean JSON or Markdown, ready for code audits, LLM review, or sharing with your team.

Features

  • Scans .js, .jsx, .ts, .tsx files via fast AST parsing
  • Classifies effects into 6 categories (untracked, reactive, once × plain/cleanup)
  • Outputs structured JSON or human-readable Markdown
  • Optional comment stripping from effect bodies
  • Filter to a single category or cap total results with --limit
  • Respects .gitignore files found anywhere in the scanned tree
  • Always skips node_modules, dist, build, out, coverage, .next, .turbo, .git
  • Caps scan at 10,000 files with a stderr warning (prevents runaway scans)

Installation

pnpm add -g @alwalxed/efkt
# or
npm install -g @alwalxed/efkt
# or
yarn global add @alwalxed/efkt

Usage

efkt [path] [options]

Omitting [path] defaults to ./. Running without --json or --md in a TTY launches an interactive prompt. In non-TTY contexts (pipes, CI) a format flag is required — omitting it exits with an error.

Options

| Flag | Description | | -------------------- | -------------------------------------------------------------------- | | --json | Output structured JSON (mutually exclusive with --md) | | --md | Output Markdown report (mutually exclusive with --json) | | --limit <n> | Cap total effects to n, ordered: untracked → reactive → once | | --case <group.sub> | Filter to one category, e.g. untracked.plain or reactive.cleanup | | --strip-comments | Strip // and /* */ comments from effect bodies | | --help | Show help and exit | | --version | Show version and exit |

Effect Categories

Effects are classified by two axes: dependency array shape and presence of a cleanup return.

| Category | Deps | Cleanup | Risk | | ------------------- | --------- | ------- | --------------------- | | untracked.plain | absent | ✗ | 🔴 High, likely stale | | untracked.cleanup | absent | ✓ | 🟠 Medium, High | | reactive.plain | […deps] | ✗ | 🟡 Medium | | reactive.cleanup | […deps] | ✓ | 🟢 Recommended | | once.plain | [] | ✗ | 🟡 Low, Medium | | once.cleanup | [] | ✓ | 🟢 Usually safe |

JSON Output Shape

When using --json, the top-level envelope always contains:

{
  "scannedAt": "2026-03-13T10:00:00.000Z",
  "root": "./src",
  "totalFiles": 42,
  "totalEffects": 17,
  "effects": {
    "untracked": { "plain": [...], "cleanup": [...] },
    "reactive":  { "plain": [...], "cleanup": [...] },
    "once":      { "plain": [...], "cleanup": [...] }
  }
}

Each effect object contains file, component, startLine, endLine, body, raw, deps, and hasCleanup.

Examples

# Inspect the most dangerous effects
efkt --json | jq '.effects.untracked.plain'

# Count effects per subcategory
efkt --json | jq '.effects | to_entries[] | "\(.key): plain=\(.value.plain | length) cleanup=\(.value.cleanup | length)"'

# Only reactive effects with cleanup, under src/
efkt src/ --json --case reactive.cleanup

# Generate a Markdown report (great for LLM review or PRs)
efkt src/ --md --strip-comments > effects-report.md

# Analyze a single file
efkt src/components/Auth.tsx --json

# Cap output in large repos
efkt ./src --json --limit 25

# Copy report to clipboard (macOS)
efkt ./src --md | pbcopy

How It Works

  1. Recursively finds .js/.jsx/.ts/.tsx files, skipping common build/output dirs (node_modules, dist, .next, etc.) and respecting any .gitignore files in the tree (capped at 10,000 files)
  2. Parses each file with a fast AST parser
  3. Locates every useEffect call and inspects its arguments:
    • No second arguntracked
    • []once
    • […deps]reactive
    • Return function presentcleanup variant
  4. Extracts body, dependencies, file path, line number, and component context
  5. Serializes to JSON or Markdown

Contributing

efkt is intentionally small and focused. If you have ideas for meaningful improvements — better categorization, ignore patterns, richer context extraction — open an issue or send a clean PR.

Please keep PRs scoped and avoid adding heavy dependencies.

License

MIT