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 🙏

© 2025 – Pkg Stats / Ryan Hefner

eslint-plugin-react-jsx-props-order

v1.0.2

Published

ESLint plugin to sort JSX props by type and length

Readme

eslint-plugin-react-jsx-props-sorter

🔧 ESLint plugin to automatically sort JSX props by type and length, prioritizing React reserved props.

✨ Features

This plugin enforces a consistent and readable order of JSX props in your React components based on the following rules:

  1. React reserved props first – props like key, ref, className, style, etc., are placed at the top.
  2. Categorized by type, in the following order:
    • React reserved props
    • Shorthand props (<Component disabled />)
    • String literals (title="Hello")
    • Variables (value={someValue})
    • Functions (onClick={handleClick})
    • Multiline objects or functions
  3. Within each category:
    • Sorted by prop name length (shorter first)
    • Then alphabetically
    • For multiline props, sorted by number of lines

📦 Installation

npm install --save-dev eslint-plugin-react-jsx-props-sorter

or

yarn add --dev eslint-plugin-react-jsx-props-sorter

or

pnpm add -D eslint-plugin-react-jsx-props-sorter

🛠 Configuration

In your ESLint config:

{
  "plugins": ["jsx-props-sorter"],
  "rules": {
    "jsx-props-sorter/sort-jsx-props": ["warn", {
      "reactPropsFirst": true,
      "reactPropsList": [
        "key", "ref", "dangerouslySetInnerHTML", "children",
        "value", "defaultValue", "checked", "defaultChecked",
        "className", "style", "id", "name"
      ]
    }]
  }
}

⚙️ Options

| Option | Type | Default | Description | |--------------------|------------|---------|----------------------------------------------------------| | reactPropsFirst | boolean | true | Whether to prioritize React props at the top | | reactPropsList | string[] | [...]* | List of React-related props to prioritize |

* Default reactPropsList:

[
  "key", "ref", "dangerouslySetInnerHTML"
]

🧠 Example

Before:

const userData = {
  id: 1,
  name: 'Gabriel Felipe'
};

const handleClick = () => {
  // ...
};

<Component
  size="xs"
  key="test"
  asChild
  buttonText="Click here!"
  className="rounded-md"
  onClick={handleClick}
  user={userData}
  onBlur={(event) => {
    const value = event.target.value;
    setValue(value);
  }}
  onFocus={(event) => {
    const value = event.target.value;
    setValue((oldState) => ({
      ...oldState,
      ...value,
    }));
  }}
  data={{
    test: 1,
    testTwo: 2,
    testThree: 3,
  }}
/>

After:

const userData = {
  id: 1,
  name: 'Gabriel Felipe'
};

const handleClick = () => {
  // ...
};

<Component
  key="test"
  asChild
  size="xs"
  className="rounded-md"
  buttonText="Click here!"
  user={userData}
  onClick={handleClick}
  data={{
    test: 1,
    testTwo: 2,
    testThree: 3,
  }}
  onBlur={(event) => {
    const value = event.target.value;
    setValue(value);
  }}
  onFocus={(event) => {
    const value = event.target.value;
    setValue((oldState) => ({
      ...oldState,
      ...value,
    }));
  }}
/>

👤 Author

Gabriel Felipe Cegatta dos Santos

📄 License

MIT