💼strict
config. This rule warns in the ✅ recommended
config.
🔧 This rule is automatically fixable by the --fix
CLI option.
Sort decorators on accessors.
Name | Description | value |
---|---|---|
autoFix |
Automatically fix the order. Decorators order can matter at runtime. |
boolean |
caseSensitive |
If true, enforce properties to be in case-sensitive order. | boolean |
direction |
Specify the direction of the ordering. | asc | desc |
Definitive information in the JSON schema.
This is the default values when the rule is enabled:
{
"sort-decorators/sort-on-accessors": [
"warn",
{
"autoFix": false,
"caseSensitive": true,
"direction": "asc"
}
]
}
Usage of "caseSensitive": false
{
"sort-decorators/sort-on-accessors": [
"warn",
{
"caseSensitive": false
}
]
}
class MyClass {
@B @a @c
public get accessor() { return 0; }
}
class MyClass {
@a @B @c
public get accessor() { return 0; }
}
Usage of "direction": "desc"
{
"sort-decorators/sort-on-accessors": [
"warn",
{
"direction": "desc"
}
]
}
class MyClass {
@A
@B
public get accessor() { return 0; }
}
class MyClass {
@B
@A
public get accessor() { return 0; }
}