import { PackageJson } from '../../project/package'; import { DetectionSource } from '..'; /** * Linting tool detection result. */ interface LintingToolDetection { /** Tool identifier */ id: 'eslint' | 'prettier' | 'stylelint' | 'biome'; /** Human-readable name */ name: string; /** Detected version */ version?: string; /** Config file path */ configPath?: string; /** Detection confidence (0-100) */ confidence: number; /** Detection sources */ detectedFrom: DetectionSource[]; } /** * Linting tool detector interface. */ interface LintingToolDetector { /** Tool identifier */ id: 'eslint' | 'prettier' | 'stylelint' | 'biome'; /** Human-readable name */ name: string; /** Check if tool is present */ detect(projectPath: string, packageJson?: PackageJson): LintingToolDetection | null; } /** * Detect Biome in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Biome linter * ```typescript * const result = biomeDetector('/path/to/project', { * devDependencies: { '@biomejs/biome': '^1.5.0' }, * }) * // => { id: 'biome', name: 'Biome', confidence: 70, version: '1.5.0', ... } * ``` */ declare function biomeDetector(projectPath: string, packageJson?: PackageJson): LintingToolDetection | null; /** All linting tool detectors */ declare const lintingDetectors: LintingToolDetector[]; /** * Detect all linting tools in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Array of detected linting tools, sorted by confidence * * @example Detecting multiple linting tools * ```typescript * const results = detectLintingTools('/path/to/project', { * devDependencies: { eslint: '^8.0.0', prettier: '^3.0.0' }, * }) * // => [{ id: 'eslint', confidence: 50 }, { id: 'prettier', confidence: 50 }] * ``` */ declare function detectLintingTools(projectPath: string, packageJson?: PackageJson): LintingToolDetection[]; /** Config patterns for ESLint */ declare const ESLINT_CONFIG_PATTERNS: string[]; /** * Detect ESLint in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting ESLint linter * ```typescript * const result = eslintDetector('/path/to/project', { * devDependencies: { eslint: '^8.50.0', '@typescript-eslint/parser': '^6.0.0' }, * scripts: { lint: 'eslint src/' }, * }) * // => { id: 'eslint', name: 'ESLint', confidence: 65, version: '8.50.0', ... } * ``` */ declare function eslintDetector(projectPath: string, packageJson?: PackageJson): LintingToolDetection | null; /** Config patterns for Prettier */ declare const PRETTIER_CONFIG_PATTERNS: string[]; /** * Detect Prettier in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Prettier formatter * ```typescript * const result = prettierDetector('/path/to/project', { * devDependencies: { prettier: '^3.0.0' }, * scripts: { format: 'prettier --write .' }, * }) * // => { id: 'prettier', name: 'Prettier', confidence: 55, version: '3.0.0', ... } * ``` */ declare function prettierDetector(projectPath: string, packageJson?: PackageJson): LintingToolDetection | null; /** Config patterns for Stylelint */ declare const STYLELINT_CONFIG_PATTERNS: string[]; /** * Detect Stylelint in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Stylelint linter * ```typescript * const result = stylelintDetector('/path/to/project', { * devDependencies: { stylelint: '^15.0.0', 'stylelint-config-standard': '^30.0.0' }, * }) * // => { id: 'stylelint', name: 'Stylelint', confidence: 65, version: '15.0.0', ... } * ``` */ declare function stylelintDetector(projectPath: string, packageJson?: PackageJson): LintingToolDetection | null; export { ESLINT_CONFIG_PATTERNS, PRETTIER_CONFIG_PATTERNS, STYLELINT_CONFIG_PATTERNS, biomeDetector, detectLintingTools, eslintDetector, lintingDetectors, prettierDetector, stylelintDetector }; export type { LintingToolDetection, LintingToolDetector };