/** * @angular-modernizer/plugin-angular - Lifecycle Hook Rule * * Detects improper usage of Angular lifecycle hooks and missing cleanup patterns. * * Detection Patterns: * - ngOnInit with async operations without proper error handling * - ngOnDestroy not unsubscribing from all subscriptions * - Missing ngOnDestroy when subscriptions exist * - Improper order of lifecycle hook calls * - ngAfterViewInit/ngAfterContentInit without corresponding ngOnDestroy cleanup * * This rule helps ensure proper lifecycle management and prevent memory leaks. */ import type { AnalysisRule, AnalysisContext, AnalysisResult } from '@angular-modernizer/plugin-system'; /** * Lifecycle Hook Rule - detects improper lifecycle hook usage and missing cleanup. */ export declare class LifecycleHookRule implements AnalysisRule { readonly id = "angular:lifecycle-hook-violation"; readonly name = "Lifecycle Hook Violation"; readonly description = "Detects improper usage of Angular lifecycle hooks and missing cleanup patterns"; readonly severity = "warning"; readonly category = "angular-lifecycle"; readonly tags: string[]; analyze(context: AnalysisContext): Promise; private analyzeClass; /** * Detects ngOnInit methods making ≥5 service calls — a strong signal that * Route Resolvers or lazy observable initialization should be used instead. * ≥5 → warning, ≥8 → severity escalated to error in metadata. */ private analyzeNgOnInitComplexity; private isAngularComponentOrDirective; private getLifecycleHooks; private hasSubscriptions; private analyzeNgOnDestroyCleanup; private analyzeAsyncOperations; } //# sourceMappingURL=angular-lifecycle-hook.rule.d.ts.map