JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 429954
  • Score
    100M100P100Q201054F
  • License ISC

Sort interface and string enum keys

Package Exports

  • eslint-plugin-typescript-sort-keys

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-typescript-sort-keys) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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 ✔️

Roadmap

  • Add autofix