Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eslint indent rule indents decorated members

In order to enable indents for chained methods:

await PostModel
  .findOne({
    author: user.user,
    _id: id,
  })
  .populate('tickets', 'title status');

I have added the following MemberExpression to my eslintrc, as per eslint docs

indent": ["error", "tab", { "MemberExpression": 1 }],

but now I am experiencing problem with decorators, which get indented although my preference is to have them aligned with the member.

@prop({ type: String, required: true })
  password: string;

Is there a way to address those two cases without a conflict?

like image 549
user776686 Avatar asked Jan 20 '26 18:01

user776686


1 Answers

I got the same problem as you did, and found this comment help, give it a try?

{
  rules: {
    // ...
    "indent": ["error", 2, { "ignoredNodes": ["PropertyDefinition"] }]
  }
}
like image 137
Wildsky Avatar answered Jan 24 '26 23:01

Wildsky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!