Auto-fixable sort rules for ESLint.
npm install eslint-plugin-sort


Auto-fixable sort rules for ESLint.
``bash`
npm install -D eslint-plugin-sort
`bash`
yarn add -D eslint-plugin-sort
`bash`
pnpm add -D eslint-plugin-sort
`bash`
bun add -d eslint-plugin-sort
After installing, add sort to your list of ESLint plugins and extend the
recommended configuration. This will enable all available rules as warnings.
Flat config
(eslint.config.js)
`javascript
import sort from "eslint-plugin-sort"
export default [
sort.configs["flat/recommended"],
{
rules: {
// Customize rules...
},
},
]
`
Legacy config
(.eslintrc)
`json`
{
"extends": "plugin:sort/recommended",
"plugins": ["sort"]
}
ā: Enabled in the recommended configuration.\eslint --fix`.
š§: Fixable with
| ā | š§ | Rule | Description |
| :-: | :-: | ----------------------------------------------------------------------- | ------------------------------------- |
| ā | š§ | sort/destructuring-properties | Sorts object destructuring properties |
| ā | š§ | sort/exports | Sorts exports |
| ā | š§ | sort/export-members | Sorts export members |
| ā | š§ | sort/imports | Sorts imports |
| ā | š§ | sort/import-members | Sorts import members |
| ā | š§ | sort/object-properties | Sorts object properties |
| | š§ | sort/type-properties | Sorts TypeScript type properties |
| | š§ | sort/string-enums | Sorts TypeScript string enums |
| | š§ | sort/string-unions | Sorts TypeScript string unions |