import type { LintResult, LintMessage, DesignTokens, DtifFlattenedToken, RegisteredRuleListener } from './types.js'; import type { NameTransform } from '../utils/tokens/index.js'; import { TokenRegistry } from './token-registry.js'; export { defaultIgnore } from './ignore.js'; import { RuleRegistry } from './rule-registry.js'; import type { PluginMeta } from './plugin-manager.js'; import { TokenTracker } from './token-tracker.js'; import type { LintDocument, Environment } from './environment.js'; import type { CacheProvider } from './cache-provider.js'; import { LintService } from './lint-service.js'; import type { ParserPassResult } from './parser-registry.js'; export interface Config { /** * One or more base config objects to extend. Rules and settings from each * entry are merged left-to-right, with later entries taking precedence. * User-level `rules` override all extended values. */ extends?: Config[]; format?: string; rules?: Record; ignoreFiles?: string[]; plugins?: string[]; configPath?: string; configSources?: string[]; concurrency?: number; patterns?: string[]; nameTransform?: NameTransform; templateTags?: string[]; } /** * Lints files using built-in and plugin-provided rules. */ export declare class Linter { private config; private tokensByTheme; private ruleRegistry; private tokenTracker; /** @internal Accessible to subclasses for sequencing after token resolution. */ protected tokensReady: Promise; /** @internal Accessible to subclasses for token injection in testing contexts. */ protected tokenRegistry?: TokenRegistry; private service?; constructor(config: Config, depsOrEnv: { ruleRegistry: RuleRegistry; tokenTracker: TokenTracker; tokensReady: Promise>; } | Environment); setService(service: LintService): void; lintDocument(doc: LintDocument, fix?: boolean): Promise; lintDocuments(documents: LintDocument[], fix?: boolean, cache?: CacheProvider): Promise<{ results: LintResult[]; ignoreFiles: string[]; warning?: string; }>; lintTargets(targets: string[], fix?: boolean, ignore?: string[]): Promise<{ results: LintResult[]; ignoreFiles: string[]; warning?: string; }>; /** * Retrieves completions for design token references. * * @returns A map of theme names to arrays of token paths available in that theme. */ getTokenCompletions(): Record; /** * Look up a flattened DTIF token by its dot-separated path string. * * The path is the same string produced by `getTokenCompletions` — e.g. * `"color.brand.primary"`. Searches all loaded themes and returns the first * matching token, or `undefined` when no token matches. * * @param tokenPath - Dot-separated token path (e.g. `"color.brand.primary"`). * @returns The matching {@link DtifFlattenedToken}, or `undefined`. */ getDtifTokenByPath(tokenPath: string): DtifFlattenedToken | undefined; getPluginPaths(): Promise; getPluginMetadata(): Promise; hasRunLevelRules(): Promise; /** * Lints a single text document and returns linting results. * * @param text - The source text to lint. * @param sourceId - Identifier for the document, typically a file path. * @param docType - Optional file type override for parser selection. * @param metadata - Optional metadata passed to rules via context. * @returns A {@link LintResult} describing issues found in the text. */ private lintText; private buildRunRuleContexts; /** * Constructs rule execution contexts and collects rule metadata. * * @param enabled - The enabled rules and their configuration. * @param sourceId - Identifier for the document being linted. * @param metadata - Optional metadata to expose to rules. * @returns Listeners, rule descriptions, categories, and a mutable message store. */ protected buildRuleContexts(enabled: ReturnType, sourceId: string, metadata?: Record): { listeners: RegisteredRuleListener[]; ruleDescriptions: Record; ruleCategories: Record; messages: LintMessage[]; }; /** * Executes the appropriate parser for the given document and dispatches tokens to rule listeners. * * @param text - The source text to parse. * @param sourceId - Identifier for the document, typically a file path. * @param docType - Explicit file type, otherwise inferred from {@link sourceId}. * @param listeners - Rule listeners generated by {@link buildRuleContexts}. * @param messages - Mutable list of lint messages to populate during parsing. */ protected runParser(text: string, sourceId: string, docType: string | undefined, listeners: RegisteredRuleListener[], messages: LintMessage[]): Promise; /** * Removes messages that have been suppressed with inline disable comments. * * @param text - The source text to inspect for disable directives. * @param messages - Messages produced during linting. * @returns The subset of messages that are not disabled. */ protected filterDisabledMessages(text: string, messages: LintMessage[]): LintMessage[]; } export { applyFixes } from './apply-fixes.js'; export declare function inferFileType(sourceId: string): string; //# sourceMappingURL=linter.d.ts.map