惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
InfoQ
博客园_首页
美团技术团队
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
J
Java Code Geeks
T
Tailwind CSS Blog
Jina AI
Jina AI
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
爱范儿
爱范儿
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
宝玉的分享
宝玉的分享
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
We Added React Doctor to Our UI Kit Monorepo. Here's What...
Divyesh · 2026-06-19 · via DEV Community

Maintaining a component library means living with a specific kind of anxiety.

Not the obvious bugs — those get caught. It's the quiet ones: a useEffect that shouldn't exist, a re-render that compounds across ten consuming apps, an accessibility gap that slipped through because ESLint didn't have a rule for it.

That's the gap React Doctor fills.


What Is React Doctor?

React Doctor is a static analyzer built specifically for React and React Native codebases. One command scans your project and surfaces issues across:

  • State and effect anti-patterns
  • Performance regressions
  • Accessibility risks
  • Architecture smells
  • Security concerns

It's not a replacement for ESLint — it's a second opinion that catches what ESLint misses.


Setup in a Monorepo

Adding it to our ui-kit-lib took about five minutes:

// package.json
{
  "scripts": {
    "doctor": "react-doctor"
  },
  "devDependencies": {
    "react-doctor": "0.2.5"
  }
}

For a monorepo with Storybook, generated output, and test artifacts, a scoped ignore config keeps the signal clean:

// react-doctor.config.json
{
  "ignore": {
    "files": [
      "**/dist/**",
      "**/storybook-static/**",
      "**/coverage/**",
      "**/.cache/**",
      "**/tmp/**"
    ]
  }
}

Without this, React Doctor scans build output and inflates the findings with noise.


What It Actually Caught

Our workspace includes UI components, primitives, icons, locale packages, and a Storybook app. Each package passes TypeScript, formatting, and linting — but that's not the same as being clean.

Here are two patterns it flagged that are easy to miss in review:

Inline array computation on every render:

// ❌ Runs filter on every render
const filteredItems = items.filter((item) => item.visible);
return <Select options={filteredItems} />;

// ✅ Stable reference, only recomputes when items changes
const filteredItems = useMemo(
  () => items.filter((item) => item.visible),
  [items]
);
return <Select options={filteredItems} />;

Derived state copied through useEffect:

// ❌ Extra render cycle, unnecessary sync
useEffect(() => {
  setActive(value);
}, [value]);

// ✅ Just read the prop directly during render
const active = value;

These patterns work. They compile, they test, they ship. But at component-library scale where one primitive gets consumed across an entire product they compound quietly.

After running React Doctor, we revisited and cleaned up real components including Accordion, Avatar, ComboBox, Modal, Select, SearchBox, Popper, and ThemeProvider.


How to Use It Effectively

1. Run it locally first

pnpm doctor

Don't panic if the count is high on the first run. Triage by category.

2. Fix high-signal issues first

Prioritize in this order:

  • Errors before warnings
  • Performance and re-render issues
  • State/effect anti-patterns
  • Accessibility findings

3. Add it to CI

npx react-doctor@latest install

Choose Yes when it prompts for GitHub Actions. From that point, every PR gets inline comments on the exact lines that introduced a regression — before merge, not after.


The Real Value

React Doctor won't replace code review or architectural judgment. What it does is shift the quality conversation earlier.

For a UI kit, that matters more than for most projects. Every component is a shared primitive. A fragile pattern in Select doesn't stay in Select it lives in every form across every app that consumes the library.

The shift React Doctor enabled for us:

Before: "This component works."

After: "This component is cleaner, safer, and less likely to regress."

That's the kind of improvement that compounds.


Try It

npx react-doctor@latest

No config needed to start. See what it finds on your codebase. If you maintain a design system, component library, or internal UI package, there's a good chance it surfaces something worth fixing.


Do you use any React-specific quality gates in your component library or monorepo? Curious what others are using — React Doctor, custom ESLint rules, Storybook interaction tests, visual regression, or something else.