eslint-plugin-sort

Auto-fixable sort rules for ESLint.

ISC License

Downloads
19.2K
Stars
25
Committers
4

eslint-plugin-sort

Auto-fixable sort rules for ESLint.

Installation

npm

npm install -D eslint-plugin-sort

Yarn

yarn add -D eslint-plugin-sort

pnpm

pnpm add -D eslint-plugin-sort

bun

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 (eslint.config.js)

import sort from "eslint-plugin-sort"

export default [
  sort.configs["flat/recommended"],
  {
    rules: {
      // Customize rules...
    },
  },
]

Legacy config (.eslintrc)

{
  "extends": "plugin:sort/recommended",
  "plugins": ["sort"]
}

List of Supported Rules

βœ”: Enabled in the recommended configuration. πŸ”§: Fixable with eslint --fix.

βœ” πŸ”§ 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
Package Rankings
Top 4.05% on Npmjs.org
Badges
Extracted from project README
Build status npm semantic-release
Related Projects