/** * Shared helpers for rules reasoning about AST shape (walking a subtree, * matching normalized text), lexical scope (enclosing class), or the * filesystem (listing/reading source files safely). Extracted so logic * stays consistent across `tools/*` rules. */ import type { Rule } from 'eslint'; /** * Recursively visits every node reachable from `node`, depth-first with no * further order guarantee. Skips the `parent` back-pointer (every node * points to its parent, so following it recurses forever) and descends into * child arrays and single nodes. */ export declare function walk(node: unknown, visit: (node: Rule.Node) => void): void; /** Collapses internal whitespace so multi-line source text matches regardless of formatting. */ export declare function normalize(text: string): string; type ClassNode = Extract; /** * Walks up `.parent` looking for the nearest enclosing class. Returns `null` * when `node` lives at module scope (or otherwise outside any class body). */ export declare function findEnclosingClass(node: Rule.Node): ClassNode | null; /** Directories skipped by every recursive package-file listing, regardless of rule config. */ export declare const IMPLICIT_EXCLUDED_DIRS: readonly string[]; /** * TTL for {@link getPackageFiles}'s cache: long enough to amortize repeated * lookups per lint pass, short enough that a long-lived process (IDE server, * `eslint_d`, watch mode) reflects disk changes without a restart. */ export declare const FILE_CACHE_TTL_MS = 5000; /** Every file under `root`, recursively, excluding {@link IMPLICIT_EXCLUDED_DIRS}. Cached per root. */ export declare function getPackageFiles(root: string): readonly string[]; /** Reads `file` as UTF-8, or `null` when it doesn't exist or isn't readable. */ export declare function readFileSafe(file: string): string | null; /** Parses `text` as JSON, or `null` when it isn't valid JSON. */ export declare function tryParseJson(text: string): unknown; /** Converts a `file://` URL or OS-native path to a forward-slash path for cross-platform text matching. */ export declare function normalizePath(filepath: string): string; export {};