import type { PickierConfig, PickierOptions, RuleSeverity, RulesConfigMap } from './types'; /** * Glob files matching the given patterns. * Uses Bun.Glob when running under Bun for maximum performance, * falls back to a pure Node fs recursive walk otherwise. */ export declare function glob(patterns: string[], opts?: GlobOptions): Promise; /** * Concurrency limiter — runs at most `concurrency` async tasks simultaneously. * Returns a scheduler function identical in signature to p-limit: * const limit = createLimiter(8) * await Promise.all(items.map(x => limit(() => process(x)))) */ export declare function createLimiter(concurrency: number): (fn: () => Promise) => Promise; /** * Parse a rule configuration value and return its settings. * Handles both string format ('error', 'warn', 'off') and array format (['error', options]). */ export declare function getRuleSetting(rulesConfig: RulesConfigMap, ruleId: string): { enabled: boolean, severity?: 'error' | 'warning', options?: any }; /** * Normalize a raw rule config value into a severity. * * Accepts both the string form (`'error'`) and the array form * (`['warn', options]`). Returns `'off'` for an explicit opt-out and * `undefined` when the rule is not configured at all — the two are different * answers, and only the caller knows what an unconfigured rule should default * to (plugin rules default to disabled, built-in rules do not). */ export declare function normalizeRuleSeverity(raw: unknown): 'off' | 'warning' | 'error' | undefined; /** * The single severity gate every rule passes through before it runs. * * A rule is configurable from either config map — `rules` and `pluginRules` * are both user-facing and people reasonably reach for whichever they saw * first — and under any of its aliases: the id it reports as (`no-console`), * the plugin-qualified id (`style/quotes`), or the legacy camelCase key the * built-in scan was originally written against (`noConsole`). Pass the * reported id first and aliases in descending priority; the first configured * one wins, so an explicit `'no-console': 'off'` beats an inherited * `noConsole: 'warn'`. * * Returns the severity issues should be reported at, or `undefined` when the * rule is off — callers must not run a rule that resolves to `undefined`. */ export declare function resolveRuleSeverity(cfg: Pick, ruleId: string, aliases?: string[], fallback?: RuleSeverity): 'warning' | 'error' | undefined; /** * True when a rule is explicitly switched off in either config map. * * Distinct from `resolveRuleSeverity`: this answers "did the user opt out?" * for call sites whose default is enabled, where an unconfigured rule must * keep running. */ export declare function isRuleOff(cfg: Pick, ruleId: string): boolean; /** * Colorize console output (simple ANSI colors) */ export declare function colorize(code: string, text: string): string; export declare function green(text: string): string; export declare function red(text: string): string; export declare function yellow(text: string): string; export declare function blue(text: string): string; export declare function gray(text: string): string; export declare function bold(text: string): string; // Shared CLI utilities (moved from cli/utils.ts) export declare function mergeConfig(base: PickierConfig, override: PickierOptions): PickierConfig; export declare function loadConfigFromPath(pathLike: string | undefined): Promise; export declare function expandPatterns(patterns: string[]): string[]; export declare function isCodeFile(file: string, allowedExts: Set): boolean; /** * A project's ignore list, with the never-lintable paths guaranteed to be in * it. See {@link ALWAYS_IGNORES}: a project that sets `ignores` replaces the * defaults, and the two entries nobody meant to opt out of went with them. */ export declare function withAlwaysIgnores(ignores: readonly string[]): string[]; /** * Build a reusable matcher for ignore checks. * * File discovery may check the same ignore list tens of thousands of times, so * callers should create one matcher per run and reuse it instead of reparsing * glob strings for every path. */ export declare function createIgnoreMatcher(ignoreGlobs: readonly string[], cwd?: string): IgnoreMatcher; /** * Lightweight ignore matcher supporting common patterns like double-star slash * dir slash double-star. Kept for public utility callers; the linter hot path * should use `createIgnoreMatcher()` and reuse the returned function. */ export declare function shouldIgnorePath(absPath: string, ignoreGlobs: string[]): boolean; /** * Maximum number of fixer passes to run. * This prevents infinite loops when fixers keep modifying content. */ export declare const MAX_FIXER_PASSES: 5; export declare const ENV: EnvConfig; /** * Paths that are never anybody's source, and are therefore ignored no matter * what a project's config says. * * A project that sets `ignores` REPLACES the defaults — which is what you want * for a list of the project's own directories, and a trap for the two entries * nobody meant to opt out of. Every stacks app ships a `config/code-style.ts` * with an `ignores` array, so every stacks app was linting its dependencies: * `node_modules` was in the defaults, the project list did not repeat it, and * the defaults were gone. Nothing in the output says "these 40,000 findings are * in code you did not write" — it just gets slower and noisier, and a rule that * fires inside a published package is one nobody can act on. * * Deliberately just these. `dist`, `coverage`, `.github` and the rest stay * overridable, because linting your own build output or your workflows is a * reasonable thing to want. Nothing reasonable wants to lint `node_modules` or * the object database in `.git`. */ export declare const ALWAYS_IGNORES: readonly string[]; /** * Universal ignore patterns that should apply everywhere. * These are always excluded regardless of project-specific config. */ export declare const UNIVERSAL_IGNORES: readonly string[]; export declare const colors: { green: (text: string) => string red: (text: string) => string yellow: (text: string) => string blue: (text: string) => string gray: (text: string) => string bold: (text: string) => string }; // --------------------------------------------------------------------------- // Homegrown glob — uses Bun.Glob when available, falls back to Node fs walk. // Matches the tinyglobby API subset used in this project: // glob(patterns, { dot?, ignore?, onlyFiles?, absolute? }) // --------------------------------------------------------------------------- declare interface GlobOptions { dot?: boolean ignore?: string[] onlyFiles?: boolean absolute?: boolean cwd?: string } /** * Environment variable configuration with defaults. * Centralized to avoid scattered parsing and provide documentation. */ export declare interface EnvConfig { readonly TRACE: boolean readonly TIMEOUT_MS: number readonly RULE_TIMEOUT_MS: number readonly CONCURRENCY: number readonly DIAGNOSTICS: boolean readonly FAIL_ON_WARNINGS: boolean readonly NO_AUTO_CONFIG: boolean } declare type IgnoreMatcher = (absPath: string) => boolean;