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

react-useeffect-doctor

v0.1.0

Published

Find React useEffect calls that may be unnecessary.

Readme

React useEffect Doctor

A read-only CLI that finds React useEffect calls which may be unnecessary.

This tool uses heuristics. Findings are review candidates, not definite errors.

npx react-useeffect-doctor "src/**/*.{js,jsx,ts,tsx}"

Requires Node.js 20 or newer.

Usage

react-useeffect-doctor [--config <path>] [path-or-glob ...]

With no input, the CLI scans the current directory recursively. Quote globs for consistent cross-platform matching.

The scanner reads .js, .jsx, .ts, and .tsx files. It always excludes files inside node_modules and dist.

Rules

| Rule | Reports | Prefer | | --- | --- | --- | | derived-or-copied-state | An Effect that calls a state setter without recognized external-system work | Calculate during render; use useMemo only for expensive work | | initial-state | An Effect with [] that only calls a state setter | Initialize with useState or at module scope | | parent-notification | An Effect with dependencies that only calls a callback such as onChange | Call the callback from the event handler that changed the value |

Effects with recognized fetch, subscription, event, timer, browser, storage, observer, socket, worker, or broadcast work are excluded from these rules.

Configuration

The CLI automatically loads .react-useeffect-doctor.json from the current directory. Use --config <path> to select another file.

{
  "exclude": {
    "files": ["src/Legacy.tsx"],
    "patterns": ["**/*.generated.{ts,tsx}"]
  }
}

exclude is required; files and patterns are optional. Entries are relative to the config file's directory, must stay inside that directory, and override explicit scan inputs. files are literal paths; patterns are globs.

Suppress an intentional Effect

Add effect-lint-ignore to a line or block comment inside that Effect:

useEffect(() => {
  // effect-lint-ignore -- sync with a non-standard external system
  setStatus(readExternalStatus())
}, [])

The comment suppresses only its containing Effect.

Exit statuses

  • 0: no findings. An unmatched glob is also a valid clean scan.
  • 1: one or more findings.
  • 2: usage, configuration, or scanning error. A missing literal input file is an error.

Limitations

The tool uses regular expressions and shallow delimiter matching, not a JavaScript or TypeScript syntax tree. Complex control flow, nested callbacks, aliased hooks, custom Effect wrappers, some TypeScript generics, regular-expression literals with structural delimiters, and other valid syntax can cause false positives or missed findings.

Review each warning before changing code. The CLI never modifies source files.