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

camouf-plugin-react

v0.2.1

Published

React-specific rules for Camouf - catches AI-generated React code errors

Readme

camouf-plugin-react

React-specific rules for Camouf — catches AI-generated React code errors that traditional linters miss.

npm version camouf peer license

Why This Plugin?

AI coding assistants generate React code that compiles but fails at runtime. This plugin catches:

  • Missing hook dependencies — useEffect that runs on wrong triggers
  • Stale closures — setInterval/event listeners with captured state
  • Inconsistent naming — Components that don't follow PascalCase
  • Prop drilling — Excessive prop passing through component trees

Installation

npm install --save-dev camouf-plugin-react camouf

Configuration

Add to your camouf.config.json:

{
  "plugins": [
    {
      "name": "camouf-plugin-react",
      "config": {}
    }
  ],
  "rules": {
    "plugin": {
      "react/missing-dependency-array": "warning",
      "react/inconsistent-component-naming": "warning",
      "react/prop-drilling-detection": "warning",
      "react/stale-closure-patterns": "warning"
    }
  }
}

Rules

react/missing-dependency-array

Detects React hooks with missing variables in dependency arrays.

AI Error Pattern: AI forgets to add used variables to the dependency array.

// Bad - AI generates this:
useEffect(() => {
  fetchData(userId);
}, []); // userId missing!

// Good - Should be:
useEffect(() => {
  fetchData(userId);
}, [userId]);

Configuration:

{
  "react/missing-dependency-array": {
    "severity": "warning",
    "hooks": ["useEffect", "useCallback", "useMemo", "useLayoutEffect"]
  }
}

react/inconsistent-component-naming

Detects React components not following PascalCase naming convention.

AI Error Pattern: AI switches between naming conventions mid-session.

// Bad - AI generates this:
function userProfile() { // Should be UserProfile
  return <div>...</div>;
}

// Good - Should be:
function UserProfile() {
  return <div>...</div>;
}

Configuration:

{
  "react/inconsistent-component-naming": {
    "severity": "warning",
    "enforcePascalCase": true,
    "checkFileNames": true
  }
}

react/prop-drilling-detection

Detects props passed through multiple component layers without use.

AI Error Pattern: AI copies props through components instead of using Context.

// Bad - AI generates deep prop drilling:
<App user={user}>           // receives user
  <Layout user={user}>      // receives, passes down
    <Sidebar user={user}>   // receives, passes down
      <UserInfo user={user} /> // finally uses it!
    </Sidebar>
  </Layout>
</App>

// Good - Should use Context:
<UserContext.Provider value={user}>
  <App>
    <Layout>
      <Sidebar>
        <UserInfo /> {/* useContext(UserContext) */}
      </Sidebar>
    </Layout>
  </App>
</UserContext.Provider>

Configuration:

{
  "react/prop-drilling-detection": {
    "severity": "warning",
    "maxDepth": 3,
    "ignoreCommonProps": true
  }
}

react/stale-closure-patterns

Detects potential stale closure issues in React hooks.

AI Error Pattern: AI creates closures that capture stale state values.

// Bad - AI generates this:
useEffect(() => {
  const interval = setInterval(() => {
    console.log(count); // Always logs initial value!
    setCount(count + 1); // Always sets to 1!
  }, 1000);
  return () => clearInterval(interval);
}, []);

// Good - Should use functional update:
useEffect(() => {
  const interval = setInterval(() => {
    setCount(c => c + 1); // Functional update
  }, 1000);
  return () => clearInterval(interval);
}, []);

Configuration:

{
  "react/stale-closure-patterns": {
    "severity": "warning",
    "checkIntervals": true,
    "checkEventListeners": true,
    "checkAsyncCallbacks": true
  }
}

Example Output

camouf validate

[ERROR] react/missing-dependency-array
  src/components/UserProfile.tsx:15
  useEffect is missing 2 dependencies: userId, fetchUser
  Suggestion: Add missing dependencies to the array: [userId, fetchUser]

[WARNING] react/stale-closure-patterns
  src/hooks/useCounter.tsx:8
  setInterval callback may have stale closure over: count
  Suggestion: Use functional update (setState(prev => ...)) to access current state

Found 2 violations in 0.5s

Usage with CI/CD

# .github/workflows/lint.yml
- name: Run Camouf
  run: npx camouf validate --format github

License

Apache-2.0

Related