import type { UnknownArray } from "type-fest"; /** * @packageDocumentation * Internal shared utilities used by eslint-plugin-runtime-cleanup rule modules * and plugin wiring. */ import type ts from "typescript"; import { ESLintUtils, type TSESLint } from "@typescript-eslint/utils"; import type { RuntimeCleanupConfigReference } from "./runtime-cleanup-config-references.js"; /** * Parser services and type checker bundle used by typed rules. */ export interface TypedRuleServices { checker: ts.TypeChecker; parserServices: ReturnType; } type RuntimeCleanupRuleCreator = ReturnType>; /** * Plugin-specific metadata extensions for `meta.docs`. * * @remarks * `eslint-plugin/require-meta-docs-recommended` expects `meta.docs.recommended` * to be boolean. Preset membership is tracked separately via * `meta.docs.runtimeCleanupConfigs`. */ interface RuntimeCleanupRuleDocs { recommended?: boolean; requiresTypeChecking?: boolean; ruleId?: string; ruleNumber?: number; runtimeCleanupConfigs?: readonly RuntimeCleanupConfigReference[] | RuntimeCleanupConfigReference; } /** Shared typed-rule context contract used by helper utilities. */ type TypedRuleContext = Readonly>>; export type { TypedRuleContext }; /** * Rule-creator wrapper used by plugin rules. * * @remarks * This wrapper automatically registers per-program plugin settings and injects * canonical `meta.docs.ruleId` / `meta.docs.ruleNumber` values for cataloged * public rules. * * @param ruleDefinition - Rule module definition passed to * `ESLintUtils.RuleCreator`. * * @returns Rule module factory output that auto-registers program settings and * preserves the authored rule contract. */ export declare const createTypedRule: RuntimeCleanupRuleCreator; /** * Retrieve parser services and type checker for typed rules. * * @param context - Rule context from the current lint evaluation. * * @returns Parser services and type checker references bound to the current * program. * * @throws Throws when `parserServices.program` is unavailable, which indicates * the current lint run is not configured for type-aware analysis. */ export declare const getTypedRuleServices: (context: TypedRuleContext) => TypedRuleServices; /** * Determine whether the current lint context has full type information. * * @param context - Rule context from the current lint evaluation. * * @returns `true` when parser services and `program` are available. */ export declare const hasTypeServices: (context: TypedRuleContext) => boolean; /** * Retrieve typed services when available, otherwise return `undefined`. * * @param context - Rule context from the current lint evaluation. * * @returns Typed services when parser services include a TypeScript program. */ export declare const getTypedRuleServicesOrUndefined: (context: TypedRuleContext) => TypedRuleServices | undefined; /** * Resolve the type of a signature parameter by index. * * @param options - Signature parameter lookup options. * * @returns Parameter type when available; otherwise `undefined`. */ export declare const getSignatureParameterTypeAt: (options: Readonly<{ checker: ts.TypeChecker; index: number; location: ts.Node; signature: null | ts.Signature | undefined; }>) => ts.Type | undefined; //# sourceMappingURL=typed-rule.d.ts.map