npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-plugin-react-x

v1.17.0

Published

A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.

Downloads

506,976

Readme

eslint-plugin-react-x

A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.

[!NOTE] This plugin is already included in @eslint-react/eslint-plugin. You don't need to install it separately if you are using @eslint-react/eslint-plugin.

Install

# npm
npm install --save-dev eslint-plugin-react-x

Setup

// @ts-check

import js from "@eslint/js";
import reactx from "eslint-plugin-react-x";

export default [
  js.configs.recommended,
  {
    files: ["**/*.{ts,tsx}"],
    plugins: {
      "react-x": reactx,
    },
    rules: {
      // react-x recommended rules
      "react-x/ensure-forward-ref-using-ref": "warn",
      "react-x/jsx-no-duplicate-props": "warn",
      "react-x/jsx-uses-vars": "warn",
      "react-x/no-access-state-in-setstate": "error",
      "react-x/no-array-index-key": "warn",
      "react-x/no-children-count": "warn",
      "react-x/no-children-for-each": "warn",
      "react-x/no-children-map": "warn",
      "react-x/no-children-only": "warn",
      "react-x/no-children-to-array": "warn",
      "react-x/no-clone-element": "warn",
      "react-x/no-comment-textnodes": "warn",
      "react-x/no-component-will-mount": "error",
      "react-x/no-component-will-receive-props": "error",
      "react-x/no-component-will-update": "error",
      "react-x/no-create-ref": "error",
      "react-x/no-default-props": "error",
      "react-x/no-direct-mutation-state": "error",
      "react-x/no-duplicate-key": "error",
      "react-x/no-implicit-key": "warn",
      "react-x/no-missing-key": "error",
      "react-x/no-nested-components": "warn",
      "react-x/no-prop-types": "error",
      "react-x/no-redundant-should-component-update": "error",
      "react-x/no-set-state-in-component-did-mount": "warn",
      "react-x/no-set-state-in-component-did-update": "warn",
      "react-x/no-set-state-in-component-will-update": "warn",
      "react-x/no-string-refs": "error",
      "react-x/no-unsafe-component-will-mount": "warn",
      "react-x/no-unsafe-component-will-receive-props": "warn",
      "react-x/no-unsafe-component-will-update": "warn",
      "react-x/no-unstable-context-value": "error",
      "react-x/no-unstable-default-props": "error",
      "react-x/no-unused-class-component-members": "warn",
      "react-x/no-unused-state": "warn",
    },
  },
];

Rules

| Rule | Description | 💼 | 💭 | | | :--------------------------------------- | :--------------------------------------------------------------------------------------------------- | :-: | :-: | :-: | | avoid-shorthand-boolean | Prevents using shorthand syntax for boolean attributes. | 🎨 | | 🔧 | | avoid-shorthand-fragment | Prevents using shorthand syntax for fragments. | 🎨 | | | | 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-vars | Prevents variables used in JSX to be marked as unused. | ✔️ | | | | 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 | Prevents using componentWillMount. | ⛔ | | | | no-component-will-receive-props | Prevents using componentWillReceiveProps. | ⛔ | | | | no-component-will-update | Prevents using componentWillUpdate. | ⛔ | | | | 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-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 | Enforces using React namespace import over default import. | 🎨 | | 🔧 | | prefer-read-only-props | Enforce read-only props in components. | ✔️ | 💭 | | | prefer-shorthand-boolean | Enforces using shorthand syntax for boolean attributes. | 🎨 | | 🔧 | | prefer-shorthand-fragment | Enforces using shorthand syntax for fragments. | 🎨 | | |