/** * Biome lens for JavaScript/TypeScript linting and formatting * Supports biome lint, biome check, and biome format commands */ import { BaseLens } from '../base/BaseLens.js'; import { LensResult, LensOptions, ExecuteResult, Executor } from '../../types/index.js'; /** * Options for BiomeLens */ export interface BiomeLensOptions extends LensOptions { /** * List of source files to include in fileMetrics. * When provided, all files in this list will appear in fileMetrics, * even if they have no issues (they'll get score: 100). * * This is important for File City visualization which needs ALL files, * not just files with problems. * * @example * ```typescript * const sourceFiles = tree.allFiles * .filter(f => /\.[jt]sx?$/.test(f.path)) * .map(f => f.path); * const lens = new BiomeLens(executor, { sourceFiles }); * ``` */ sourceFiles?: string[]; } /** * Biome diagnostic location */ interface BiomeLocation { path?: { file?: string; path?: string; }; span?: { start: number; end: number; }; sourceCode?: string; } /** * Biome diagnostic message */ interface BiomeDiagnostic { category?: string; severity?: 'error' | 'warning' | 'information' | 'hint' | 'fatal'; description?: string; message?: Array<{ content?: string; }>; advices?: { advices?: Array<{ log?: Array<{ content?: string; }>; }>; }; location?: BiomeLocation; tags?: string[]; } /** * Biome JSON output format */ interface BiomeOutput { diagnostics?: BiomeDiagnostic[]; summary?: { errors?: number; warnings?: number; changed?: number; unchanged?: number; }; } /** * Lens for Biome linter/formatter */ export declare class BiomeLens extends BaseLens { readonly name = "biome"; readonly description = "JavaScript/TypeScript linter and formatter"; readonly languages: string[]; readonly supportedTools: string[]; readonly requirements: import("../..").LensRequirements; private pathMapper?; private mode; private injectedSourceFiles?; constructor(executor?: Executor, options?: BiomeLensOptions); /** * Set the mode for this lens (lint or format) */ setMode(mode: 'lint' | 'format'): void; /** * Calculate quality score (0-100) from Biome results * * Scoring algorithm: * - Start at 100 * - Subtract penalty based on issues per file analyzed * - Errors: 10 points per error per file * - Warnings: 2 points per warning per file * - Floor at 0 */ static calculateQualityScore(result: LensResult): number; /** * Parse Biome JSON output */ parse(output: ExecuteResult): BiomeOutput; /** * Parse text output when JSON is not available * Used for format --check which may output file paths */ private parseTextOutput; /** * Format Biome results to standard format */ format(parsed: BiomeOutput): LensResult; /** * Map Biome severity to standard severity */ private mapBiomeSeverity; /** * Categorize Biome rules */ private categorizeRule; /** * Get all source files for fileMetrics. * * Returns injected source files if provided, otherwise returns an empty array. * When empty, the format() method will fall back to using files from diagnostics. * * To provide source files, pass them via the `sourceFiles` option when * constructing the lens: * * @example * ```typescript * const sourceFiles = tree.allFiles * .filter(f => /\.[jt]sx?$/.test(f.path)) * .map(f => f.path); * const lens = new BiomeLens(executor, { sourceFiles }); * ``` * @returns Array of relative file paths */ private getAllSourceFiles; /** * Get or create path mapper */ private getPathMapper; /** * Override execute to ensure JSON format */ execute(): Promise; } export {}; //# sourceMappingURL=BiomeLens.d.ts.map