types/codemod.types.ts

types/codemod.types.ts is a file in GovLab Extension Host. 23 lines of code and 3 definitions.

import type { CheckDeclaration } from "@govlab/context";

export interface Edit {
    start: number;
    end: number;
    replacement: string;
}

export interface CodemodFinding {
    file: string;
    line: number;
    reason: string | null;
}

export interface CodemodSpec<F extends CodemodFinding> {
    checks: CheckDeclaration;
    ruleId: string;
    findings: readonly F[];
    programCount: number;
    editsByFile: (findings: readonly F[]) => Map<string, Edit[]>;
    label: (finding: F) => string;
    appliedNoun: string;
    blockedMessage: (finding: F) => string;
    gateOnBlocked: boolean;
    scopeNoun?: string;
}