/** * @angular-modernizer/plugin-angular - Missing TrackBy Rule * * Detects ngFor directives without trackBy functions, which can cause performance issues * and unnecessary DOM operations in Angular applications. * * Detection Patterns: * - *ngFor directives without trackBy function * - ngFor loops over large arrays without optimization * - ngFor in performance-critical components * * This rule helps improve Angular application performance by ensuring proper list tracking. */ import type { AnalysisRule, AnalysisContext, AnalysisResult } from '@angular-modernizer/plugin-system'; /** * Missing TrackBy Rule - detects ngFor without trackBy functions. */ export declare class MissingTrackByRule implements AnalysisRule { readonly id = "angular:missing-trackby"; readonly name = "Missing TrackBy Function"; readonly description = "Detects ngFor directives without trackBy functions that can cause performance issues"; readonly severity = "warning"; readonly category = "angular-performance"; readonly tags: string[]; analyze(context: AnalysisContext): Promise; /** * Analyzes a single component for missing trackBy violations. * @param classDecl - The class declaration of the component to analyze. * @param filePath - The file path of the source file. * @returns An array of analysis results for trackBy violations. */ private analyzeComponent; /** * Checks if a class declaration is an Angular component. * @param classDecl - The class declaration to check. * @returns True if the class is an Angular component, false otherwise. */ private isAngularComponent; /** * Extracts the template content from a component decorator. * @param classDecl - The class declaration of the component. * @returns The template content as a string, or null if not found. */ private extractTemplateContent; /** * Analyzes template content for ngFor directives missing trackBy functions. * @param templateContent - The template content to analyze. * @param className - The name of the component class. * @param filePath - The file path of the source file. * @returns An array of analysis results for missing trackBy violations. */ private analyzeTemplateForNgFor; /** * Extracts all ngFor directives from a template line. * @param line - The template line to analyze. * @returns Array of ngFor directive information. */ private extractNgForDirectives; /** * Creates a violation for missing trackBy function. * @param className - The component class name. * @param filePath - The file path. * @param lineNumber - The line number. * @param line - The full line content. * @param directive - The ngFor directive information. * @returns The analysis result violation. */ private createTrackByViolation; /** * Checks if an ngFor expression contains a trackBy function. * @param ngForExpression - The ngFor expression to check. * @returns True if trackBy is present, false otherwise. */ private hasTrackBy; } //# sourceMappingURL=angular-missing-trackby.rule.d.ts.map