Requires decorated class members to follow a consistent style (singleline or multiline)
🛠 Has Fixer
One argument which is an object with the keys "properties"
and "methods"
. Both can be set to a string, which must be one of the following values:
"singleline"
"multiline"
"ignore"
If either key is excluded, the default behavior ("ignore"
) will be applied.
A member is considered “multiline” if its declaration is on a line after the last decorator. If decorators are composed (multiple decorators for a single declaration), "multiline" requires each decorator to be on its own line.
{
"decorated-member-style": [
true,
{
"methods": "multiline"
}
]
}
{
"decorated-member-style": [
true,
{
"properties": "singleline",
"methods": "multiline"
}
]
}
{
"type": "object",
"properties": {
"properties": {
"type": "string",
"enum": [
"singleline",
"multiline",
"ignore"
]
},
"methods": {
"type": "string",
"enum": [
"singleline",
"multiline",
"ignore"
]
}
}
}
- Require all decorated component properties to be singleline.
⚙️ Config
✅ Pass
"rules": { "decorated-member-style": [true, { "properties": "singleline" }] }
🚫 Fail@Prop() propName: string;
@Prop() propName: string;
- Require all decorated component properties to be multiline.
⚙️ Config
✅ Pass
"rules": { "decorated-member-style": [true, { "properties": "multiline" }] }
🚫 Fail@Prop() propName: string;
@Prop() propName: string;
- Require all decorated component methods to be inlined.
⚙️ Config
✅ Pass
"rules": { "decorated-member-style": [true, { "methods": "singleline" }] }
🚫 Fail@Listen('click') handleClick() {}
@Listen('click') handleClick() {}
- Require all decorated component methods to be multiline.
⚙️ Config
✅ Pass
"rules": { "decorated-member-style": [true, { "methods": "multiline" }] }
🚫 Fail@Listen('click') handleClick() {} @Listen('click') @Listen('tap') handleClickOrTap() {}
@Listen('click') handleClick() {}