frontend-standards-checker
Version:
A comprehensive frontend standards validation tool with TypeScript support
95 lines • 3.34 kB
TypeScript
import type { ILogger, IValidationError, IProjectAnalyzer, IMonorepoZoneConfig, IProjectAnalysisResult, IProjectInfo, IZoneInfo } from '../types/index.js';
/**
* Analyzes a project's structure, type, and zones (sub-projects/packages).
* Supports monorepo detection and zone extraction for various JS/TS project types.
*
* @remarks
* - Detects project type using `package.json` and heuristics.
* - Supports monorepo setups (Yarn/NPM workspaces, Nx, TurboRepo, Lerna, Rush).
* - Extracts zones from standard directories, workspaces, and custom configuration.
* - Provides structure validation and naming convention checks via additional validators.
*
* @example
* ```typescript
* const analyzer = new ProjectAnalyzer('/path/to/project', logger);
* const analysis = await analyzer.analyze({ includePackages: true });
* ```
*
* @public
*/
export declare class ProjectAnalyzer implements IProjectAnalyzer {
readonly rootDir: string;
readonly logger: ILogger;
constructor(rootDir: string, logger: ILogger);
/**
* Analyze the project structure and return project information
*/
analyze(config?: IMonorepoZoneConfig): Promise<IProjectAnalysisResult>;
/**
* Detect the type of project (app, package, library, etc.)
*/
detectProjectType(projectPath?: string): IProjectInfo['projectType'];
/**
* Detect project type from package.json dependencies
*/
private detectProjectTypeFromPackageJson;
/**
* Detect project type using heuristics
*/
private detectProjectTypeFromHeuristics;
/**
* Detect zone type for a specific path
*/
detectZoneType(zonePath: string): IProjectInfo['projectType'];
/**
* Check if the project is a monorepo
*/
isMonorepo(): boolean;
/**
* Detect zones in a monorepo
*/
detectMonorepoZones(zoneConfig?: IMonorepoZoneConfig): Promise<IZoneInfo[]>;
/**
* Get list of standard zones to process based on configuration
*/
getStandardZones(zoneConfig: IMonorepoZoneConfig): string[];
/**
* Process a zone directory and return its sub-zones
*/
processZoneDirectory(zoneName: string): IZoneInfo[];
/**
* Process custom zones from configuration
*/
processCustomZones(customZones?: string[]): IZoneInfo[];
/**
* Process workspace zones from package.json
*/
processWorkspaceZones(_zoneConfig: IMonorepoZoneConfig): IZoneInfo[];
/**
* Get expected structure for a project type
*/
getExpectedStructure(projectType: string): string[];
/**
* Get expected src structure
*/
getExpectedSrcStructure(): Record<string, string[]>;
/**
* Validate zone structure and naming conventions
*/
validateZoneStructure(files: string[], directories: string[], _zoneName: string): Promise<IValidationError[]>;
private validateFiles;
private validateSingleFile;
private isComponentIndexFile;
private validateComponentFunctionName;
private validateDirectories;
private isComponentDirectory;
/**
* Safely load additional validators
*/
private loadAdditionalValidators;
/**
* Legacy method for compatibility - not used in new implementation
*/
detectZones(): Promise<string[]>;
}
//# sourceMappingURL=project-analyzer.d.ts.map