New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

eslint-plugin-sort-component

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sort-component

Eslint plugin to sort expressions inside of the React component

latest
npmnpm
Version
1.0.9
Version published
Maintainers
0
Created
Source

eslint-plugin-sort-component

eslint-plugin-sort-component is an ESLint plugin designed to sort expressions inside React components. This plugin helps maintain a consistent order of statements within your components, improving readability and maintainability.

The expected order of statements is as follows:

  • Selectors
  • Dispatchers
  • Built-in hooks (useState, useEffect, etc.)
  • Custom hooks (useCounter, etc.)
  • Declarations (Constants and variables)
  • Functions

Installation

To install the plugin, run:

npm install -D eslint-plugin-sort-component

Ensure that you have ESLint installed as a peer dependency:

npm install -D eslint

Usage

Add sort-component to the plugins section of your ESLint configuration file (e.g., eslint.config.js):

// eslint.config.js
import sortComponent from 'eslint-plugin-sort-component'

//...settings
plugins: {
  //...plugins
  'sort-component': sortComponent
  }

Then, add the rule to the rules section:

//...settings
rules: {
  //...rules
  'sort-component/sort-component': 'warn'
  }

License

This project is licensed under the MIT License.

Made with ❤️ by German Tellez in Colombia 🇨🇴

Keywords

eslint

FAQs

Package last updated on 14 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts