devghost
Version:
👻 Find dead code, dead imports, and dead dependencies before they haunt your project
43 lines • 1.46 kB
TypeScript
import type { PackageJson } from '../types';
/**
* Find the project root by looking for package.json
*/
export declare function findProjectRoot(startDir?: string): string | null;
/**
* Get all TypeScript/JavaScript files in a directory recursively
*/
export declare function getAllFiles(dir: string, extensions?: string[]): Promise<string[]>;
/**
* Read and parse package.json
*/
export declare function readPackageJson(projectRoot: string): PackageJson | null;
/**
* Get file statistics (size and line count)
*/
export declare function getFileStats(filePath: string): {
size: number;
lines: number;
};
/**
* Calculate the total size of a directory (used for node_modules)
*/
export declare function getDirectorySize(dirPath: string): number;
/**
* Check if a file has a devghost-ignore comment
* @param fileContent - The file content as a string
* @param line - 1-indexed line number (line 1 = first line)
*/
export declare function hasIgnoreComment(fileContent: string, line: number): boolean;
/**
* Check if entire file should be ignored
*/
export declare function isFileIgnored(filePath: string): boolean;
/**
* Remove a specific line from a file (for auto-fix)
*/
export declare function removeLineFromFile(filePath: string, lineNumber: number): boolean;
/**
* Check if a file matches ignore patterns
*/
export declare function matchesIgnorePattern(filePath: string, patterns: string[]): boolean;
//# sourceMappingURL=fs.d.ts.map