Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mskelton/eslint-plugin-sort
Auto-fixable sort rules for ESLint.
https://github.com/mskelton/eslint-plugin-sort
eslint eslint-plugin eslint-plugin-sort fix sort sorting-imports
Last synced: 2 days ago
JSON representation
Auto-fixable sort rules for ESLint.
- Host: GitHub
- URL: https://github.com/mskelton/eslint-plugin-sort
- Owner: mskelton
- License: isc
- Created: 2020-04-24T01:24:30.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T10:31:11.000Z (3 months ago)
- Last Synced: 2025-01-15T13:54:39.335Z (9 days ago)
- Topics: eslint, eslint-plugin, eslint-plugin-sort, fix, sort, sorting-imports
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/eslint-plugin-sort
- Size: 61.6 MB
- Stars: 26
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-sort
[![Build status](https://github.com/mskelton/eslint-plugin-sort/workflows/Build/badge.svg)](https://github.com/mskelton/eslint-plugin-sort/actions)
[![npm](https://img.shields.io/npm/v/eslint-plugin-sort)](https://www.npmjs.com/package/eslint-plugin-sort)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)Auto-fixable sort rules for ESLint.
## Installation
### npm
```bash
npm install -D eslint-plugin-sort
```### Yarn
```bash
yarn add -D eslint-plugin-sort
```### pnpm
```bash
pnpm add -D eslint-plugin-sort
```### bun
```bash
bun add -d eslint-plugin-sort
```## Usage
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](https://eslint.org/docs/latest/use/configure/configuration-files-new)
(**eslint.config.js**)```javascript
import sort from "eslint-plugin-sort"export default [
sort.configs["flat/recommended"],
{
rules: {
// Customize rules...
},
},
]
```[Legacy config](https://eslint.org/docs/latest/use/configure/configuration-files)
(**.eslintrc**)```json
{
"extends": "plugin:sort/recommended",
"plugins": ["sort"]
}
```## List of Supported Rules
✔: Enabled in the `recommended` configuration.\
🔧: Fixable with [`eslint --fix`](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems).| ✔ | 🔧 | Rule | Description |
| :-: | :-: | ----------------------------------------------------------------------- | ------------------------------------- |
| ✔ | 🔧 | [sort/destructuring-properties](docs/rules/destructuring-properties.md) | Sorts object destructuring properties |
| ✔ | 🔧 | [sort/exports](docs/rules/exports.md) | Sorts exports |
| ✔ | 🔧 | [sort/export-members](docs/rules/export-members.md) | Sorts export members |
| ✔ | 🔧 | [sort/imports](docs/rules/imports.md) | Sorts imports |
| ✔ | 🔧 | [sort/import-members](docs/rules/import-members.md) | Sorts import members |
| ✔ | 🔧 | [sort/object-properties](docs/rules/object-properties.md) | Sorts object properties |
| | 🔧 | [sort/type-properties](docs/rules/type-properties.md) | Sorts TypeScript type properties |
| | 🔧 | [sort/string-enums](docs/rules/string-enums.md) | Sorts TypeScript string enums |
| | 🔧 | [sort/string-unions](docs/rules/string-unions.md) | Sorts TypeScript string unions |