UNPKG

@ton-ai-core/vibecode-linter

Version:

Advanced TypeScript linter with Git integration, dependency analysis, and comprehensive error reporting

87 lines 3.27 kB
import ts from "typescript"; import type { LintMessageWithFile } from "../../core/types/index.js"; export type MsgId = string; /** * Контекст для обработки зависимостей. * * CHANGE: Introduced context object to reduce parameter count * WHY: Functions were exceeding max-params limit (6 > 5) * QUOTE(LINT): "Function has too many parameters (6). Maximum allowed is 5" * REF: ESLint max-params * SOURCE: n/a */ export interface DependencyContext { readonly program: ts.Program; readonly checker: ts.TypeChecker; readonly byFile: Map<string, LintMessageWithFile[]>; } /** * Создает уникальный идентификатор для сообщения линтера. * * CHANGE: Use switch with proper type narrowing for discriminated unions * WHY: TypeScript requires explicit narrowing for union types to avoid unsafe access * QUOTE(ERROR): "Unsafe member access on error typed value" * REF: ESLint @typescript-eslint/no-unsafe-member-access * * @param filePath Путь к файлу * @param message Сообщение линтера * @returns Уникальный идентификатор */ export declare function createMessageId(filePath: string, message: LintMessageWithFile): MsgId; /** * Вычисляет позицию в исходном файле. * * @param sourceFile Исходный файл TypeScript * @param message Сообщение с информацией о позиции * @returns Начальная и конечная позиция */ export declare function getPosition(sourceFile: ts.SourceFile, message: { line: number; column: number; endLine?: number; endColumn?: number; }): { start: number; end: number; }; /** * Получает символы определения для узла. * * @param checker Type checker * @param node Узел AST * @returns Массив символов */ export declare function getDefinitionSymbols(checker: ts.TypeChecker, node: ts.Node): readonly ts.Symbol[]; /** * Группирует сообщения по файлам. * * @param messages Массив сообщений * @returns Карта файл -> сообщения */ export declare function groupMessagesByFile(messages: readonly LintMessageWithFile[]): Map<string, LintMessageWithFile[]>; /** * Находит сообщение для декларации. * * @param declaration Декларация TypeScript * @param context Контекст обработки зависимостей * @returns Файл и сообщение или null */ export declare function findDeclarationMessage(declaration: ts.Declaration, context: DependencyContext): { readonly file: string; readonly message: LintMessageWithFile; } | null; /** * Validates that endLine and endColumn are present and positive finite integers. * * @param msg Object possibly containing endLine/endColumn * @returns Type predicate ensuring both fields are valid numbers * @invariant endLine > 0 and endColumn > 0 */ export declare function isValidEndPosition(msg: { endLine?: number; endColumn?: number; }): msg is { endLine: number; endColumn: number; }; //# sourceMappingURL=dependency-helpers.d.ts.map