eslint-plugin-typescript-custom-sort-keys

1.0.5 • Public • Published

eslint-plugin-typescript-custom-sort-keys

This plugin sorts your typescript and interfaces in a custom defined order.

References:

Installation

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

Usage

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

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

displayFirst: Define array of fields that you want to show on top

showFunctionsAtEnd: keep it true if you want to show your functions in end

{
  "rules": {
    "typescript-custom-sort-keys/interface": [
      "warn",
      "asc",
      {
        "caseSensitive": true,
        "displayFirst": ["id"],
        "showFunctionsAtEnd": true,
      },
    ],
  }
}

Example:

Before After
Snipaste-2020-08-02-01-27-13 Snipaste-2020-08-02-01-16-25

Package Sidebar

Install

npm i eslint-plugin-typescript-custom-sort-keys

Weekly Downloads

794

Version

1.0.5

License

ISC

Unpacked Size

39.7 kB

Total Files

6

Last publish

Collaborators

  • prash471