jrdrg / eslint-plugin-sort-exports

ESLint plugin to sort exports in modules
36 stars 9 forks source link

eslint-plugin-sort-exports

Sort export declarations in modules, similarly to sort-imports

Installation

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.

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-exports

Configuration

{
    "sort-exports/sort-exports": [
        "error",
        { sortDir: "asc", ignoreCase: true, sortExportKindFirst: "type" }
    ]
}

Options can be any of the following properties: