eslint-plugin-sort-keys-shorthand
v2.3.0
Published
eslint plugin which support sorting shorthand keys
Downloads
1,570
Readme
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
- sort-keys-shorthand/sort-keys-shorthand: extended rule with shorthand support