eslint-plugin-typescript-custom-sort-keys
v1.0.5
Published
Sort interface and string enum keys in custom order
Downloads
4,183
Maintainers
Readme
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 | |--|--| | | |