Socket
Book a DemoInstallSign in
Socket

eslint-plugin-sort-keys-shorthand

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sort-keys-shorthand

eslint plugin which support sorting shorthand keys

Source
npmnpm
Version
2.2.0
Version published
Weekly downloads
559
8.33%
Maintainers
1
Weekly downloads
 
Created
Source

ESLint-plugin-sort-keys-shorthand

Extended short-key rule to handle shorthand properties as ESLint doesn't want to support it

  • https://github.com/eslint/eslint/issues/7543

Installation

Install ESLint either locally or globally. (Note that locally, per project, is strongly preferred)

$ npm install eslint --save-dev

If you installed ESLint globally, you have to install React plugin globally too. Otherwise, install it locally.

$ npm install eslint-plugin-sort-keys-shorthand --save-dev

Configuration

Add "sort-keys-shorthand" to the plugins section.

{
  "plugins": ["sort-keys-shorthand"]
}

Deactivate the original sort-keys rule.

{
  "rules": {
    "sort-keys": 0
  }
}

Enable sort-keys-shorthand:

{
  "rules": {
    "sort-keys-shorthand/sort-keys-shorthand": [
      "error",
      "asc",
      {
        "caseSensitive": true,
        "natural": false,
        "minKeys": 2,
        "shorthand": "first"
      }
    ]
  }
}

Rules

Keywords

eslint

FAQs

Package last updated on 02 May 2022

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