import { b as AnalyzerOptions, A as AnalysisResult, c as FileInput, V as ViolationType, S as Severity, a as Violation } from '../types-CvIlSIOV.cjs'; /** * Analyze a single file for platform import violations * * @param filePath - Path to the file being analyzed * @param sourceCode - The source code content * @param options - Analyzer options * @returns Analysis result with violations * * @example * ```typescript * const result = analyzePlatformImports( * 'src/components/Button.tsx', * sourceCode, * { severity: 'error' } * ); * * if (result.violations.length > 0) { * for (const v of result.violations) { * console.error(`${v.filePath}:${v.line}:${v.column} - ${v.message}`); * } * } * ``` */ declare function analyzePlatformImports(filePath: string, sourceCode: string, options?: AnalyzerOptions): AnalysisResult; /** * Analyze multiple files for platform import violations * * @param files - Array of files to analyze * @param options - Analyzer options * @returns Array of analysis results * * @example * ```typescript * const results = analyzeFiles( * [ * { path: 'Button.tsx', content: buttonSource }, * { path: 'Button.web.tsx', content: webSource }, * { path: 'Button.native.tsx', content: nativeSource }, * ], * { severity: 'warning' } * ); * * const failed = results.filter(r => !r.passed); * ``` */ declare function analyzeFiles(files: FileInput[], options?: AnalyzerOptions): AnalysisResult[]; /** * Get a summary of analysis results */ interface AnalysisSummary { totalFiles: number; passedFiles: number; failedFiles: number; totalViolations: number; violationsByType: Record; violationsBySeverity: Record; } /** * Summarize analysis results * * @param results - Array of analysis results * @returns Summary statistics */ declare function summarizeResults(results: AnalysisResult[]): AnalysisSummary; /** * Format a violation for console output */ declare function formatViolation(violation: Violation): string; /** * Format all violations from results for console output */ declare function formatViolations(results: AnalysisResult[]): string[]; /** * Types of linting issues the component linter can detect. * * These are issues that TypeScript cannot catch - primarily style/pattern issues * that are syntactically valid but violate Idealyst conventions. */ type LintIssueType = 'hardcoded-color' | 'direct-platform-import'; /** * A single lint issue found during analysis */ interface LintIssue { /** Type of lint issue */ type: LintIssueType; /** Severity level */ severity: Severity; /** Line number where issue occurred */ line: number; /** Column number where issue occurred */ column: number; /** The problematic code snippet */ code: string; /** Human-readable message describing the issue */ message: string; /** Suggested fix (if available) */ suggestion?: string; } /** * Result of linting a component file */ interface LintResult { /** Path to the analyzed file */ filePath: string; /** List of issues found */ issues: LintIssue[]; /** Whether the file passed linting (no errors) */ passed: boolean; /** Count of issues by severity */ counts: { error: number; warning: number; info: number; }; } /** * Options for the component linter */ interface ComponentLinterOptions { /** * Which rules to enable (all enabled by default) */ rules?: { /** Detect hardcoded color values like '#fff', 'red', 'rgb()' */ hardcodedColors?: boolean | Severity; /** Detect direct imports from 'react-native' in shared files */ directPlatformImports?: boolean | Severity; }; /** * Glob patterns for files to ignore */ ignoredPatterns?: string[]; /** * Color values that are allowed (e.g., 'transparent', 'inherit') * @default ['transparent', 'inherit', 'currentColor'] */ allowedColors?: string[]; } /** * Lint a component file for Idealyst-specific issues. * * Detects issues that TypeScript cannot catch: * - Hardcoded colors (TypeScript sees these as valid strings) * - Direct react-native imports in shared files (valid TS, but breaks web) * * @param filePath - Path to the file being analyzed * @param sourceCode - The source code content * @param options - Linter options * @returns Lint result with issues found * * @example * ```typescript * const result = lintComponent( * 'src/components/MyButton.tsx', * sourceCode, * { rules: { hardcodedColors: 'error' } } * ); * * if (!result.passed) { * for (const issue of result.issues) { * console.error(`${issue.line}:${issue.column} - ${issue.message}`); * } * } * ``` */ declare function lintComponent(filePath: string, sourceCode: string, options?: ComponentLinterOptions): LintResult; /** * Lint multiple component files * * @param files - Array of files to lint * @param options - Linter options * @returns Array of lint results */ declare function lintComponents(files: Array<{ path: string; content: string; }>, options?: ComponentLinterOptions): LintResult[]; /** * Format a lint issue for console output */ declare function formatLintIssue(issue: LintIssue, filePath: string): string; /** * Format all lint results for console output */ declare function formatLintResults(results: LintResult[]): string[]; /** * Summary of lint results */ interface LintSummary { totalFiles: number; passedFiles: number; failedFiles: number; totalIssues: number; issuesByType: Record; issuesBySeverity: Record; } /** * Summarize lint results */ declare function summarizeLintResults(results: LintResult[]): LintSummary; export { type AnalysisSummary, type ComponentLinterOptions, type LintIssue, type LintIssueType, type LintResult, type LintSummary, analyzeFiles, analyzePlatformImports, formatLintIssue, formatLintResults, formatViolation, formatViolations, lintComponent, lintComponents, summarizeLintResults, summarizeResults };