jsx-eslint /eslint-plugin-react
React-specific linting rules for ESLint
★ 9,292⑂ 2,737👁 79⑃ 1,475● 2,597▤ 200
+1
Daily
9,292
stars
2,737
forks
79
watchers
1,475
prs
2,597
issues
200
releases
README
eslint-plugin-react [![Version Badge][npm-version-svg]][package-url]
===================
[![github actions][actions-image]][actions-url]
[![Maintenance Status][status-image]][status-url]
[![NPM version][npm-image]][npm-url]
[![Tidelift][tidelift-image]][tidelift-url]
React specific linting rules for eslint
Installation
sh
npm install eslint eslint-plugin-react --save-dev
It is also possible to install ESLint globally rather than locally (using npm install -g eslint). However, this is not recommended, and any plugins or shareable configs that you use must be installed locally in either case.
Configuration (legacy: .eslintrc)
Use our preset to get reasonable defaults:
json
"extends": [
"eslint:recommended",
"plugin:react/recommended"
]
If you are using the new JSX transform from React 17, extend react/jsx-runtime in your eslint config (add "plugin:react/jsx-runtime" to "extends") to disable the relevant rules.
You should also specify settings that will be shared across all the plugin rules. (More about eslint shared settings)
json5
{
"settings": {
"react": {
"createClass": "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
"pragma": "React", // Pragma to use, default to "React"
"fragment": "Fragment", // Fragment to use (may be a property of ), default to "Fragment"
"version": "detect", // React version. "detect" automatically picks the version you have installed.
// You can also use 16.0, 16.3, etc, if you want to override the detected value.
// Defaults to the "defaultVersion" setting and warns if missing, and to "detect" in the future
"defaultVersion": "", // Default React version to use when the version you have installed cannot be detected.
// If not provided, defaults to the latest React version.
"flowVersion": "0.53" // Flow version
},
"propWrapperFunctions": [
// The names of any function used to wrap propTypes, e.g. forbidExtraProps. If this isn't set, any propTypes wrapped in a function will be skipped.
"forbidExtraProps",
{"property": "freeze", "object": "Object"},
{"property": "myFavoriteWrapper"},
// for rules that check exact prop wrappers
{"property": "forbidExtraProps", "exact": true}
],
"componentWrapperFunctions": [
// The name of any function used to wrap components, e.g. Mobx observer function. If this isn't set, components wrapped by these functions will be skipped.
"observer", // property
{"property": "styled"}, // object is optional
{"property": "observer", "object": "Mobx"},
{"property": "observer", "object": ""} // sets object to whatever value settings.react.pragma is set to
],
"formComponents": [
// Components used as alternatives to for forms, eg.
"CustomForm",
Top issues
#3977ESLint v10 compatibility55 comments · 2026-02-07#2856[react/require-default-props] False positive with React.forwardRef29 comments · 2020-11-13#454jsx-indent rule with ternary operators on multiple lines and JSX elements29 comments · 2016-02-18#2777(react props) is missing in props validation ERROR28 comments · 2020-08-29#1848jsx-one-expression-per-line should ignore inline elements22 comments · 2018-06-25#2057Rule proposal: ssr-friendly21 comments · 2018-11-26#4014Results of weekly scheduled smoke test20 comments · 2026-05-31#494Allow prop-types rule to skip non-exported SFCs20 comments · 2016-03-09
Latest release
v7.37.5 v7.37.5 2025-04-03Fixed [no-unknown-property]: allow shadow root attrs on ([3912][] @ljharb) [prop-types]: support ComponentPropsWithRef from a namespace import ([3651][] @corydeppen) [jsx-no-constructed-context-values]: detect constructed context values in React 19 usage ([3910][] @TildaDares) [no-unknown-property]: allow transform-origin on rect ([3914][] @ljharb) Changed [Docs] [button-has-type]: clean up phrasing ([3909][] @hamirmahal) [3651]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3651 [3909]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3909 [3910]: https://g