import type { BuildParamProvenance } from "../../provenance.js"; import type { LintRule, LintDiagnostic } from "../../lint/rule.js"; /** * Type guard to check if a value conforms to the LintRule interface. */ export declare function isLintRule(value: unknown): value is LintRule; /** * Load custom lint rules from plugin files. * Each plugin file is dynamically imported and all exports conforming to LintRule are collected. * * chant #1051 — this (and `loadLocalRules`, `../../lint/rule-loader.ts`, for * `.chant/rules/*.ts`) is unconditional project-source `import()` with no * `--sandbox` equivalent, the same class of gap #1051 closes for * `discoverComponents`. Deliberately NOT sandboxed here, and not a "decide by * omission": a `LintRule` is not a one-shot data producer like `Component`/ * `Declarable` — its `check(context)` is a function the rule engine invokes * inline, once per linted file, for the whole `chant lint` run. There is no * cheap "collect once, JSON-serialize the result, hand it back" shape the way * there is for a `Component` (plain JSON) or an entity (a wire codec) — * `check` has to keep running as live JS in whichever process calls it. A * shallow fix that sandboxed only the *import* step (mirroring * `discoverComponents`) would give a false sense of safety: it would close * off "malicious top-level module code" but leave `check()`'s own executable * body — the dominant part of a rule's attack surface, since it runs for * every file, every lint invocation — entirely unsandboxed regardless. A real * fix needs either the AST/`ts.SourceFile` itself to cross the sandbox * boundary or the whole custom-rule evaluation to run inside the child; both * are materially harder, separate design problems from this issue's `Component` * fix and are tracked separately (chant #1052). */ export declare function loadPluginRules(plugins: string[], configDir: string): Promise>; /** * Lint command options */ export interface LintOptions { /** Path to lint */ path: string; /** * This invocation's resolved build parameters (#1490). * * The COMP* checks import `*.component.ts`, and an ES module evaluates once * per path — so the values in effect during the lint gate are the values * every later reader observes. A caller that lints before it graphs must * pass the same parameters to both or the later resolution has no effect. */ buildParams?: BuildParamProvenance[]; /** Apply auto-fixes */ fix?: boolean; /** Output format */ format: "stylish" | "json" | "sarif"; /** Rules to use (defaults to all) */ rules?: LintRule[]; /** * chant #1051 — opt-in: discover `*.component.ts` files (for the COMP* * composition checks) in a sandboxed child process instead of the CLI's * own process (`chant lint --sandbox`). See `discoverComponents`'s * `sandbox` option (../../components/discover.ts). */ sandbox?: boolean; } /** * Lint command result */ export interface LintResult { /** Whether lint passed (no errors) */ success: boolean; /** Number of errors */ errorCount: number; /** Number of warnings */ warningCount: number; /** All diagnostics */ diagnostics: LintDiagnostic[]; /** Formatted output */ output: string; } /** * Execute the lint command */ export declare function lintCommand(options: LintOptions): Promise; /** * Print lint result to console */ export declare function printLintResult(result: LintResult): void; /** * Run lint in watch mode. Runs an initial lint, then watches for changes * and triggers re-lints. Returns a cleanup function. */ export declare function lintCommandWatch(options: LintOptions, onReLint?: (result: LintResult) => void): () => void; //# sourceMappingURL=lint.d.ts.map