import type { NormalizedRule, Problem } from '../types/index.js'; import type { Fix } from '../types/index.js'; import type { ScopeRuleContext } from '../rules/types.js'; import { type MarkdocSchema } from '../parser/markdoc/schema.js'; export interface RunnerOptions { fix?: boolean; /** * Cap on the total problems a run may collect, enforced BETWEEN files: * once a file's lint pushes the total to (or past) the cap, that file's * overflow is truncated and NO further file is linted at all — so a * pathological input set can't ballon memory past cap + one file's worth * of problems. Runs that hit the cap report `truncated: true` on their * RunResult. Omit for unbounded collection (the default). */ maxProblems?: number; /** * FULL set of configured rule names, used only to decide which inline * directive names get an "unknown rule" warning (see core/directives.ts). * Callers filter `severity: off` rules out of `rules` before runRules, so * without this a directive suppressing an off-rule — a deliberate no-op, * not a typo — would warn as unknown. Defaults to the names of `rules` * (correct for callers that never pre-filter). */ knownRuleNames?: Set; /** * Opt-in Markdoc tokenization, passed through to every `parseMarkdown` call * this run makes. Defaults to disabled, matching `parseMarkdown`'s own * default, which leaves the parse byte-identical. */ markdoc?: boolean; /** * The resolved schema used to derive `ctx.markdoc.pairing`'s self-closing * set; only meaningful alongside `markdoc: true`. `null` or omitted means no * schema: parsing and pairing still run, every rule reading * `ctx.markdoc.schema` sees `null`, and no tag name counts as self-closing, * so an unclosed one lands in `pairing.unclosed` rather than * `voidMissingSlash`. */ markdocSchema?: MarkdocSchema | null; } export interface FileInput { path: string; content: string; metadata?: ScopeRuleContext['fileMetadata']; } export interface RunResult { problems: Problem[]; fixedFiles: Map; /** * Flat list of the fixes that GENUINELY landed in `fixedFiles`, for * reporting. Proposed fixes dropped by the applier's overlap resolution * are NOT here — they're in `skippedFixes` (see applyFixesToContent's * applied/skipped classification). */ fixes: Fix[]; /** * Proposed fixes that could not be applied (overlapping edits, * out-of-range lines). For runRulesUntilStable this holds only the fixes * still pending after the final pass — a fix skipped in one pass but * re-proposed and applied in a later pass is (correctly) reported in * `fixes` instead. */ skippedFixes: Fix[]; /** * True when `RunnerOptions.maxProblems` cut the run short: problems were * dropped past the cap and/or later files were never linted. Always false * for uncapped runs, and for capped runs whose problem count never * exceeded the cap with files left over. */ truncated: boolean; } export declare function runRules(files: FileInput[], rules: NormalizedRule[], options?: RunnerOptions): Promise; /** * Runs rules with fix:true repeatedly (lint → apply fixes → re-lint the * fixed content) until a pass produces zero fixes, capped at * MAX_FIX_PASSES. runRules() itself is single-pass by design (library * callers that need convergence should loop, as this helper does). This is * what public API's lintFiles() and the CLI's run * command use so a single --fix invocation fully converges instead of * requiring the user to re-run --fix multiple times. * * The returned `problems` are from the FIRST pass (matching prior * single-pass behavior: --fix reports the issues it found/fixed, not the * post-fix state) while `fixedFiles` reflects the final, fully-converged * content. `fixes` is the flat list of every fix genuinely applied across * all passes; `skippedFixes` holds only the fixes still pending after the * final pass. A fix skipped mid-run (overlap) is normally re-proposed * against the fixed content and applied by a later pass — it then counts * in `fixes`, not `skippedFixes` — so a non-empty `skippedFixes` here * means the run hit MAX_FIX_PASSES with conflicting edits unresolved. */ export declare function runRulesUntilStable(files: FileInput[], rules: NormalizedRule[], options?: Omit): Promise; //# sourceMappingURL=runner.d.ts.map