Angluar 11 / Ngrx and eslint

487 views
Skip to first unread message

Arnaud Deman

unread,
Mar 11, 2021, 9:18:33 AM3/11/21
to Angular and AngularJS discussion
Hello,

After updating my app to Angular11, I migrated from tslint to eslint. I have a problem with the member-ordering rule with Ngrx Effects.
They are of this form:


export class MyEffects  {


constructor () {(...)}

@Effect () myEffect$ = this._actions$ .pipe (...)
// <- should be before the constructor.
}
which does not respect the rule of "members must be declared before the public constructor". It was OK with tslint.
Would there be a solution to globally disable this rule for effects files only?
I know it can be done via comments in files but the goal is to avoid modifying / committing a large number of files.

Thanks in advance (and sorry for being out of topic),
Arnaud.

bastien lemaire

unread,
Mar 11, 2021, 9:27:59 AM3/11/21
to ang...@googlegroups.com

you can configure the rule in the .eslintrc.json file

Bastien Lemaire


--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/4354518a-9961-46cd-9fcb-98cf74efffb3n%40googlegroups.com.

Arnaud Deman

unread,
Mar 11, 2021, 11:14:54 AM3/11/21
to Angular and AngularJS discussion
Thanks for your answer Bastien.
I was looking to change / disable this rule for some files only. This can be done with an overload in .eslintrc.json:
"overrides": [
(...)
   {
       " files": ["*.effects.ts"],
       "rules": {
       "@typescript-eslint/member-ordering": [
          "error", {
             "default": [ "constructor",  "public-decorated-field"]
          }
       ]
  }
]

the.trumpet.pl...@gmail.com

unread,
Mar 11, 2021, 1:15:27 PM3/11/21
to ang...@googlegroups.com

I do not respond to automated messages.  Please call me on the phone to discuss what you are looking for.  If I do not answer, please leave a message otherwise I will not return your call.  Thanks.

 

- Adam J. Evanovich

CV_adam_evanovich.docx
Reply all
Reply to author
Forward
0 new messages