Skip to content

React

react adds the React, hooks, and Fast Refresh lint rules to every React project. react-dom adds accessibility rules for React apps in the browser, and runs one check:

Check Stage Level What it does
react-dom/react-versions commit basic Checks that react and react-dom resolve to the same version.

React sources get the browser globals, as JavaScript runtimes describes.

javascript/eslint runs the recommended presets of @eslint-react/eslint-plugin and eslint-plugin-react-refresh, and the recommended-latest preset of eslint-plugin-react-hooks. It also reports dangerouslySetInnerHTML, unstable context values, and unstable default props.

Level all adds rules for array index keys, component display names, and the names of useState values, contexts, IDs, and refs. It also reports the FC type, with the message “Declare the props type on the parameter instead of FC.”

react-dom adds the recommended preset of eslint-plugin-jsx-a11y-x, which checks labels, alternative text, and keyboard access.

React stops at run time when react and react-dom differ, so before each commit, react-dom/react-versions checks that they resolve to the same version. It reads the lockfile of the scope, or the version ranges of package.json when no lockfile exists:

failed react-dom/react-versions 1 finding
package.json:1 react-versions react 19.1.0 and react-dom 19.0.0 differ, and React stops at run time when they do. Install the same version of both.

Level all reports a small private function that at most one place uses, a small exported function that one place calls, and a file that only forwards to another module. A short component in a .jsx or .tsx file passes these rules, but a small exported hook that one place calls gets a finding. The naming checks accept a file name in PascalCase or kebab-case in these files, and PascalCase for a component function and for a variable that holds a component. In every JavaScript and TypeScript file of the scope, the naming checks do not count the set of a state setter, such as setSelectedItem, as a word.