[no-inject-outside-ctor]
new rule
#2300
Replies: 2 comments
-
As far as only allowing in the constructor, I think property-initializers would need to be considered valid as well class Foo {
private readonly bar = inject(Bar);
} Might be also worth checking that the class is also Beyond specifics, it would also be nice to have similar rules for |
Beta Was this translation helpful? Give feedback.
-
This could be tricky to do correctly because there are some places outside of constructors that run in an injection context, which allows you to use
There's potentially other places that I've missed. Unfortunately, a lot of those things are just normal functions, which would make it difficult to reliably detect that they are running in an injection context. It's a shame, because this would be a nice rule. ☹ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description and reproduction of the issue
Currently angular has powerful inject function, which supposed to replace ctor. Unfortunately sometimes you might use it outside of constructor context which will fsil
Beta Was this translation helpful? Give feedback.
All reactions