UNPKG

checksync

Version:

A tool that allows code to be annotated across different files to ensure they remain in sync.

176 lines (175 loc) 8.02 kB
import { ErrorCode } from "./error-codes"; import { ErrorDetails, Options } from "./types"; /** * Create an error indicating that the file could not be parsed. * * @param file The path of the file that could not be parsed. * @param detail The reason why the file could not be parsed. * @returns The error details. */ export declare const couldNotParse: (file: string, detail: string) => ErrorDetails; /** * Create an error indicating that a different comment style is being used. * * @param markerID The ID of the marker that is affected. * @param line The line number where the marker is located. * @returns The error details. */ export declare const differentCommentSyntax: (markerID: string, line: number) => { markerID: string; reason: string; location: { line: number; }; code: ErrorCode; }; /** * Create an error indicating a duplicate marker declaration. * * @param markerID The ID of the marker that is duplicated. * @param line The line number where the marker is located. * @returns The error details. */ export declare const duplicateMarker: (markerID: string, line: number) => ErrorDetails; /** * Create an error indicating a duplicate target for a marker. * * @param markerID The ID of the marker that is affected. * @param line The line number where the marker is located. * @param declaration The declaration of the duplicate target. * @returns The error details. */ export declare const duplicateTarget: (markerID: string, line: number, declaration: string) => ErrorDetails; /** * Create an error indicating an empty marker. * * @param markerID The ID of the marker that is empty. * @param line The line number where the marker is located. * @returns The error details. */ export declare const emptyMarker: (markerID: string, line: number) => ErrorDetails; /** * Create an error indicating an end tag was found with no start tag. * * @param markerID The ID of the marker that is affected. * @param line The line number where the marker is located. * @returns The error details. */ export declare const endTagWithoutStartTag: (markerID: string, line: number) => ErrorDetails; /** * Create an error indicating a file for a target does not exist. * * @param markerID The ID of the marker that is affected. * @param line The line number where the marker is located. * @param normalizedTargetPath The normalized path of the target file. */ export declare const fileDoesNotExist: (markerID: string, line: number, targetPath: string) => ErrorDetails; /** * Create an error indicating a malformed sync-end tag. * * @param line The line number where the malformed tag is located. * @returns The error details. */ export declare const malformedEndTag: (line: number) => ErrorDetails; /** * Create an error indicating a malformed sync-start tag. * * @param line The line number where the malformed tag is located. * @returns The error details. */ export declare const malformedStartTag: (line: number) => ErrorDetails; /** * Create an error indicating a mismatched checksum for a locally targeted tag. * * @param markerID The ID of the marker that is affected. * @param declaration The original declaration of the marker exhibiting the * mismatch. * @param absoluteTargetPath The path of the target tag. * @param targetLine The line number where the marker is located. * @param lineToBeFixed The line number where the fix should be applied. * @param incorrectChecksum The incorrect checksum. * @param correctChecksum The correct checksum. * @param fixedTag The fixed tag that should replace the mismatched one. */ export declare const mismatchedChecksumForLocalTarget: (markerID: string, declaration: string, absoluteTargetPath: string, targetLine: number, lineToBeFixed: number, incorrectChecksum: string, correctChecksum: string, fixedTag: string) => ErrorDetails; /** * Create an error indicating a mismatched checksum for a remotely targeted tag. * * @param markerID The ID of the marker that is affected. * @param declaration The original declaration of the marker exhibiting the * mismatch. * @param targetPath The path of the target tag. * @param line The line number where the marker is located. * @param incorrectChecksum The incorrect checksum. * @param correctChecksum The correct checksum. * @param fixedTag The fixed tag that should replace the mismatched one. */ export declare const mismatchedChecksumForRemoteTarget: (markerID: string, declaration: string, targetPath: string, line: number, incorrectChecksum: string, correctChecksum: string, fixedTag: string) => ErrorDetails; /** * Create an error indicating the target does not have a return tag. * * @param markerID The ID of the marker that is affected. * @param line The line number where the marker is located. * @param targetPath The path of the target that should have the return tag. * @returns The error details. */ export declare const noReturnTag: (markerID: string, line: number, targetPath: string) => ErrorDetails; /** * Create an error indicating a pending migration for a matching tag. * * @param markerID The ID of the marker that is affected. * @param declaration The original declaration of the marker exhibiting the * mismatch. * @param line The line number where the marker is located. * @param oldTargetRootRelativeOrRemote The old target path. * @param migratedTarget The target to which the marker should be migrated. * @param incorrectChecksum The incorrect checksum. * @param correctChecksum The correct checksum. * @param fixedTag The fixed tag that should replace the mismatched one. * @returns The error details. */ export declare const pendingMigrationForMatchingTag: (markerID: string, declaration: string, line: number, oldTargetRootRelativeOrRemote: string, migratedTarget: string, incorrectChecksum: string, correctChecksum: string, fixedTag: string) => ErrorDetails; /** * Create an error indicating a pending migration for missing local return tag. * * @param options The options for the current run. * @param markerID The ID of the marker that is affected. * @param declaration The original declaration of the marker exhibiting the * mismatch. * @param line The line number where the marker is located. * @param absoluteTargetPath The current path of the target tag. * @param migratedTarget The target to which the marker should be migrated. * @param incorrectChecksum The incorrect checksum. * @param correctChecksum The correct checksum. * @param fixedTag The fixed tag that should replace the mismatched one. * @returns The error details. */ export declare const pendingMigrationForMissingTarget: (options: Options, markerID: string, declaration: string, line: number, absoluteTargetPath: string, migratedTarget: string, incorrectChecksum: string, correctChecksum: string, fixedTag: string) => ErrorDetails; /** * Create an error indicating a marker that targets itself. * * @param markerID The ID of the marker that targets itself. * @param line The line number where the marker is located. * @returns The error details. */ export declare const selfTargeting: (markerID: string, line: number) => ErrorDetails; /** * Create an error indicating a marker found after the content already started. * * This is for when a start tag for a marker with the given ID has already * been parsed and we're in the middle of parsing the content, when we find * another start tag for that same marker. * * @param markerID The ID of the marker that is affected. * @param line The line number where the marker is located. * @returns The error details. */ export declare const startTagAfterContent: (markerID: string, line: number) => ErrorDetails; /** * Create an error indicating a start tag was found with no end tag. * * @param markerID The ID of the marker that is affected. * @param line The line number where the marker is located. * @returns The error details. */ export declare const startTagWithoutEndTag: (markerID: string, line: number) => ErrorDetails;