Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fxone/eslint-plugin-sort-keys-shorthand
eslint plugin which support sorting shorthand keys
https://github.com/fxone/eslint-plugin-sort-keys-shorthand
eslint eslint-plugin shorthand-support sort-keys-shorthand
Last synced: 2 months ago
JSON representation
eslint plugin which support sorting shorthand keys
- Host: GitHub
- URL: https://github.com/fxone/eslint-plugin-sort-keys-shorthand
- Owner: fxOne
- License: mit
- Created: 2019-10-03T19:44:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-24T15:22:57.000Z (9 months ago)
- Last Synced: 2024-04-25T15:06:19.918Z (9 months ago)
- Topics: eslint, eslint-plugin, shorthand-support, sort-keys-shorthand
- Language: JavaScript
- Homepage:
- Size: 441 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
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](https://www.github.com/eslint/eslint) either locally or globally. (Note that locally, per project, is strongly preferred)
```sh
$ npm install eslint --save-dev
```If you installed `ESLint` globally, you have to install React plugin globally too. Otherwise, install it locally.
```sh
$ npm install eslint-plugin-sort-keys-shorthand --save-dev
```# Configuration
Add "sort-keys-shorthand" to the plugins section.
```json
{
"plugins": ["sort-keys-shorthand"]
}
```Deactivate the original `sort-keys` rule.
```json
{
"rules": {
"sort-keys": 0
}
}
```Enable `sort-keys-shorthand`:
```json
{
"rules": {
"sort-keys-shorthand/sort-keys-shorthand": [
"error",
"asc",
{
"caseSensitive": true,
"natural": false,
"minKeys": 2,
"shorthand": "first"
}
]
}
}
```# Rules
- [sort-keys-shorthand/sort-keys-shorthand](docs/rules/sort-keys-shorthand.md): extended rule with shorthand support