Rules Overview

Emoji Legend

  • πŸ’Ό - Rule Category
  • β›” - Restriction
  • βœ”οΈ - Correctness
  • 🎨 - Style
  • 🐞 - Debug
  • πŸ“– - Convention
  • πŸ”’ - Security
  • πŸ€” - Pedantic
  • 🀯 - Complexity
  • 🧐 - Suspicious
  • πŸš€ - Performance
  • πŸ†• - New
  • 🚧 - WIP
  • πŸ“ - Strict
  • πŸ—‘οΈ - Deprecated
  • πŸ’­ - Requires Type Information

Core Rules

RuleDescriptionπŸ’ΌπŸ’­
avoid-shorthand-booleanPrevents using shorthand syntax for boolean attributes.🎨
avoid-shorthand-fragmentPrevents using shorthand syntax for fragments.🎨
ensure-forward-ref-using-refRequires that components wrapped with forwardRef must have a ref parameter.βœ”οΈ
no-access-state-in-setstatePrevents accessing this.state inside setState calls.βœ”οΈ
no-array-index-keyPrevents using array index as key.🧐
no-children-countPrevents using Children.count.β›”
no-children-for-eachPrevents using Children.forEach.β›”
no-children-mapPrevents using Children.map.β›”
no-children-onlyPrevents using Children.only.β›”
no-children-propPrevents using children as a prop.β›”πŸ“
no-children-to-arrayPrevents using Children.toArray.β›”
no-class-componentPrevents using class component.β›”
no-clone-elementPrevents using cloneElement.β›”
no-comment-textnodesPrevents comments from being inserted as text nodes.🧐
no-complex-conditional-renderingPrevents complex conditional rendering in JSX.πŸ€―πŸ“
no-component-will-mountPrevents using componentWillMount.β›”
no-component-will-receive-propsPrevents using componentWillReceiveProps.β›”
no-component-will-updatePrevents using componentWillUpdate.β›”
no-create-refPrevents using createRef.β›”
no-default-propsPrevents using defaultProps property in favor of ES6 default parameters.βœ”οΈ
no-direct-mutation-statePrevents direct mutation of this.state.βœ”οΈ
no-duplicate-keyPrevents duplicate key on elements in the same array or a list of children.βœ”οΈ
no-implicit-keyPrevents key from not being explicitly specified (e.g. spreading key from objects).🧐
no-leaked-conditional-renderingPrevents problematic leaked values from being rendered.πŸ§πŸ’­
no-missing-component-display-nameEnforces that all components have a displayName which can be used in devtools.🐞
no-missing-keyPrevents missing key on items in list rendering.βœ”οΈ
no-nested-componentsPrevents nesting component definitions inside other components.βœ”οΈ
no-prop-typesPrevents using propTypes in favor of TypeScript or another type-checking solution.β›”
no-redundant-should-component-updatePrevents using shouldComponentUpdate when extending React.PureComponent.βœ”οΈ
no-set-state-in-component-did-mountPrevents calling this.setState in componentDidMount outside of functions, such as callbacks.🧐
no-set-state-in-component-did-updatePrevents calling this.setState in componentDidUpdate outside of functions, such as callbacks.🧐
no-set-state-in-component-will-updatePrevents calling this.setState in componentWillUpdate outside of functions, such as callbacks.🧐
no-string-refsPrevents using deprecated string refs.β›”
no-unsafe-component-will-mountWarns the usage of UNSAFE_componentWillMount in class components.🧐
no-unsafe-component-will-receive-propsWarns the usage of UNSAFE_componentWillReceiveProps in class components.🧐
no-unsafe-component-will-updateWarns the usage of UNSAFE_componentWillUpdate in class components.🧐
no-unstable-context-valuePrevents non-stable values (i.e. object literals) from being used as a value for Context.Provider.πŸš€
no-unstable-default-propsPrevents using referential-type values as default props in object destructuring.πŸš€
no-unused-class-component-membersWarns unused class component methods and properties.βœ”οΈ
no-unused-stateWarns unused class component state.βœ”οΈ
no-useless-fragmentPrevents using useless fragment components or <> syntax.βœ”οΈ
prefer-destructuring-assignmentEnforces using destructuring assignment over property assignment.🎨
prefer-react-namespace-importEnforce React is imported via a namespace import🎨
prefer-read-only-propsEnforces read-only props in components.βœ”οΈπŸ’­
prefer-shorthand-booleanEnforces using shorthand syntax for boolean attributes.🎨
prefer-shorthand-fragmentEnforces using shorthand syntax for fragments.🎨

DOM Rules

RuleDescriptionπŸ’ΌπŸ’­
dom/no-children-in-void-dom-elementsPrevents using children in void DOM elements.βœ”οΈ
dom/no-dangerously-set-innerhtmlPrevents DOM element using dangerouslySetInnerHTML.πŸ”’
dom/no-dangerously-set-innerhtml-with-childrenPrevents DOM element using dangerouslySetInnerHTML and children at the same time.βœ”οΈ
dom/no-find-dom-nodePrevents using findDOMNode.β›”
dom/no-missing-button-typeEnforces explicit type attribute for <button> elements.βœ”οΈπŸ“
dom/no-missing-iframe-sandboxEnforces explicit sandbox attribute for iframe elements.πŸ”’
dom/no-namespaceEnforces the absence of a namespace in React elements.βœ”οΈ
dom/no-render-return-valuePrevents using the return value of ReactDOM.render.β›”
dom/no-script-urlPrevents using javascript: URLs as the value of certain attributes.πŸ”’
dom/no-unsafe-iframe-sandboxEnforces sandbox attribute for iframe elements is not set to unsafe combinations.πŸ”’
dom/no-unsafe-target-blankPrevents using target="_blank" without rel="noreferrer noopener".πŸ”’

Web API Rules

RuleDescriptionπŸ’ΌπŸ’­
web-api/no-leaked-event-listenerPrevents leaked addEventListener in a component or custom hook.βœ”οΈπŸ†•
web-api/no-leaked-intervalPrevents leaked setInterval in a component or custom hook.βœ”οΈπŸ†•
web-api/no-leaked-resize-observerPrevents leaked ResizeObserver in a component or custom hook.βœ”οΈπŸ†•
web-api/no-leaked-timeoutPrevents leaked setTimeout in a component or custom hook.βœ”οΈπŸ†•

Hooks Extra Rules

RuleDescriptionπŸ’ΌπŸ’­
hooks-extra/no-direct-set-state-in-use-effectDisallow direct calls to the set function of useState in useEffect.βœ”οΈπŸ“
hooks-extra/no-direct-set-state-in-use-layout-effectDisallow direct calls to the set function of useState in useLayoutEffect.βœ”οΈπŸ“
hooks-extra/no-redundant-custom-hookWarns when custom Hooks that don’t use other Hooks.βœ”οΈ
hooks-extra/no-unnecessary-use-callbackDisallow unnecessary usage of useCallback.βœ”οΈπŸ“
hooks-extra/no-unnecessary-use-memoDisallow unnecessary usage of useMemo.βœ”οΈπŸ“
hooks-extra/prefer-use-state-lazy-initializationWarns function calls made inside useState calls.πŸš€

Naming Convention Rules

RuleDescriptionπŸ’ΌπŸ’­
naming-convention/component-nameEnforces naming conventions for components.πŸ“–
naming-convention/filenameEnforces naming convention for JSX files.πŸ“–
naming-convention/filename-extensionEnforces consistent use of the JSX file extension.πŸ“–
naming-convention/use-stateEnforces destructuring and symmetric naming of useState hook value and setter variables.πŸ“–

Debug Rules

RuleDescriptionπŸ’ΌπŸ’­
debug/class-componentReports all class components.🐞
debug/function-componentReports all function components.🐞
debug/hookReports all react hooks.🐞
debug/is-from-reactReports all identifiers that are initialized from React.🐞