eslint-plugin-smart-sort
v0.1.1
Published
Plugin ESlint help sort code entities
Downloads
4
Maintainers
Readme
eslint-plugin-smart-sort
Plugin ESlint help sort code entities, with autofix and without format code style.
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-smart-sort
:
$ npm install eslint-plugin-smart-sort --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-smart-sort
globally.
Usage
Add smart-sort
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"smart-sort"
]
}
Rules
import-specifiers
Sort import specifiers by natural sort oder (wiki);
Rule Details
Examples of incorrect code for this rule:
import {c, b, a} from './';
import {a1, a10, a2} from './';
import {a1, a2, a10, A} from './';
import {
a10,
a1,
B,
A,
a2,
} from './';
Examples of correct code for this rule:
import {a, b, c} from './';
import {a1, a2, a10} from './';
import {A, a1, a2, a10} from './';
import {
A,
B,
a1,
a2,
a10
} from './';
Configure rule
{
"rules": {
"smart-sort/import-specifiers": 2
}
}