Rule Proposal: Disallow reading @Input() in constructor #1321
Friendseeker
started this conversation in
New Rule Proposals
Replies: 1 comment
-
With For use with "no-restricted-syntax": [
"error",
{
"selector":
"PropertyDefinition[definite=true]:not(:has(Decorator[expression.callee.name=\"Input\"] Property[key.name=\"required\"][value.value=true]))",
"message":
"Forbidden non-null property assertion. https://typescript-eslint.io/rules/no-non-null-assertion . This is only allowed on required component @Input({ required:true }). https://angular.io/api/core/Input#required"
}
] |
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
-
For Example
Should be flagged as
input
isundefined
in constructor.Similarly, reading
ViewChild()
in constructor and certain lifecycle methods should be flagged.Beta Was this translation helpful? Give feedback.
All reactions