feat(compiler-cli): add extended diagnostic for template reference shadowing component member#68766
Draft
arturovt wants to merge 1 commit into
Draft
feat(compiler-cli): add extended diagnostic for template reference shadowing component member#68766arturovt wants to merge 1 commit into
arturovt wants to merge 1 commit into
Conversation
…adowing component member Adds a new extended template diagnostic (`NG8119`) that warns when a template reference variable (`#ref`) uses the same name as a public, non-static member of the component class. In those cases, the template reference silently shadows the class member within the template scope, which is usually unintended. The diagnostic can be configured through `extendedDiagnostics.checks.templateReferenceShadowsComponentVariable` in the Angular compiler options. Closes angular#45227
Contributor
Author
|
Note: it's not a duplicate, bc it's enabled through options eliminating any breaking changes. |
Member
Our template diagnostics are enabled by default. This would make this change a breaking change (and is one in G3 as our diagnostics are globally enabled there). |
Contributor
Author
|
@JeanMeche out of curiosity, is that considered a braking change even if its a warning (not a hard error)? |
Member
|
Internaly, they're aren't warnings. This would require a large cleanup (likely too big to be worth it). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new extended template diagnostic (
NG8119) that warns when a template reference variable (#ref) uses the same name as a public, non-static member of the component class. In those cases, the template reference silently shadows the class member within the template scope, which is usually unintended.The diagnostic can be configured through
extendedDiagnostics.checks.templateReferenceShadowsComponentVariablein the Angular compiler options.Closes #45227