Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

eslint-plugin-hardsort

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-hardsort

Sorting is attempted under limited conditions.

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

eslint-plugin-hardsort

Sorting is attempted under limited conditions.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-hardsort:

npm install eslint-plugin-hardsort --save-dev

Usage

Add hardsort to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["hardsort"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "hardsort/object-sort": [
      "error",
      {
        "sortedOrders": ["keyNameLengthAsc"],
        "functionKeyNames": ["select"],
        "ignoreEnterGroup": false,
        "functionValueTypes": [
          "AsyncFunction",
          "MethodDefinition",
          "GeneratorFunction",
          "FunctionExpression",
          "ArrowFunctionExpression"
        ],
        "functionKeyNamePatterns": ["^on", "^callback"]
      }
    ],
    "hardsort/jsx-attr-sort": [
      "error",
      {
        "sortedOrders": ["keyNameLengthAsc"],
        "functionKeyNames": ["select"],
        "ignoreEnterGroup": true,
        "functionValueTypes": [
          "AsyncFunction",
          "MethodDefinition",
          "GeneratorFunction",
          "FunctionExpression",
          "ArrowFunctionExpression"
        ],
        "functionKeyNamePatterns": ["^on", "^callback"]
      }
    ],
    "hardsort/import-grouping": [
      "error",
      [
        {
          "id": "components",
          "pathPatterns": ["^.*/components(/.*)?"]
        },
        {
          "id": "pages",
          "pathPatterns": ["^.*/pages(/.*)?"]
        },
        {
          "id": "default",
          "sortedOrders": ["aliasAsc"]
        }
      ],
      {
        "alias": {
          "@": "src"
        },
        "orders": ["default", "pages", "components"]
      }
    ]
  }
}

Rules

🔧 Automatically fixable by the --fix CLI option.

NameDescription🔧
import-groupingimport를 그룹화하여 정리합니다.🔧
jsx-attr-sortJSX Attributes를 정렬합니다.🔧
object-sortObject를 정렬합니다.🔧

Keywords

eslint

FAQs

Package last updated on 05 Feb 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