import type { InlangConfig } from "../config/index.js"; import type * as ast from "../ast/index.js"; import type { createReportFunction } from "./report.js"; /** * A lint rule that was configured with the lint level and lint specific settings. */ export type LintRule = { id: `${string}.${string}`; level: "error" | "warn"; setup: (args: { config: Pick; report: ReturnType; }) => MaybePromise<{ visitors: Visitors; }>; }; export type Visitors = { Resource?: VisitorFunction; Message?: VisitorFunction; Pattern?: VisitorFunction; }; /** * A report of a given lint rule. */ export type LintReport = { id: LintRule["id"]; level: LintRule["level"]; message: string; }; /** * Nodes that can be linted. * * The linter will only lint nodes that are of this type. */ export type LintableNode = ast.Resource | ast.Message | ast.Pattern; type VisitorFunction = (args: { reference?: Node; target?: Node; }) => MaybePromise; type LintInformation = { lint?: LintReport[]; }; type LintExtension = { Resource: LintInformation; Message: LintInformation; Pattern: LintInformation; }; export type LintedResource = Pretty>; export type LintedMessage = Pretty>; export type LintedPattern = Pretty>; export type LintedNode = LintedResource | LintedMessage | LintedPattern; type MaybePromise = T | Promise; type Pretty = T extends (...args: any[]) => any ? T : T extends abstract new (...args: any[]) => any ? T : { [K in keyof T]: T[K]; }; export {}; //# sourceMappingURL=rule.d.ts.map