Rules Overview
JSX
jsx/max-depth
- enforce a maximum depth that JSX can be nestedjsx/no-array-index-key
- disallow using Array index askey
jsx/no-comment-textnodes
- disallow comments from being inserted as text nodesjsx/no-complicated-conditional-rendering
- disallow complicated conditional renderingjsx/no-duplicate-key
- disallow duplicate keys inkey
prop when rendering listjsx/no-leaked-conditional-rendering
- disallow problematic leaked values from being renderedjsx/no-missing-key
- requirekey
prop when rendering listjsx/no-spreading-key
- disallow spreadingkey
from objects.jsx/no-useless-fragment
- disallow unnecessary fragmentsjsx/prefer-shorthand-boolean
- enforceboolean
attributes notation in JSXjsx/prefer-shorthand-fragment
- enforce using fragment syntax instead ofFragment
component
React
react/ensure-forward-ref-using-ref
- requires that components wrapped withforwardRef
must have aref
parameterreact/no-children-count
- disallowChildren.count
react/no-children-for-each
- disallowChildren.forEach
react/no-children-in-void-dom-elements
- disallow passingchildren
to void DOM elementsreact/no-children-map
- disallowChildren.map
react/no-children-only
- disallowChildren.only
react/no-children-prop
- disallow passing ofchildren
as propsreact/no-children-to-array
- disallowChildren.toArray
react/no-class-component
- disallowclass component
react/no-clone-element
- disallowcloneElement
react/no-component-will-mount
- disallowcomponentWillMount
react/no-component-will-receive-props
- disallowcomponentWillReceiveProps
react/no-component-will-update
- disallowcomponentWillUpdate
react/no-constructed-context-value
- disallow passing constructed values to context providersreact/no-create-ref
- disallowcreateRef
in function componentsreact/no-dangerously-set-innerhtml
- disallow when a DOM element is usingdangerouslySetInnerHTML
react/no-dangerously-set-innerhtml-with-children
- disallow when a DOM element is using bothchildren
anddangerouslySetInnerHTML
react/no-direct-mutation-state
- disallow direct mutation ofthis.state
react/no-find-dom-node
- disallowfindDOMNode
react/no-missing-button-type
- enforce thatbutton
elements have an explicittype
attributereact/no-missing-component-display-name
- enforcedisplayName
formemo
andforwardRef
componentsreact/no-missing-iframe-sandbox
- enforce thatiframe
elements explicitly specify asandbox
attributereact/no-namespace
- enforce that namespaces are not used in React elementsreact/no-redundant-should-component-update
- disallow usage ofshouldComponentUpdate
in class component extendsReact.PureComponent
react/no-render-return-value
- disallow usage of the return value ofReactDOM.render
react/no-script-url
- disallowjavascript:
URLs as JSX event handler prop's valuereact/no-set-state-in-component-did-mount
- disallow usage ofthis.setState
incomponentDidMount
react/no-set-state-in-component-did-update
- disallow usage ofthis.setState
incomponentDidUpdate
react/no-set-state-in-component-will-update
- disallow usage ofthis.setState
incomponentWillUpdate
react/no-string-refs
- disallow using deprecated string refsreact/no-unsafe-component-will-mount
- disallow usage ofUNSAFE_componentWillMount
in class componentsreact/no-unsafe-component-will-receive-props
- disallow usage ofUNSAFE_componentWillReceiveProps
in class componentsreact/no-unsafe-component-will-update
- disallow usage ofUNSAFE_componentWillUpdate
in class componentsreact/no-unsafe-iframe-sandbox
- disallow unsafeiframe
sandbox
attribute combinationsreact/no-unsafe-target-blank
- disallowtarget="_blank"
withoutrel="noreferrer noopener"
react/no-unstable-default-props
- disallow usage of unstable value as default param in function componentreact/no-unstable-nested-components
- disallow usage of unstable nested componentsreact/prefer-destructuring-assignment
- enforce using destructuring assignment in component props and context
React Hooks
react-hooks/ensure-custom-hooks-using-other-hooks
- enforce custom hooks using other hooksreact-hooks/ensure-use-callback-has-non-empty-deps
- enforceuseCallback
has non-empty dependencies arrayreact-hooks/ensure-use-memo-has-non-empty-deps
- enforceuseMemo
has non-empty dependencies arrayreact-hooks/prefer-use-state-lazy-initialization
- disallow function calls inuseState
that aren't wrapped in an initializer
Naming Convention
naming-convention/component-name
- enforce component naming convention toPascalCase
orCONSTANT_CASE
naming-convention/filename
- enforce naming convention for JSX file namesnaming-convention/filename-extension
- enforce naming convention for JSX file extensionsnaming-convention/use-state
- enforce destructuring and symmetric naming ofuseState
hook value and setter variables
Debug
debug/class-component
- report all class components, including anonymous onesdebug/function-component
- report all function components, including anonymous onesdebug/react-hooks
- report all React Hooks