/** * Union type for SwiftLint issue severity levels * Using discriminated union for better type safety */ export type Severity = 'Warning' | 'Error'; /** * Valid output format options */ export type OutputFormat = 'compact' | 'json' | 'table'; /** * Represents the structure of a single issue from `swiftlint lint --reporter json` * This interface defines the expected format of SwiftLint issues in JSON output */ export interface SwiftlintJsonIssue { /** Character position where the issue occurs, can be null if not available */ readonly character: number | null; /** Path to the file containing the issue */ readonly file: string; /** Line number where the issue occurs */ readonly line: number; /** Human-readable description of the issue */ readonly reason: string; /** Identifier of the SwiftLint rule that triggered this issue */ readonly rule_id: string; /** Severity level of the issue */ readonly severity: Severity; /** Type classification of the issue */ readonly type: string; } /** * CLI Configuration with strict typing */ export interface CliConfig { readonly format: OutputFormat; readonly quiet: boolean; readonly noColor: boolean; readonly configFile?: string; } /** * Result type for CLI argument parsing */ export type CliParseResult = CliConfig & { readonly showHelp?: boolean; readonly showVersion?: boolean; }; /** * Error types for better error handling */ export type ProcessingError = { readonly type: 'validation'; readonly message: string; readonly details?: string; } | { readonly type: 'parsing'; readonly message: string; readonly cause?: Error; } | { readonly type: 'config'; readonly message: string; readonly path?: string; } | { readonly type: 'runtime'; readonly message: string; readonly code?: number; }; /** * Type-safe result wrapper for operations that can fail */ export type Result = { readonly success: true; readonly data: T; } | { readonly success: false; readonly error: E; }; /** * Helper to create success result */ export declare const ok: (data: T) => Result; /** * Helper to create error result */ export declare const err: (error: E) => Result; /** * Type guard for checking if result is successful */ export declare const isOk: (result: Result) => result is { success: true; data: T; }; /** * Type guard for checking if result is an error */ export declare const isErr: (result: Result) => result is { success: false; error: E; }; /** * Type guard for validating a single SwiftLint issue from JSON * Ensures that input data matches the expected SwiftlintJsonIssue structure */ export declare const validateSwiftlintJsonIssue: (val: unknown) => val is SwiftlintJsonIssue; export interface SchemaIssue { readonly path: string[]; readonly message: string; readonly code?: string; } /** * Schema object matching safeParse interface for validating a single SwiftLint issue */ export declare const SwiftlintJsonIssueSchema: { safeParse: (data: unknown) => { success: true; data: SwiftlintJsonIssue; } | { success: false; error: { issues: SchemaIssue[]; }; }; }; /** * Native schema validator object matching safeParse interface for validating array of SwiftLint issues */ export declare const SwiftlintJsonOutputSchema: { safeParse: (data: unknown) => { success: true; data: SwiftlintJsonIssue[]; } | { success: false; error: { issues: SchemaIssue[]; }; }; }; /** * Default CLI configuration using const assertion for immutability */ export declare const DEFAULT_CLI_CONFIG: { readonly format: 'compact'; readonly quiet: false; readonly noColor: false; }; /** * Valid format options as const assertion for better type inference */ export declare const OUTPUT_FORMATS: readonly ['compact', 'json', 'table']; //# sourceMappingURL=types.d.ts.map