Rules Overview
Emoji Legend
- πΌ - Rule Category
- π - Requires Type Information
- β - Restriction
- βοΈ - Correctness
- β - Deprecated
- π¨ - Style
- π - Debug
- π - Suspicious
- π - Convention
- π - Security
- π - Performance
- π€ - Pedantic
- π€― - Complexity
Core Rules
Rule | Description | πΌ | π | β |
---|---|---|---|---|
avoid-shorthand-boolean | Enforces the use of shorthand syntax for boolean attributes. | π¨ | ||
avoid-shorthand-fragment | Enforces the use of shorthand syntax for fragments. | π¨ | ||
ensure-forward-ref-using-ref | Requires that components wrapped with forwardRef must have a ref parameter. | βοΈ | ||
no-access-state-in-setstate | Prevents accessing this.state inside setState calls. | βοΈ | ||
no-array-index-key | Warns when an array index is used as a key prop. | π | ||
no-children-count | Prevents usage of Children.count . | β | ||
no-children-for-each | Prevents usage of Children.forEach . | β | ||
no-children-map | Prevents usage of Children.map . | β | ||
no-children-only | Prevents usage of Children.only . | β | ||
no-children-prop | Prevents usage of children as a prop. | β | ||
no-children-to-array | Prevents usage of Children.toArray . | β | ||
no-class-component | Prevents usage of class component. | β | ||
no-clone-element | Prevents usage of cloneElement . | β | ||
no-comment-textnodes | Prevents comments from being inserted as text nodes. | π | ||
no-complicated-conditional-rendering | Prevents complicated conditional rendering in JSX. | π€― | β | |
no-component-will-mount | Prevents usage of componentWillMount . | β | ||
no-component-will-receive-props | Prevents usage of componentWillReceiveProps . | β | ||
no-component-will-update | Prevents usage of componentWillUpdate . | β | ||
no-create-ref | Prevents usage of createRef . | β | ||
no-direct-mutation-state | Prevents direct mutation of this.state . | βοΈ | ||
no-duplicate-key | Prevents duplicate key props on elements in the same array or a list of children . | βοΈ | ||
no-implicit-key | Prevents key prop from not being explicitly specified (e.g. spreading key prop 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 prop on items in list rendering. | βοΈ | ||
no-nested-components | Prevents nesting component definitions inside other components. | βοΈ | ||
no-redundant-should-component-update | Prevents usage of shouldComponentUpdate when extending React.PureComponent . | βοΈ | ||
no-set-state-in-component-did-mount | Disallows calling this.setState in componentDidMount outside of functions, such as callbacks. | π | ||
no-set-state-in-component-did-update | Disallows calling this.setState in componentDidUpdate outside of functions, such as callbacks. | π | ||
no-set-state-in-component-will-update | Disallows calling this.setState in componentWillUpdate outside of functions, such as callbacks. | π | ||
no-string-refs | Disallows using deprecated string refs . | β | ||
no-unsafe-component-will-mount | Warns usage of UNSAFE_componentWillMount in class components. | π | ||
no-unsafe-component-will-receive-props | Warns usage of UNSAFE_componentWillReceiveProps in class components. | π | ||
no-unsafe-component-will-update | Warns 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 usage of 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 the use of useless fragment components or <> syntax. | βοΈ | ||
prefer-destructuring-assignment | Enforces the use of destructuring assignment over property assignment. | π¨ | ||
prefer-read-only-props | Enforces that function components props are readonly. | βοΈ | π | |
prefer-shorthand-boolean | Enforces the use of shorthand syntax for boolean attributes. | π¨ | ||
prefer-shorthand-fragment | Enforces the use of shorthand syntax for fragments. | π¨ |
DOM Rules
Rule | Description | πΌ | π | β |
---|---|---|---|---|
dom/no-children-in-void-dom-elements | Prevents the use of children in void DOM elements . | βοΈ | ||
dom/no-dangerously-set-innerhtml | Prevents DOM element using dangerouslySetInnerHTML . | π | ||
dom/no-dangerously-set-innerhtml-with-children | Prevents DOM element using dangerouslySetInnerHTML and children at the same time. | βοΈ | ||
dom/no-find-dom-node | Prevents usage of findDOMNode . | β | ||
dom/no-missing-button-type | Enforces explicit type attribute for <button> elements. | βοΈ | ||
dom/no-missing-iframe-sandbox | Enforces explicit sandbox attribute for iframe elements. | π | ||
dom/no-namespace | Enforces the absence of a namespace in React elements. | βοΈ | ||
dom/no-render-return-value | Prevents usage of the return value of ReactDOM.render . | β | ||
dom/no-script-url | Prevents usage of javascript: URLs as the value of certain attributes. | π | ||
dom/no-unsafe-iframe-sandbox | Enforces sandbox attribute for iframe elements is not set to unsafe combinations. | π | ||
dom/no-unsafe-target-blank | Prevents the use of target="_blank" without rel="noreferrer noopener" . | π |
Hooks Extra Rules
Rule | Description | πΌ | π | β |
---|---|---|---|---|
hooks-extra/ensure-custom-hooks-using-other-hooks | Warns when custom Hooks that donβt use other Hooks. | βοΈ | ||
hooks-extra/ensure-use-callback-has-non-empty-deps | Warns when useCallback is called with empty dependencies array. | π§ | ||
hooks-extra/ensure-use-memo-has-non-empty-deps | Warns when useMemo is called with empty dependencies array. | π§ | ||
hooks-extra/no-set-state-in-use-effect | Disallow direct calls to the set function of useState in useEffect . | βοΈ | ||
hooks-extra/prefer-use-state-lazy-initialization | Warns function calls made inside useState calls. | π |
Naming Convention Rules
Rule | Description | πΌ | π | β |
---|---|---|---|---|
naming-convention/component-name | Enforces naming conventions for components. | π | ||
naming-convention/filename | Enforces naming convention for JSX files. | π | ||
naming-convention/filename-extension | Enforces consistent use of the JSX file extension. | π | ||
naming-convention/use-state | Enforces destructuring and symmetric naming of useState hook value and setter variables. | π |
Debug Rules
Rule | Description | πΌ | π | β |
---|---|---|---|---|
debug/class-component | Print all class components. | π | ||
debug/function-component | Print all function components. | π | ||
debug/react-hooks | Print all react hooks. | π |