eslint-plugin-sort-decorators
An ESLint plugin to sort decorators
Installation
First, the peer dependencies must be installed:
npm i --save-dev typescript eslint @typescript-eslint/parser
Next, install eslint-plugin-sort-decorators
:
npm i --save-dev eslint-plugin-sort-decorators
Usage
As this plugin only works with typescript,
the parser must be set in a .eslintrc
file:
{
"parser": "@typescript-eslint/parser"
}
The plugin can then be activated by adding sort-decorators
to the plugins
property:
{
"plugins": ["sort-decorators"]
}
The different rules can be defined as follows:
{
"rules": {
"sort-decorators/sort-on-classes": "error"
}
}
All these configuration can be done on a override
section:
https://eslint.org/docs/latest/use/configure/configuration-files#how-do-overrides-work
Rules
🔧 Automatically fixable by the --fix
CLI option.