import { type AstNode } from './util'; /** * ESLint rule definition shape used by `require-clean-subscription`. */ export interface DbxWebRequireCleanSubscriptionRuleDefinition { readonly meta: { readonly type: 'problem'; readonly fixable: 'code'; readonly docs: { readonly description: string; readonly recommended: boolean; }; readonly messages: { readonly missingCleanSubscription: string; }; readonly schema: readonly object[]; }; create(context: AstNode): Record void>; } /** * Input for {@link collectNgOnDestroyRemovalFixes}. */ export interface CollectNgOnDestroyRemovalFixesInput { /** * The ESLint RuleFixer. */ readonly fixer: AstNode; /** * The MethodDefinition node for `ngOnDestroy`. */ readonly ngOnDestroy: AstNode; /** * The class field name to match against `this.`. */ readonly propName: string; /** * The method name on the field to match (`destroy` or `complete`). */ readonly methodName: string; /** * The ESLint sourceCode service for the current file. */ readonly sourceCode: AstNode; /** * The fix collector array. Mutated. */ readonly fixes: AstNode[]; } /** * ESLint rule that requires class-field initializers of `new SubscriptionObject(...)` * to be replaced with `cleanSubscription(...)` (which auto-registers cleanup with * Angular's DestroyRef) on `@Component` / `@Directive` / `@Pipe` classes. * * Fires only when `SubscriptionObject` is imported from `@dereekb/rxjs`. * * Auto-fix: * - Rewrites the initializer to `cleanSubscription(...)` (preserving any constructor argument). * - Inserts the `cleanSubscription` named import from `@dereekb/dbx-core` if missing. * - Removes any matching `this..destroy();` line from the same class's `ngOnDestroy`. */ export declare const DBX_WEB_REQUIRE_CLEAN_SUBSCRIPTION_RULE: DbxWebRequireCleanSubscriptionRuleDefinition; /** * Pushes fixes that remove `this..()` ExpressionStatements * from `ngOnDestroy`'s body. Removes the statement node and any preceding * indentation on the same line so a blank line isn't left behind. * * @param input - The fixer, ngOnDestroy method, target property/method names, source-code service, and fix collector. */ export declare function collectNgOnDestroyRemovalFixes(input: CollectNgOnDestroyRemovalFixesInput): void; /** * Returns the range to remove for a statement, expanded to include any * leading whitespace on the same line and the trailing newline. This avoids * leaving a blank line after fix application. * * @param statement - The ExpressionStatement AST node. * @param sourceCode - The ESLint sourceCode service. * @returns A range tuple `[start, end]` to pass to `fixer.removeRange`. */ export declare function getStatementRangeWithLeadingWhitespace(statement: AstNode, sourceCode: AstNode): readonly [number, number];