Rules Overview

Legend

  • βš™οΈ - Configurable
  • πŸ” - Linting
  • πŸ”§ - Fixable
  • πŸ”„ - Codemod
  • πŸ’­ - Type Chcking
  • 🐞 - Debug
  • πŸ—‘οΈ - Deprecated
  • 0️⃣ - Severity 0
  • 1️⃣ - Severity 1
  • 2️⃣ - Severity 2
  • βœ… - Severity in recommended presets

Core Rules

Ruleβœ…FeaturesDescriptionReact
ensure-forward-ref-using-ref1οΈβƒ£πŸ”Requires that components wrapped with forwardRef must have a ref parameter.
no-access-state-in-setstate2οΈβƒ£πŸ”Prevents accessing this.state inside setState calls.
no-array-index-key1οΈβƒ£πŸ”Prevents using array index as key.
no-children-count1οΈβƒ£πŸ”Prevents using Children.count.
no-children-for-each1οΈβƒ£πŸ”Prevents using Children.forEach.
no-children-map1οΈβƒ£πŸ”Prevents using Children.map.
no-children-only1οΈβƒ£πŸ”Prevents using Children.only.
no-children-prop0οΈβƒ£πŸ”Prevents using children as a prop.
no-children-to-array1οΈβƒ£πŸ”Prevents using Children.toArray.
no-class-component0οΈβƒ£πŸ”Prevents using class component.
no-clone-element1οΈβƒ£πŸ”Prevents using cloneElement.
no-comment-textnodes1οΈβƒ£πŸ”Prevents comments from being inserted as text nodes.
no-complex-conditional-rendering0οΈβƒ£πŸ”Prevents complex conditional rendering in JSX.
no-component-will-mount2οΈβƒ£πŸ” πŸ”„Prevents using componentWillMount.>=16.3.0
no-component-will-receive-props2οΈβƒ£πŸ” πŸ”„Prevents using componentWillReceiveProps.>=16.3.0
no-component-will-update2οΈβƒ£πŸ” πŸ”„Prevents using componentWillUpdate.>=16.3.0
no-context-provider1οΈβƒ£πŸ” πŸ”„Prevents using <Context.Provider>.>=19.0.0
no-create-ref2οΈβƒ£πŸ”Prevents using createRef.
no-default-props2οΈβƒ£πŸ”Prevents using defaultProps property in favor of ES6 default parameters.
no-direct-mutation-state2οΈβƒ£πŸ”Prevents direct mutation of this.state.
no-duplicate-jsx-props1οΈβƒ£πŸ”Prevents duplicate props in JSX.
no-duplicate-key2οΈβƒ£πŸ”Prevents duplicate key on elements in the same array or a list of children.
no-forward-ref1οΈβƒ£πŸ” πŸ”„Prevents using React.forwardRef.>=19.0.0
no-implicit-key1οΈβƒ£πŸ”Prevents key from not being explicitly specified (e.g. spreading key from objects).
no-leaked-conditional-rendering1οΈβƒ£πŸ” πŸ’­Prevents problematic leaked values from being rendered.
no-missing-component-display-name0οΈβƒ£πŸ”Enforces that all components have a displayName which can be used in devtools.
no-missing-key2οΈβƒ£πŸ”Prevents missing key on items in list rendering.
no-nested-components2οΈβƒ£πŸ”Prevents nesting component definitions inside other components.
no-prop-types2οΈβƒ£πŸ”Prevents using propTypes in favor of TypeScript or another type-checking solution.
no-redundant-should-component-update2οΈβƒ£πŸ”Prevents using shouldComponentUpdate when extending React.PureComponent.
no-set-state-in-component-did-mount1οΈβƒ£πŸ”Prevents calling this.setState in componentDidMount outside of functions, such as callbacks.
no-set-state-in-component-did-update1οΈβƒ£πŸ”Prevents calling this.setState in componentDidUpdate outside of functions, such as callbacks.
no-set-state-in-component-will-update1οΈβƒ£πŸ”Prevents calling this.setState in componentWillUpdate outside of functions, such as callbacks.
no-string-refs2οΈβƒ£πŸ”Prevents using deprecated string refs.
no-unsafe-component-will-mount1οΈβƒ£πŸ”Warns the usage of UNSAFE_componentWillMount in class components.
no-unsafe-component-will-receive-props1οΈβƒ£πŸ”Warns the usage of UNSAFE_componentWillReceiveProps in class components.
no-unsafe-component-will-update1οΈβƒ£πŸ”Warns the usage of UNSAFE_componentWillUpdate in class components.
no-unstable-context-value1οΈβƒ£πŸ”Prevents non-stable values (i.e. object literals) from being used as a value for Context.Provider.
no-unstable-default-props1οΈβƒ£πŸ”Prevents using referential-type values as default props in object destructuring.
no-unused-class-component-members0οΈβƒ£πŸ”Warns unused class component methods and properties.
no-unused-state1οΈβƒ£πŸ”Warns unused class component state.
no-useless-fragment1οΈβƒ£πŸ” βš™οΈPrevents using useless fragment components or <> syntax.
prefer-destructuring-assignment0οΈβƒ£πŸ”Enforces using destructuring assignment over property assignment.
prefer-react-namespace-import0οΈβƒ£πŸ” πŸ”§Enforces React is imported via a namespace import
prefer-read-only-props0οΈβƒ£πŸ” πŸ’­Enforces read-only props in components.
prefer-shorthand-boolean0οΈβƒ£πŸ” πŸ”§Enforces using shorthand syntax for boolean attributes.
prefer-shorthand-fragment0οΈβƒ£πŸ”Enforces using shorthand syntax for fragments.
use-jsx-vars1️⃣Helpes eslint/no-unused-vars to correctly detect variables used in JSX.

Deprecated

RuleReplaced by
jsx-uses-varsuse-jsx-vars
jsx-no-duplicate-propsno-duplicate-jsx-props
no-complicated-conditional-renderingno-complex-conditional-rendering

DOM Rules

Ruleβœ…FeaturesDescription
no-void-elements-with-children2οΈβƒ£πŸ”Prevents using children in void DOM elements.
no-dangerously-set-innerhtml-with-children2οΈβƒ£πŸ”Prevents DOM element using dangerouslySetInnerHTML and children at the same time.
no-dangerously-set-innerhtml1οΈβƒ£πŸ”Prevents DOM element using dangerouslySetInnerHTML.
no-find-dom-node2οΈβƒ£πŸ”Prevents using findDOMNode.
no-missing-button-type1οΈβƒ£πŸ”Enforces explicit type attribute for button elements.
no-missing-iframe-sandbox1οΈβƒ£πŸ”Enforces explicit sandbox attribute for iframe elements.
no-namespace2οΈβƒ£πŸ”Enforces the absence of a namespace in React elements.
no-render-return-value2οΈβƒ£πŸ”Prevents using the return value of ReactDOM.render.
no-script-url1οΈβƒ£πŸ”Prevents using javascript: URLs as the value of certain attributes.
no-unknown-property0οΈβƒ£πŸ” πŸ”§ βš™οΈPrevents using unknown DOM property
no-unsafe-iframe-sandbox1οΈβƒ£πŸ”Enforces sandbox attribute for iframe elements is not set to unsafe combinations.
no-unsafe-target-blank1οΈβƒ£πŸ”Prevents using target="_blank" without rel="noreferrer noopener".

Deprecated

RuleReplaced by
dom-no-children-in-void-dom-elementsno-void-elements-with-children

Web API Rules

Ruleβœ…FeaturesDescription
no-leaked-event-listener1οΈβƒ£πŸ”Prevents leaked addEventListener in a component or custom hook.
no-leaked-interval1οΈβƒ£πŸ”Prevents leaked setInterval in a component or custom hook.
no-leaked-resize-observer1οΈβƒ£πŸ”Prevents leaked ResizeObserver in a component or custom hook.
no-leaked-timeout1οΈβƒ£πŸ”Prevents leaked setTimeout in a component or custom hook.

Hooks Extra Rules

Ruleβœ…FeaturesDescription
no-direct-set-state-in-use-effect1οΈβƒ£πŸ”Disallow direct calls to the set function of useState in useEffect.
no-direct-set-state-in-use-layout-effect0οΈβƒ£πŸ”Disallow direct calls to the set function of useState in useLayoutEffect.
no-unnecessary-use-callback0οΈβƒ£πŸ”Disallow unnecessary usage of useCallback.
no-unnecessary-use-memo0οΈβƒ£πŸ”Disallow unnecessary usage of useMemo.
no-useless-custom-hooks1οΈβƒ£πŸ”Disallow redundant custom hooks definitions.
prefer-use-state-lazy-initialization1οΈβƒ£πŸ”Warns function calls made inside useState calls.

Deprecated

RuleReplaced by
no-useless-custom-hooksno-useless-custom-hooks
ensure-custom-hooks-using-other-hooksno-useless-custom-hooks
ensure-use-memo-has-non-empty-depsno-unnecessary-use-memo
ensure-use-callback-has-non-empty-depsno-unnecessary-use-callback

Naming Convention Rules

Ruleβœ…FeaturesDescription
component-name0οΈβƒ£πŸ” βš™οΈEnforces naming conventions for components.
filename0οΈβƒ£πŸ” βš™οΈEnforces naming convention for JSX files.
filename-extension0οΈβƒ£πŸ” βš™οΈEnforces consistent use of the JSX file extension.
use-state0οΈβƒ£πŸ”Enforces destructuring and symmetric naming of useState hook value and setter variables.

Debug Rules

Ruleβœ…FeaturesDescription
class-component0οΈβƒ£πŸžReports all class components.
function-component0οΈβƒ£πŸžReports all function components.
hook0οΈβƒ£πŸžReports all react hooks.
is-from-react0οΈβƒ£πŸžReports all identifiers that are initialized from React.