UNPKG

@invisiblecities/sidequest-cqo

Version:

Configuration-agnostic TypeScript and ESLint orchestrator with real-time watch mode, SQLite persistence, and intelligent terminal detection

157 lines 4.45 kB
/** * @fileoverview ESLint audit engine with robust error handling * * Provides ESLint integration that can handle syntax errors gracefully, * continuing to analyze valid files while reporting parsing failures separately. */ import { BaseAuditEngine } from "./base-engine.js"; import type { Violation } from "../utils/violation-types.js"; /** * Engine for ESLint-based code quality analysis * * Key features: * - Graceful handling of syntax errors * - Round-robin rule checking for performance * - Buffer overflow protection * - Configurable rule sets */ export declare class ESLintAuditEngine extends BaseAuditEngine { private readonly baseDir; private currentRuleIndex; private eslintRules; private violationCache; private ruleZeroCount; private ruleLastCheck; private checksCount; private readonly ZERO_THRESHOLD; private readonly REDUCED_INTERVAL; constructor(config?: { enabled?: boolean; options?: { rules?: string[]; maxWarnings?: number; timeout?: number; roundRobin?: boolean; enableCustomScripts?: boolean; customScriptPreset?: string; }; priority?: number; timeout?: number; allowFailure?: boolean; }); /** * Analyze files with ESLint */ protected analyze(targetPath: string, options?: Record<string, unknown>): Promise<Violation[]>; /** * Round-robin analysis for better performance and error isolation */ private analyzeWithRoundRobin; /** * Analyze with all rules at once (traditional approach) */ private analyzeAllRules; /** * Select the next rule for round-robin checking */ private selectNextRule; /** * Get all violations from the cache */ private getAllCachedViolations; /** * Run ESLint for specific rules with robust handling */ private runESLintForRules; /** * Robust ESLint execution with temp file + sequential fallback */ private runESLintRobustly; /** * Run ESLint with temp file output (fastest for large results) */ private runESLintWithTempFile; /** * Run ESLint sequentially by rule groups (reliable fallback) */ private runESLintSequentially; /** * Get rules from project's ESLint config */ private getProjectESLintRules; /** * Chunk rules into groups for sequential processing */ private chunkRules; /** * Run ESLint with specific rules enabled using project config */ private runESLintWithSpecificRules; /** * Original buffer-based approach for round-robin mode */ private runESLintWithBuffer; /** * Parse ESLint JSON output into violations */ private parseESLintOutput; /** * Dynamically categorize ESLint violations based on rule patterns * Uses pattern matching instead of hard-coded lists for maintainability */ private categorizeESLintRule; /** * Get round-robin status for reporting */ getRoundRobinStatus(): { lastCheckedRule: string; progress: string; adaptiveRules: number; totalChecks: number; }; /** * Reset round-robin state (useful for testing or cache clearing) */ resetRoundRobinState(): void; /** * Update ESLint rules */ updateRules(newRules: string[]): void; /** * Get current ESLint rules */ getRules(): string[]; /** * Check if the project has a custom ESLint system */ private hasCustomESLintSystem; /** * Run custom ESLint scripts if detected */ private runCustomESLintScripts; /** * Detect custom ESLint scripts in package.json */ private detectCustomESLintScripts; /** * Select the best custom script to run based on preset and user configuration */ private selectBestCustomScript; /** * Execute a custom ESLint script and parse its output */ private executeCustomESLintScript; /** * Parse custom ESLint output into violation format */ private parseCustomESLintOutput; /** * Map ESLint severity to our category system */ private mapESLintSeverityToCategory; /** * Map ESLint severity to our severity system */ private mapESLintSeverityToSeverity; } //# sourceMappingURL=eslint-engine.d.ts.map