UNPKG

frontend-standards-checker

Version:

A comprehensive frontend standards validation tool with TypeScript support

97 lines 3.63 kB
import type { IFileScanner, ILogger, IFileInfo, IScanOptions, IGitIgnorePattern, IFileScanResult } from '../types/index.js'; /** * File scanner utility for finding and filtering project files */ export declare class FileScanner implements IFileScanner { readonly rootDir: string; readonly logger: ILogger; readonly gitignorePatterns: IGitIgnorePattern[]; private readonly defaultIgnorePatterns; constructor(rootDir: string, logger: ILogger); /** * Scan a specific zone for files * @param zone Zone to scan * @param options Scan options * @returns Array of file information */ scanZone(zone: string, options: IScanOptions): Promise<IFileInfo[]>; /** * Scan directory recursively for files * @param dirPath Directory path to scan * @param options Scan options * @returns Array of file information */ scanDirectory(dirPath: string, options: IScanOptions): Promise<IFileInfo[]>; /** * Load gitignore patterns from .gitignore file * @returns Array of gitignore patterns */ loadGitignorePatterns(): Promise<IGitIgnorePattern[]>; /** * Check if a file path should be ignored based on patterns * @param filePath File path to check * @param patterns Array of gitignore patterns * @returns True if file should be ignored */ isIgnored(filePath: string, patterns: IGitIgnorePattern[]): boolean; /** * Check if path matches a simple pattern * @param filePath File path to check * @param pattern Pattern to match * @returns True if matches */ private matchesPattern; /** * Check if path matches a gitignore pattern * @param filePath File path to check * @param pattern Gitignore pattern * @param isDirectory Whether pattern is for directories only * @returns True if matches */ private matchesGitignorePattern; /** * Determine which zone a file belongs to * @param filePath File path * @param options Scan options * @returns Zone name */ private determineZone; /** * Get file statistics * @param options Scan options * @returns File scan statistics */ getStatistics(options: IScanOptions): Promise<IFileScanResult>; /** * Get files that are staged for commit * @returns Array of file paths that are staged for commit */ getFilesInCommit(): Promise<string[]>; /** * Get files that are changed in recent commits (for CI/CD pipelines) * This method uses multiple git strategies to find changed files in pipeline environments * @returns Array of file paths that are changed in recent commits */ getChangedFilesInPipeline(): Promise<string[]>; /** * Get combined files: staged files first, then pipeline changed files as fallback * @param forcePipelineMode Force using pipeline mode regardless of environment * @returns Array of file paths that are staged for commit or recently changed */ getFilesInCommitOrPipeline(forcePipelineMode?: boolean): Promise<string[]>; /** * Get git strategies specifically for pipeline environments * @returns Array of git strategies to try in pipeline/CI environments */ private getGitStrategiesForPipeline; /** * Check if running in a CI/CD environment * @returns True if running in CI/CD environment */ private isRunningInCI; } /** * Detect if the current project is a React Native project */ export declare function isReactNativeProject(filePath: string): boolean; //# sourceMappingURL=file-scanner.d.ts.map