import { ValidationRule, ValidationContext, ValidationSeverity } from '../interfaces'; /** * Options for InfiniteLoopRule */ export interface InfiniteLoopOptions { /** Whether to check for loops (default: true) */ checkForLoops?: boolean; /** Whether to check while loops (default: true) */ checkWhileLoops?: boolean; /** Whether to check do-while loops (default: true) */ checkDoWhile?: boolean; /** Custom message */ message?: string; } /** * Rule that detects obvious infinite loop patterns * * Catches patterns like: * - for(;;) { } - missing test condition * - for(;true;) { } - always-true test * - while(true) { } * - while(1) { } * - do {} while(true) * * This is a defense-in-depth measure. Runtime protection (iteration limits) * should also be in place, but catching obvious infinite loops at static * analysis time provides better error messages and faster failure. */ export declare class InfiniteLoopRule implements ValidationRule { private options; readonly name = "infinite-loop"; readonly description = "Detects obvious infinite loop patterns"; readonly defaultSeverity = ValidationSeverity.ERROR; readonly enabledByDefault = true; constructor(options?: InfiniteLoopOptions); validate(context: ValidationContext): void; /** * Check if an expression is always truthy (can be determined at static analysis) */ private isAlwaysTruthy; /** * Check if an expression is always falsy */ private isAlwaysFalsy; private reportInfiniteLoop; }