Skip to content
A linter plugin to require sorting interface and string enum keys
JavaScript
Branch: master
Clone or download
infctr Merge pull request #8 from infctr/dependabot/npm_and_yarn/mixin-deep-…
…1.3.2

Bump mixin-deep from 1.3.1 to 1.3.2
Latest commit 89a386a Dec 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs/rules add string-enum sorting rule and tests Feb 5, 2019
lib bug fixes Nov 9, 2019
tests bug fixes Nov 9, 2019
.editorconfig working draft Jan 19, 2019
.eslintignore
.eslintrc.js add proper output formatting and tests Nov 2, 2019
.gitignore
.npmignore upgrade dev / peer dependencies Nov 2, 2019
.prettierignore add proper output formatting and tests Nov 2, 2019
.prettierrc.js
README.md
lint-staged.config.js
package.json
yarn.lock

README.md

eslint-plugin-typescript-sort-keys

Sort interface and string enum keys

Inspired by and forked from eslint/sort-keys

Installation

You'll first need to install

yarn add -D eslint typescript @typescript-eslint/parser

Next, install eslint-plugin-typescript-sort-keys:

yarn add -D eslint-plugin-typescript-sort-keys

Note: If you installed ESLint globally then you must also install eslint-plugin-typescript-sort-keys globally.

Usage

Specify the parser for typescript files in your .eslintrc configuration file:

{
  "parser": "@typescript-eslint/parser"
}

Add typescript-sort-keys to the plugins section. You can omit the eslint-plugin- prefix:

{
  "plugins": ["typescript-sort-keys"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "typescript-sort-keys/interface": 2,
    "typescript-sort-keys/string-enum": 2
  }
}

Supported Rules

Key: ✔️ = recommended, 🔧 = fixable

Name Description ✔️ 🔧
typescript-sort-keys/interface require interface keys to be sorted ✔️ 🔧
typescript-sort-keys/string-enum require string enum members to be sorted ✔️ 🔧
You can’t perform that action at this time.