The last chapters covered tools that check your code by running it: tests, axe scans, Playwright. This one covers the tools that catch problems earlier and cheaper: the linter that flags a missing effect dependency as you type, the formatter that ends style debates, the type checker settings that turn vague types into precise ones, Storybook for building components in isolation, and React DevTools for understanding what's happening in a running app. It's a reference chapter: what each tool does, how to set it up in November 2026, and the parts worth being able to explain.
The thread running through it is the React Compiler from Part 5. The Compiler's assumptions (components are pure, props and state aren't mutated, refs aren't read during render) are now checked by lint rules, so the linter has become part of how React code is verified, not just a style tool.
The problem: bugs a tool can see before you run anything#
Here's a bug that compiles, renders, and works for exactly one tick. The interval should keep counting.
import { useEffect, useState } from "react";
export default function App() {
const [count, setCount] = useState(0);
useEffect(() => {
const id = setInterval(() => setCount(count + 1), 500);
return () => clearInterval(id);
}, []); // the effect only ever sees count = 0
return <p>Count: {count}</p>;
}It stops at 1, because the interval's callback closed over the count from the first render (Effects explains why). You'd find it by staring at it for a while. ESLint finds it instantly:
8:6 warning React Hook useEffect has a missing dependency: 'count'.
Either include it or remove the dependency array. You can also
do a functional update 'setCount(c => ...)' if you only need
'count' in the 'setCount' call react-hooks/exhaustive-depsThe message even suggests the right fix (the updater function). That's the case for linting React code: the Rules of Hooks and the purity rules are mechanical enough for a tool to check, and violating them causes bugs that are slow for humans to find.
ESLint and the React rules#
ESLint is the standard JavaScript linter. Version 10 (current: 10.15) completed a long migration: the old .eslintrc format is gone and flat config (eslint.config.js) is the only configuration format. A flat config is a plain JavaScript module exporting an array of config objects; later entries override earlier ones, and plugins are imported like any other module, so there's no string-based plugin resolution to debug.
A typical React and TypeScript setup. (Vite's react-ts template now ships Oxlint instead, configured with just rules-of-hooks and only-export-components; add this ESLint config next to it when you want the Compiler rules below.)
import js from "@eslint/js";
import { defineConfig, globalIgnores } from "eslint/config";
import tseslint from "typescript-eslint";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import jsxA11y from "eslint-plugin-jsx-a11y";
import globals from "globals";
export default defineConfig([
globalIgnores(["dist"]),
{
files: ["**/*.{ts,tsx}"],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended, // Rules of Hooks + React Compiler rules
reactRefresh.configs.vite, // only-export-components, for Fast Refresh
jsxA11y.flatConfigs.recommended, // accessibility rules
],
languageOptions: { globals: globals.browser },
},
]);eslint-plugin-react-hooks (current: 7.1) is the one that matters most. Version 6.1 (October 2025, with React 19.2) made recommended a flat config but left the Compiler rules opt-in; since version 7 the recommended preset includes two families of rules:
| Rule | Catches |
|---|---|
rules-of-hooks | Hooks called conditionally, in loops, or outside components and hooks |
exhaustive-deps | Effect, memo and callback dependency arrays that don't match what the function reads |
purity | Known-impure calls during render, like Math.random() or Date.now() |
refs | Reading or writing ref.current during render |
immutability | Mutating props, state or other values React treats as immutable |
set-state-in-render | Calling a state setter during render (an infinite loop waiting to happen) |
set-state-in-effect | Synchronous setState in an effect, usually derived state that should be computed during render |
static-components | Components defined inside other components, recreated every render |
preserve-manual-memoization | Existing useMemo/useCallback the Compiler couldn't preserve |
incompatible-library | Libraries whose APIs can't be safely memoized |
globals, use-memo, error-boundaries, unsupported-syntax, config, gating | Other Compiler assumptions and configuration |
The second family comes from the React Compiler: the same analysis that decides whether a component can be memoized automatically reports why it can't. These rules are useful even if you don't enable the Compiler, because each one flags code that's already fragile under Strict Mode and concurrent rendering. The plugin also ships recommended-latest for newer, more experimental Compiler rules. Use the presets rather than listing rules by hand, so new recommended rules arrive with upgrades.
Next.js removed next lint in version 16: you run the ESLint CLI directly, with eslint-config-next providing a flat config (eslint-config-next/core-web-vitals) that includes the React, hooks and Next.js rules.
Faster linters. Two Rust tools now compete with ESLint on speed. Oxlint (from the Oxc project, 1.x) implements hundreds of ESLint rules, including React and hooks rules, and runs much faster; teams often run it alongside ESLint, letting Oxlint handle what it covers. Biome (2.x) is a single tool for formatting and linting with its own rule set. Both are worth considering for large repos; ESLint remains the one with the full plugin ecosystem, including the Compiler-powered rules.
Formatting: Prettier, Biome, Oxfmt#
A formatter rewrites code into one canonical layout, so diffs show real changes and nobody argues about semicolons in review. Prettier (3.x) is the standard, with support for every file type a React project has. Biome formats JavaScript, TypeScript, JSX, JSON and CSS with Prettier-compatible output, in one binary that also lints. Oxfmt, from the Oxc project, is a newer Prettier-compatible formatter, still pre-1.0.
Whichever you choose, the setup rules are the same: format on save in the editor, check formatting in CI (prettier --check .), and don't lint formatting: turn off ESLint's stylistic rules (eslint-config-prettier does this) so the two tools never fight.
TypeScript strictness#
strict: true is the floor, not the ceiling. The settings that pay off most in a React codebase:
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler", // resolve like Vite and Next.js do
"jsx": "react-jsx", // the automatic JSX runtime
"noEmit": true, // the bundler emits; tsc only checks
"isolatedModules": true, // every file must be transpilable on its own (SWC, Oxc, esbuild)
"verbatimModuleSyntax": true, // forces `import type` for type-only imports
"skipLibCheck": true,
"strict": true, // strictNullChecks, noImplicitAny and friends
"noUncheckedIndexedAccess": true, // books[0] is Book | undefined
"exactOptionalPropertyTypes": true, // `size?: number` doesn't accept undefined explicitly
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true
}
}isolatedModules and verbatimModuleSyntax exist because of the build pipeline from Starting a React app: per-file transpilers can't see other files, so they can't know whether an import is a type that should be erased. These flags make your code safe for them. noUncheckedIndexedAccess is the one that finds the most real bugs: array and record lookups that might be missing. Type checking itself got much faster with TypeScript 7.0 (July 2026), the Go-native port of the compiler, which makes running tsc in CI and in the editor on large codebases far less painful.
Storybook: components in isolation#
Storybook (current major: 10) is a workshop for building and reviewing components outside the app. Each story renders a component in one specific state: empty, loading, error, long text, right-to-left, a narrow viewport. The states that are hard to reach by clicking through the app (an error from page four of a wizard) are one click away. Set it up with npm create storybook@latest; for Vite projects it uses the @storybook/react-vite framework.
import type { Meta, StoryObj } from "@storybook/react-vite";
import { expect } from "storybook/test";
import { BookCard } from "./BookCard";
const meta = {
component: BookCard,
args: { title: "Refactoring", author: "Martin Fowler", read: false },
} satisfies Meta<typeof BookCard>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Unread: Story = {};
export const Read: Story = { args: { read: true } };
export const LongTitle: Story = {
args: { title: "Structure and Interpretation of Computer Programs, Second Edition" },
};
// A play function is an interaction test that runs in the story.
export const TogglesRead: Story = {
play: async ({ canvas, userEvent }) => {
const checkbox = canvas.getByRole("checkbox", { name: "Read" });
await userEvent.click(checkbox);
await expect(checkbox).toBeChecked();
},
};What makes it more than a gallery:
- Args are a story's props, editable live in the UI, and typed from the component with
satisfies Meta<typeof BookCard>. - Play functions are interaction tests written with Testing Library's API, run inside the story.
- The Vitest addon (
@storybook/addon-vitest) runs every story as a test in Vitest's browser mode, so each story is at least a smoke test and play functions become real tests in CI. - The accessibility addon runs axe on every story, and visual regression services diff screenshots per story.
- MSW handlers from the testing chapter can back stories that fetch.
Storybook 10 is ESM-only and added module automocking and a preview of typesafe CSF Factories for React. Its cost is a second build setup to maintain; it pays off most for design systems and shared component libraries.
React DevTools beyond the Profiler#
The Measure first chapter used the Profiler. React DevTools (current: 8.0) does a lot more, and knowing it well is a quiet productivity multiplier.
Components tab. The React tree, not the DOM tree: components, their props, state, hooks (named, with values) and context. You can edit props and state live, which is the fastest way to see a component in a state that's hard to reach. Select an element in the page with the picker, or search the tree by name.
"Rendered by": owners, not parents. The side panel lists a component's owners: the chain of components that created it, which can differ from its parents in the tree. If Layout renders {children} and Page passed a Sidebar as those children, Sidebar's parent is Layout but its owner is Page, the component whose props and state decided to render it. When you're asking "why is this here, and why did it re-render with these props?", owners are the answer. React 19.1 put the same information into errors: Owner Stacks in development show which components rendered the failing one, and DevTools 7 displays owner stacks in the "rendered by" view.
Highlight updates when components render. A settings checkbox that flashes an outline on every component as it re-renders. Type in an input and watch: if half the page flashes, state is too high or a context value is unstable. It's the quickest visual check before opening the Profiler.
Compiler badges. Components optimized by the React Compiler show a "Memo ✨" badge, so you can see what the Compiler handled and what it skipped (the lint rules above tell you why).
Suspense tab. On by default since DevTools 8.0: inspect Suspense boundaries, see what a component suspended on, and toggle boundaries into their fallback state to check loading UI. DevTools 8 also adds a React pane to the browser's Elements panel showing the component behind a selected DOM node, shows <Activity> subtrees (dimmed when hidden), and removed its old Timeline profiler in favor of the React tracks in the browser's own Performance panel.
Strict Mode double renders. In development, Strict Mode calls components twice; DevTools dims the console logs from the second call (configurable), which explains "why does my log appear twice, once grayed out?".
Pitfalls#
Check your understanding#
This counter ticks every 100 ms by step. It stops after one tick, and changing the step does nothing. ESLint's exhaustive-deps rule would flag the effect. Fix it so the count keeps going and always uses the current step.
import { useEffect, useState } from "react";
export default function App() {
const [count, setCount] = useState(0);
const [step, setStep] = useState(1);
useEffect(() => {
const id = setInterval(() => setCount(count + step), 100);
return () => clearInterval(id);
}, []);
return (
<div>
<p>Count: {count}</p>
<label>
Step <input type="number" value={step} onChange={(e) => setStep(Number(e.target.value))} />
</label>
</div>
);
}With eslint-plugin-react-hooks's recommended preset, predict which rule flags each component.
function A({ items }: { items: string[] }) {
items.sort(); // 1
return <List items={items} />;
}
function B({ user }: { user: User | null }) {
if (!user) return null;
const [tab, setTab] = useState("profile"); // 2
return <Tabs value={tab} onChange={setTab} />;
}
function C() {
const id = Math.random(); // 3
return <input id={String(id)} />;
}
function D() {
function Row({ text }: { text: string }) { // 4
return <li>{text}</li>;
}
return <ul><Row text="a" /></ul>;
}
function E() {
const ref = useRef(0);
ref.current += 1; // 5
return <p>Rendered {ref.current} times</p>;
}Why do most projects add eslint-config-prettier when they use both ESLint and Prettier?
"You're setting up tooling for a new React and TypeScript project for a team of eight. What do you put in place, and why?"
Interview angle
Good tooling catches bugs as early as possible. ESLint, now flat-config only in version 10, with eslint-plugin-react-hooks checks the Rules of Hooks, dependency arrays and, since version 7, the React Compiler's assumptions: pure renders, no ref reads in render, no mutation of props or state. A formatter like Prettier or Biome owns layout so lint rules stay about correctness. TypeScript goes beyond strict with noUncheckedIndexedAccess and runs in CI, because bundlers don't type-check. Storybook builds and tests components in every state, and React DevTools shows the component tree, owners, re-render highlights, Compiler badges and Suspense boundaries.
What does eslint-plugin-react-hooks check, and why does it matter more now?
exhaustive-deps says your effect is missing a dependency, but adding it causes a loop. What do you do?
What is ESLint flat config, and what changed in ESLint 10?
In React DevTools, what's the difference between a component's parent and its owner?
What does Storybook give you beyond unit tests?
Recap#
- Tools catch the cheapest bugs earliest: editor, then component workshop, then CI, then the running app.
- ESLint 10 uses flat config only.
eslint-plugin-react-hooks7'srecommendedpreset checks the Rules of Hooks, dependency arrays and the React Compiler's assumptions (purity, refs, immutability, setState in render or effects, nested components). Next.js 16 removednext lint; Oxlint and Biome are faster alternatives. - Let a formatter (Prettier, Biome, or the newer Oxfmt) own layout and turn off stylistic lint rules.
- Go beyond
strict:noUncheckedIndexedAccess,exactOptionalPropertyTypes,isolatedModulesandverbatimModuleSyntaxfor per-file transpilers; runtscin CI. - Storybook 10 renders components in every state, runs play functions and stories as tests. React DevTools 8 shows owners, highlights renders, marks Compiler-optimized components and has a Suspense tab.
Sources#
- react.dev: eslint-plugin-react-hooks and its README; React Compiler: debugging; captureOwnerStack
- ESLint: v10.0.0 released, Configuration files
- Next.js: ESLint configuration
- Oxlint, Oxfmt, Biome, Prettier, eslint-config-prettier
- TypeScript: TSConfig reference, Announcing TypeScript 7.0
- Storybook: Storybook 10, Writing stories, Vitest addon
- React DevTools: changelog
- Facts checked November 24, 2026.