0.9.1 • Published 2 years ago
eslint-plugin-sort-exports v0.9.1
eslint-plugin-sort-exports
Sort export declarations in modules, similarly to sort-imports
Installation
First install ESLint
yarn add -d eslintThen install eslint-plugin-sort-exports
yarn add --dev eslint-plugin-sort-exportsNote: If you installed ESLint globally, you must also install eslint-plugin-sort-exports globally.
Usage
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"}]
}
}Supported rules
sort-exportsConfiguration
{
"sort-exports/sort-exports": [
"error",
{ sortDir: "asc", ignoreCase: true, sortExportKindFirst: "type" }
]
}Options can be any of the following properties:
sortDir: Can be eitherasc(default) ordescsignifying ascending or descending sort order, respectively.ignoreCase: If true, sorting is case-insensitive.sortExportKindFirst: Can betype,value, ornone. Determines whetherexportorexport typeare sorted first, if notnone.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.pattern: Glob pattern to select or exclude specific filenames. E.g.**/index.ts.