Repository navigation
Conversation
JeanMeche
force-pushed
the
feat/unused-animations-diagnostic
branch
2 times, most recently
from
December 5, 2026 17:55
9b47178 to
9efffc9
Compare
Adds a new extended diagnostic `unusedAnimations` (NG8120) that detects legacy animation triggers declared in `@Component.animations` that are never referenced in the component's template or host bindings. The check does not depend on `ts.TypeChecker` and is implemented with full parity in both `ngtsc` (via `UnusedAnimationsRule`) and the `ngp` preprocessor (via `ng-analyze` and `checkUnusedAnimations`).
JeanMeche
force-pushed
the
feat/unused-animations-diagnostic
branch
from
December 5, 2026 17:58
9efffc9 to
1d61cde
Compare
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.
Summary
Adds a new extended diagnostic
unusedAnimations(NG8120) that warns when legacy animation triggers declared in@Component.animationsare never referenced in the component's template or host bindings.Key details
ts.TypeCheckerrequired (NGP-compatible): Follows the same architecture asunusedStandaloneImports(NG8113) — implemented as aSourceFileValidatorRuleinngtscand ascheckUnusedAnimationsin thengppreprocessor backed byng-analyze(oxc_semantic).@trigger), bound attributes ([@trigger]=...), animation event listeners ((@trigger.start)/(@trigger.done)), control flow /<ng-template>blocks, and host bindings/listeners (host: { '[@trigger]': ..., '(@trigger.start)': ... },@HostBinding('@trigger'),@HostListener('@trigger.done')).All animations are unusedon theanimationsproperty key.Animation trigger '<name>' is not used within the template of <Component>on each unused trigger expression or local constant reference.angularCompilerOptions.extendedDiagnostics.checks.unusedAnimations('warning' | 'error' | 'suppress').Test plan
bazel test //packages/compiler-cli/test/ngtsc:ngtscbazel test //packages/compiler-cli/test/ngtsc:ngtsc_ngpbazel test //packages/compiler-cli/preprocessor/test:testbazel test //packages/compiler-cli/preprocessor/ng-analyze:allbazel test //packages/compiler-cli:all //packages/compiler/test/typecheck:all