React

React-specific linting rules for Ultracite.

The React configuration has React-specific linting rules for JSX, hooks, and component patterns.

Installation

Add the React configuration to your biome.jsonc:

biome.jsonc
{
  "extends": ["ultracite/core", "ultracite/react"]
}

Overview

This configuration adds rules specific to React development:

  • JSX Rules: Enforce proper JSX syntax and patterns
  • Hooks Rules: Ensure React hooks are used correctly
  • Component Rules: Enforce React component best practices
  • Children Handling: Prevent improper children prop usage

React-Specific Rules

Correctness

RuleSettingDescription
noChildrenProperrorPrevent passing children as props. Children should be nested between the opening and closing tags.
noNestedComponentDefinitionserrorPrevent component definitions inside other components. This causes unnecessary re-renders.
noReactPropAssignmentserrorPrevent reassigning props in React components. Props should be treated as immutable.
noRenderReturnValueerrorPrevent usage of the return value from ReactDOM.render().
noVoidElementsWithChildrenerrorPrevent void elements (like <img>, <br>) from having children.
useExhaustiveDependencieserrorEnforce all dependencies are correctly specified in React hooks (useEffect, useCallback, useMemo).
useHookAtTopLevelerrorEnforce that all React hooks are called from the top level of component functions, not inside loops, conditions, or nested functions.
useJsxKeyInIterableerrorEnforce that elements in iterables have a key prop for React's reconciliation.

Nursery

RuleSettingDescription
noReactForwardReferrorPrevent usage of legacy React.forwardRef. Use ref as a prop instead (React 19+).
useReactFunctionComponentserrorEnforce using function components over class components in React.

Suspicious

RuleSettingDescription
noArrayIndexKeyerrorPrevent using array indices as keys. Array indices are not stable identifiers and can cause issues with component state.
noDuplicateJsxPropserrorPrevent duplicate properties in JSX.
noSuspiciousSemicolonInJsxerrorPrevent semicolons that change the semantic of JSX elements.
noReactSpecificPropsoffAllow React-specific props like className and htmlFor.

How is this guide?