root 3bf41bf355 update | 1 рік тому | |
---|---|---|
.. | ||
.github | 1 рік тому | |
lib | 1 рік тому | |
test | 1 рік тому | |
.eslintrc.js | 1 рік тому | |
.prettierrc.js | 1 рік тому | |
README.md | 1 рік тому | |
package.json | 1 рік тому |
Sort export declarations in modules, similarly to sort-imports
First install ESLint
yarn add -d eslint
Then install eslint-plugin-sort-exports
yarn add --dev eslint-plugin-sort-exports
Note: If you installed ESLint globally, you must also install eslint-plugin-sort-exports
globally.
Add sort-exports
to the plugins section of your .eslintrc
and configure the rule under the rules
section.
{
"plugins": ["sort-exports"],
"rules": {
"sort-exports/sort-exports": ["error", {"sortDir": "asc"}]
}
}
sort-exports
{
"sort-exports/sort-exports": [
"error",
{ sortDir: "asc", ignoreCase: true, sortExportKindFirst: "type" }
]
}
Options can be any of the following properties:
sortDir
: Can be either asc
(default) or desc
signifying ascending or descending sort order, respectively.ignoreCase
: If true, sorting is case-insensitive.sortExportKindFirst
: Can be type
, value
, or none
. Determines whether export
or export type
are sorted first, if not none
.disableAutofixer
: If there's a bug in the autofixer and you want to disable it but leave other rules alone, you can set this to true.