vibe-janitor
Version:
A CLI tool that cleans AI-generated JavaScript/TypeScript projects efficiently and intelligently
86 lines (85 loc) • 1.96 kB
TypeScript
/**
* Options for CSS style cleaning
*/
export interface StyleCleanerOptions {
dryRun?: boolean;
verbose?: boolean;
removeUnused?: boolean;
scanComponents?: boolean;
}
/**
* Represents a CSS selector and its usage information
*/
interface CssSelector {
selector: string;
file: string;
line: number;
column: number;
used: boolean;
}
/**
* Details about CSS class usage in the project
*/
interface StyleDefinition {
file: string;
selectors: CssSelector[];
}
/**
* Results from the style cleaning process
*/
export interface StyleCleaningResult {
analyzedFiles: number;
styleDefinitions: StyleDefinition[];
unusedSelectors: {
file: string;
selectors: string[];
}[];
modifiedFiles: string[];
totalSelectorsFound: number;
totalUnusedSelectors: number;
bytesRemoved: number;
}
/**
* Manages detection and cleanup of unused CSS classes and selectors
*/
export declare class StyleCleaner {
private targetDir;
private options;
private sourceFiles;
private styleFiles;
private classUsagePatterns;
constructor(targetDir: string, options?: StyleCleanerOptions);
/**
* Find all source and style files in the project
*/
private findFiles;
/**
* Parse CSS files to extract all class selectors
*/
private extractStyleDefinitions;
/**
* Scan source files to find class usages
*/
private findClassUsages;
/**
* Find unused CSS selectors
*/
private findUnusedSelectors;
/**
* Remove unused CSS selectors from style files
*/
private removeUnusedSelectors;
/**
* Format file size in a human-readable way
*/
private formatSize;
/**
* Check if a file is protected and should not be modified
*/
private isProtectedFile;
/**
* Run the style cleaning process
*/
clean(): Promise<StyleCleaningResult>;
}
export {};