Rule proposal: Directive values should always be passed using brackets #860
Closed
luiscla27
started this conversation in
New Rule Proposals
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This rule proposal is related to an issue, the new rule would be read like this:
Every directive declared in the current NgModule, should always be used using brackets
Proposal
Currently, you can do this:
The expected would be this:
Description of the issue
Without the brackets, the IDE doesn't have a way of knowing which variable type is expecting, so it's easy to sometimes pass a wrong value... especially when the directive is refactored (let's say the expected value is
Array<number>
due to refactorization changes, but before it wasnumber
)In my case, our team separated a bunch of angular components, each one to a single own module so we were able to call them lazy. And we didn't realize that there it was a lot of missing module imports from NgModule's until we ran the app. I think our case counts as refactorization.
Feedback
Please guide me if this is not the right place to ask for this new rule request. I posted in this repo because someone in the
eslint
project advised me to report this feature request in the Angular-specific ESLint plugin (see this issue)(this whole rule request applies also for
@Input
values)Beta Was this translation helpful? Give feedback.
All reactions