linted-paths
Version:
Type-safe file system operations with compile-time path validation
44 lines • 1.27 kB
TypeScript
import * as ts from 'typescript';
export interface LinterOptions {
severity?: 'error' | 'warn' | 'off';
}
export declare class PathLinter {
private program;
private checker;
private projectRoot;
private options;
constructor(program: ts.Program, options?: LinterOptions);
/**
* Runs the linter on all source files
*/
run(): ts.Diagnostic[];
/**
* Checks a single source file for path validation issues
*/
checkFile(sourceFile: ts.SourceFile): ts.Diagnostic[];
/**
* Checks if a variable declaration has path validation issues
*/
private checkVariableDeclaration;
/**
* Checks if a type is one of our path type aliases using AST
*/
private isPathType;
/**
* Extracts type name from AST nodes
*/
private getTypeNameFromAST;
/**
* Validates if a path is valid and exists using proper path resolution
*/
private isValidPath;
/**
* Gets the TypeScript diagnostic category based on severity
*/
private getSeverityCategory;
}
/**
* Creates a TypeScript compiler plugin for path validation
*/
export declare function createPathLinterPlugin(options?: LinterOptions): ts.server.PluginModule;
//# sourceMappingURL=linter.d.ts.map