Roadmap

Milestone 2.0

Plugins (with ecological niche explanation)

  • eslint-plugin-react-x - Core rules (renderer-agnostic, compatible with x-platform).
  • eslint-plugin-react-dom - DOM Specific rules for React DOM.
  • eslint-plugin-react-web-api - Rules for interacting with Web APIs.
  • eslint-plugin-react-hooks - The official one from React.
  • eslint-plugin-react-hooks-extra - Extra rules for eslint-plugin-react-hooks.
  • eslint-plugin-react-naming-convention - Optional naming convention rules (can be replaced with other plugins depending on the project).

Rules in eslint-plugin-react-x

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-read-only-propsEnforce read-only props in components.
prefer-shorthand-booleanEnforces using shorthand syntax for boolean attributes.
prefer-shorthand-fragmentEnforces using shorthand syntax for fragments.

Rules in eslint-plugin-react-dom

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

Rules in eslint-plugin-react-web-api

RuleDescription
no-leaked-timeoutPrevents leaked setTimeout
no-leaked-intervalPrevents leaked setInterval
no-leaked-idle-callbackPrevents leaked requestIdleCallback
no-leaked-animation-framePrevents leaked requestAnimationFrame
no-leaked-event-sourcePrevents leaked EventSource
no-leaked-event-listenerPrevents leaked addEventListener
no-leaked-resize-observerPrevents leaked ResizeObserver
no-leaked-intersection-observerPrevents leaked IntersectionObserver
no-leaked-mutation-observerPrevents leaked MutationObserver
no-leaked-performance-observerPrevents leaked PerformanceObserver
no-leaked-websocketPrevents leaked WebSocket
no-leaked-broadcast-channelPrevents leaked BroadcastChannel
no-leaked-geolocationPrevents leaked Geolocation.watchPosition()
no-leaked-absolute-orientation-sensorPrevents leaked AbsoluteOrientationSensor
no-leaked-relative-accelerometerPrevents leaked Accelerometer
no-leaked-ambient-light-sensorPrevents leaked AmbientLightSensor
no-leaked-gravity-sensorPrevents leaked GravitySensor
no-leaked-gyroscopePrevents leaked Gyroscope
no-leaked-linear-acceleration-sensorPrevents leaked LinearAccelerationSensor
no-leaked-magnetometerPrevents leaked Magnetometer
no-leaked-orientation-sensorPrevents leaked OrientationSensor

Rules in eslint-plugin-react-hooks-extra

RuleDescription
no-direct-set-state-in-use-effectDisallow direct calls to set function of useState in useEffect.
no-redundant-custom-hookWarns when custom Hooks that don’t use other Hooks.
no-unnecessary-use-callbackDisallow unnecessary usage of useCallback.
no-unnecessary-use-memoDisallow unnecessary usage of useMemo.
prefer-use-state-lazy-initializationWarns function calls made inside useState calls.

Rules in eslint-plugin-react-naming-convention

RuleDescription
component-nameEnforces naming conventions for components.
filenameEnforces naming convention for JSX files.
filename-extensionEnforces consistent use of the JSX file extension.
use-stateEnforces destructuring and symmetric naming of useState hook value and setter variables.

Advanced Configuration features

  • Additional components (settings["react-x"].additionalComponents) transitions from experimental to stable.

Milestone 3.0 (Draft)

Plugins (with ecological niche explanation)

  • eslint-plugin-react-x - Core rules (renderer-agnostic, compatible with x-platform).
  • eslint-plugin-react-dom - DOM Specific rules for React DOM.
  • eslint-plugin-react-web-api - Rules for interacting with Web APIs.
  • eslint-plugin-react-hooks - The official one from React.
  • eslint-plugin-react-hooks-extra - Extra rules for eslint-plugin-react-hooks.
  • eslint-plugin-react-naming-convention - Optional naming convention rules (can be replaced with other plugins depending on the project).
  • … (Free to combine with other plugins from the community).