/** * @angular-modernizer/plugin-angular - Service Mutable State Rule * * Detects Angular services that expose public array/Map/Set properties and then * mutate them directly via push/splice/pop/sort/reverse. * * Direct mutation of shared collection state prevents OnPush components from * detecting changes and makes the service hard to test. * * @example * // Violation: public array mutated in place * @Injectable() * class UserService { * users: User[] = []; * addUser(u: User) { this.users.push(u); } // mutation — OnPush won't detect * } * * // Correct pattern: BehaviorSubject + immutable update * @Injectable() * class UserService { * private readonly users$ = new BehaviorSubject([]); * readonly users = this.users$.asObservable(); * addUser(u: User) { this.users$.next([...this.users$.getValue(), u]); } * } */ import type { AnalysisRule, AnalysisContext, AnalysisResult } from '@angular-modernizer/plugin-system'; /** * ServiceMutableStateRule — detects services that mutate public collection * properties directly, breaking OnPush change detection compatibility. */ export declare class ServiceMutableStateRule implements AnalysisRule { readonly id = "angular:service-mutable-state"; readonly name = "Service Mutable State"; readonly description = "Detects services that mutate public array/Map/Set properties directly, breaking OnPush components and testability"; readonly severity: "warning"; readonly category = "angular-architecture"; readonly tags: string[]; /** Mutation methods that indicate direct in-place state modification. */ private readonly mutationMethods; analyze(context: AnalysisContext): Promise; private isInjectable; private analyzeClass; } //# sourceMappingURL=service-mutable-state.rule.d.ts.map