frontend-standards-checker
Version:
A comprehensive frontend standards validation tool with TypeScript support
91 lines • 3.81 kB
TypeScript
import type { ILogger, IProjectAnalysisResult } from './projectAnalizer.type';
import type { IValidationError } from './additionalValidators.type';
export interface IReporter {
rootDir: string;
outputPath: string;
logger: ILogger;
generate(zoneErrors: Record<string, IValidationError[]>, projectInfo: IProjectAnalysisResult, config: IStandardsConfiguration): Promise<IReportGenerationResult>;
processErrors(zoneErrors: Record<string, IValidationError[]>): IProcessedReportData;
generateSummary(errorsByRule: Record<string, number>, totalErrors: number): ISummaryItem[];
formatReport(reportData: IProcessedReportData, projectInfo: IProjectAnalysisResult, config: IStandardsConfiguration): Promise<string>;
saveReport(content: string): Promise<void>;
generateQuickSummary(reportData: IProcessedReportData): string;
exportJson(reportData: IProcessedReportData, outputPath?: string | null): Promise<string>;
addReportHeader(lines: string[], projectInfo: IProjectAnalysisResult): void;
addSummarySection(lines: string[], reportData: IProcessedReportData): void;
addZoneResultsSection(lines: string[], reportData: IProcessedReportData): void;
addDetailedErrorsSection(lines: string[]): void;
addStatisticsSection(lines: string[], reportData: IProcessedReportData): void;
addRecommendationsSection(lines: string[]): void;
getOriginalZoneErrors(): Record<string, IValidationError[]>;
setOriginalZoneErrors(zoneErrors: Record<string, IValidationError[]>): void;
}
export interface IStandardsConfiguration {
merge?: boolean;
rules?: IValidationRule[] | IConfigurationFunction;
zones?: {
includePackages?: boolean;
onlyZone?: string;
customZones?: string[];
};
extensions?: string[];
ignorePatterns?: string[];
onlyChangedFiles?: boolean;
pipelineMode?: boolean;
severity?: {
structure?: SeverityLevel;
naming?: SeverityLevel;
content?: SeverityLevel;
style?: SeverityLevel;
documentation?: SeverityLevel;
};
}
export interface IReportGenerationResult {
logFile: string;
totalErrors: number;
totalWarnings: number;
totalInfos: number;
totalZones: number;
zoneErrors: Record<string, IValidationError[]>;
summary: ISummaryItem[];
warningSummary: ISummaryItem[];
infoSummary: ISummaryItem[];
}
export interface IProcessedReportData {
totalErrors: number;
totalWarnings: number;
totalInfos: number;
errorsByRule: Record<string, number>;
warningsByRule: Record<string, number>;
infosByRule: Record<string, number>;
errorsByZone: Record<string, number>;
warningsByZone: Record<string, number>;
infosByZone: Record<string, number>;
oksByZone: Record<string, string[]>;
totalCheckedByZone: Record<string, number>;
summary: ISummaryItem[];
warningSummary: ISummaryItem[];
infoSummary: ISummaryItem[];
}
export interface ISummaryItem {
rule: string;
count: number;
percentage: string;
}
import type { IConfigurationFunction } from './standardConfiguration.type.js';
export type SeverityLevel = 'error' | 'warning' | 'info';
export interface IValidationRule {
name: string;
check: (content: string, filePath: string) => boolean | number[] | Promise<boolean> | Promise<number[]>;
message: string;
category?: 'structure' | 'naming' | 'content' | 'style' | 'documentation' | 'performance' | 'accessibility' | 'typescript' | 'react' | 'imports';
severity?: 'error' | 'warning' | 'info';
}
export interface IZoneConfiguration {
includePackages?: boolean;
customZones?: string[];
excludePatterns?: string[];
onlyZone?: string;
}
export type IOutputFormat = 'text' | 'json' | 'both';
//# sourceMappingURL=reporter.type.d.ts.map