Rules Overview

Emoji Legend

  • βš™οΈ - Configurable
  • πŸ” - Linting
  • πŸ”§ - Fixable
  • πŸ”„ - Codemod
  • πŸ’­ - Type Chcking
  • 🐞 - Debug
  • πŸ—‘οΈ - Deprecated

Core Rules

RuleFeaturesMin. ReactDescription
ensure-forward-ref-using-refπŸ”Requires that components wrapped with forwardRef must have a ref parameter.
jsx-no-duplicate-propsπŸ”Prevents duplicate props in JSX.
jsx-uses-varsHelper rule to mark variables as used in JSX.
no-access-state-in-setstateπŸ”Prevents accessing this.state inside setState calls.
no-array-index-keyπŸ”Prevents using array index as key.
no-children-countπŸ”Prevents using Children.count.
no-children-for-eachπŸ”Prevents using Children.forEach.
no-children-mapπŸ”Prevents using Children.map.
no-children-onlyπŸ”Prevents using Children.only.
no-children-propπŸ”Prevents using children as a prop.
no-children-to-arrayπŸ”Prevents using Children.toArray.
no-class-componentπŸ”Prevents using class component.
no-clone-elementπŸ”Prevents using cloneElement.
no-comment-textnodesπŸ”Prevents comments from being inserted as text nodes.
no-complex-conditional-renderingπŸ”Prevents complex conditional rendering in JSX.
no-component-will-mountπŸ” πŸ”„16.3.0Prevents using componentWillMount.
no-component-will-receive-propsπŸ” πŸ”„16.3.0Prevents using componentWillReceiveProps.
no-component-will-updateπŸ” πŸ”„16.3.0Prevents using componentWillUpdate.
no-context-providerπŸ” πŸ”„19.0.0Prevents using <Context.Provider>.
no-create-refπŸ”Prevents using createRef.
no-default-propsπŸ”Prevents using defaultProps property in favor of ES6 default parameters.
no-direct-mutation-stateπŸ”Prevents direct mutation of this.state.
no-duplicate-keyπŸ”Prevents duplicate key on elements in the same array or a list of children.
no-forward-refπŸ” πŸ”„19.0.0Prevents using React.forwardRef.
no-implicit-keyπŸ”Prevents key from not being explicitly specified (e.g. spreading key from objects).
no-leaked-conditional-renderingπŸ” πŸ’­Prevents problematic leaked values from being rendered.
no-missing-component-display-nameπŸ”Enforces that all components have a displayName which can be used in devtools.
no-missing-keyπŸ”Prevents missing key on items in list rendering.
no-nested-componentsπŸ”Prevents nesting component definitions inside other components.
no-prop-typesπŸ”Prevents using propTypes in favor of TypeScript or another type-checking solution.
no-redundant-should-component-updateπŸ”Prevents using shouldComponentUpdate when extending React.PureComponent.
no-set-state-in-component-did-mountπŸ”Prevents calling this.setState in componentDidMount outside of functions, such as callbacks.
no-set-state-in-component-did-updateπŸ”Prevents calling this.setState in componentDidUpdate outside of functions, such as callbacks.
no-set-state-in-component-will-updateπŸ”Prevents calling this.setState in componentWillUpdate outside of functions, such as callbacks.
no-string-refsπŸ”Prevents using deprecated string refs.
no-unsafe-component-will-mountπŸ”Warns the usage of UNSAFE_componentWillMount in class components.
no-unsafe-component-will-receive-propsπŸ”Warns the usage of UNSAFE_componentWillReceiveProps in class components.
no-unsafe-component-will-updateπŸ”Warns the usage of UNSAFE_componentWillUpdate in class components.
no-unstable-context-valueπŸ”Prevents non-stable values (i.e. object literals) from being used as a value for Context.Provider.
no-unstable-default-propsπŸ”Prevents using referential-type values as default props in object destructuring.
no-unused-class-component-membersπŸ”Warns unused class component methods and properties.
no-unused-stateπŸ”Warns unused class component state.
no-useless-fragmentπŸ” βš™οΈPrevents using useless fragment components or <> syntax.
prefer-destructuring-assignmentπŸ”Enforces using destructuring assignment over property assignment.
prefer-react-namespace-importπŸ” πŸ”§Enforce React is imported via a namespace import
prefer-read-only-propsπŸ” πŸ’­Enforces read-only props in components.
prefer-shorthand-booleanπŸ” πŸ”§Enforces using shorthand syntax for boolean attributes.
prefer-shorthand-fragmentπŸ”Enforces using shorthand syntax for fragments.

DOM Rules

RuleFeaturesDescription
no-children-in-void-dom-elementsπŸ”Prevents using children in void DOM elements.
no-dangerously-set-innerhtml-with-childrenπŸ”Prevents DOM element using dangerouslySetInnerHTML and children at the same time.
no-dangerously-set-innerhtmlπŸ”Prevents DOM element using dangerouslySetInnerHTML.
no-find-dom-nodeπŸ”Prevents using findDOMNode.
no-missing-button-typeπŸ”Enforces explicit type attribute for <button> elements.
no-missing-iframe-sandboxπŸ”Enforces explicit sandbox attribute for iframe elements.
no-namespaceπŸ”Enforces the absence of a namespace in React elements.
no-render-return-valueπŸ”Prevents using the return value of ReactDOM.render.
no-script-urlπŸ”Prevents using javascript: URLs as the value of certain attributes.
no-unknown-propertyπŸ” πŸ”§ βš™οΈPrevents using unknown DOM property
no-unsafe-iframe-sandboxπŸ”Enforces sandbox attribute for iframe elements is not set to unsafe combinations.
no-unsafe-target-blankπŸ”Prevents using target="_blank" without rel="noreferrer noopener".

Web API Rules

RuleFeaturesDescription
no-leaked-event-listenerπŸ”Prevents leaked addEventListener in a component or custom hook.
no-leaked-intervalπŸ”Prevents leaked setInterval in a component or custom hook.
no-leaked-resize-observerπŸ”Prevents leaked ResizeObserver in a component or custom hook.
no-leaked-timeoutπŸ”Prevents leaked setTimeout in a component or custom hook.

Hooks Extra Rules

RuleFeaturesDescription
no-direct-set-state-in-use-effectπŸ”Disallow direct calls to the set function of useState in useEffect.
no-direct-set-state-in-use-layout-effectπŸ”Disallow direct calls to the set function of useState in useLayoutEffect.
no-redundant-custom-hookπŸ”Warns when custom Hooks that don’t use other Hooks.
no-unnecessary-use-callbackπŸ”Disallow unnecessary usage of useCallback.
no-unnecessary-use-memoπŸ”Disallow unnecessary usage of useMemo.
prefer-use-state-lazy-initializationπŸ”Warns function calls made inside useState calls.

Naming Convention Rules

RuleFeaturesDescription
component-nameπŸ” βš™οΈEnforces naming conventions for components.
filenameπŸ” βš™οΈEnforces naming convention for JSX files.
filename-extensionπŸ” βš™οΈEnforces consistent use of the JSX file extension.
use-stateπŸ”Enforces destructuring and symmetric naming of useState hook value and setter variables.

Debug Rules

RuleFeaturesDescription
class-component🐞Reports all class components.
function-component🐞Reports all function components.
hook🐞Reports all react hooks.
is-from-react🐞Reports all identifiers that are initialized from React.