Skip to content

React

Scope: web front ends built with React, either on their own or inside a framework. Framework-independent rules for accessibility, Core Web Vitals (WEB-4) and browser security are in Web front end.

Entries are sorted by score from 1 to 10 (criteria): 9โ€“10 start here or strongly recommended, 6โ€“8 recommended, 1โ€“5 further reading or conditional.

Adopted references

Key rules

How to enforce

Tools that check the key rules above automatically, in CI, the IDE or a commit hook. "Partly" means the tool covers only some of what the rule asks.

  • 8 eslint-plugin-react-hooks: the official lint rules, including the React Compiler checks. purity flags impure components and hooks, and set-state-in-effect flags data transformed or state derived in Effects. Checks REACT-1 and REACT-3, and partly REACT-2.
  • 5 eslint-plugin-testing-library: flags tests that reach into DOM nodes or containers instead of using user-facing queries. Checks REACT-6.
  • 5 eslint-plugin-boundaries: enforces which folders may import which, for example no imports across features, or from components into data access. Checks REACT-10, and partly REACT-11.

Tutorials and further reading