import type { UnknownArray } from "type-fest"; import { type TSESLint, type TSESTree } from "@typescript-eslint/utils"; import { type AutofixImportInsertionStrategy } from "./import-aware-fixes.js"; import { type ImportFixIntent } from "./import-fix-coordinator.js"; /** * Immutable mapping of imported symbol names to directly imported local * aliases. */ export type ImportedValueAliasMap = ReadonlyMap>; /** * Parameters for creating a safe member-expression to function-call fixer. */ type MemberToFunctionCallFixParams = Readonly<{ context: Readonly>; importedName: string; imports: ImportedValueAliasMap; memberNode: TSESTree.MemberExpression; reportFixIntent?: ImportFixIntent; sourceModuleName: string; }>; /** * Parameters for creating a safe method-call to function-call fixer. */ type MethodToFunctionCallFixParams = Readonly<{ callNode: TSESTree.CallExpression; context: Readonly>; importedName: string; imports: ImportedValueAliasMap; reportFixIntent?: ImportFixIntent; sourceModuleName: string; }>; /** * Parameters for resolving a safe local alias for an imported value symbol. */ type SafeImportedValueNameParams = Readonly<{ context: Readonly>; importedName: string; imports: ImportedValueAliasMap; referenceNode: TSESTree.Node; sourceModuleName: string; }>; /** * Parameters for creating a safe replacement fixer with custom replacement text * derived from the resolved helper local name. */ type SafeValueNodeTextReplacementFixParams = Readonly<{ context: Readonly>; importedName: string; imports: ImportedValueAliasMap; replacementTextFactory: (replacementName: string) => string; reportFixIntent?: ImportFixIntent; sourceModuleName: string; targetNode: TSESTree.Node; }>; /** * Parameters for creating a safe replacement fixer for a value reference. */ type SafeValueReplacementFixParams = Readonly<{ context: Readonly>; importedName: string; imports: ImportedValueAliasMap; reportFixIntent?: ImportFixIntent; sourceModuleName: string; targetNode: TSESTree.Node; }>; /** * Parameters for creating a safe function-call replacement fixer. */ type ValueArgumentFunctionCallFixParams = Readonly<{ argumentNode: TSESTree.Node; autofixImportInsertionStrategy?: AutofixImportInsertionStrategy; context: Readonly>; importedName: string; imports: ImportedValueAliasMap; negated?: boolean; reportFixIntent?: ImportFixIntent; sourceModuleName: string; targetNode: TSESTree.Node; }>; /** * Collect direct named value imports from a specific module. * * @param sourceCode - Source code object for the current file. * @param sourceModuleName - Module source string to match. * * @returns Readonly map of imported symbol names to local aliases. */ export declare const collectDirectNamedValueImportsFromSource: (sourceCode: Readonly, sourceModuleName: string) => ImportedValueAliasMap; /** * Resolve a safe local alias for a required imported value at one reference. * * @param options - Rule context, import alias map, and target reference * metadata. * * @returns Local alias when the current scope binds it to the expected module; * otherwise `null`. */ export declare const getSafeLocalNameForImportedValue: ({ context, importedName, imports, referenceNode, sourceModuleName, }: Readonly) => null | string; /** * Serialize a call argument node to text, preserving sequence-expression * semantics with parentheses when required. * * @param options - Argument node and source-code accessor. * * @returns Trimmed argument text suitable for function-call insertion, or * `null` when no text can be produced. */ export declare const getFunctionCallArgumentText: ({ argumentNode, sourceCode, }: Readonly<{ argumentNode: Readonly; sourceCode: Readonly; }>) => null | string; /** * Create a fixer that safely replaces a target node with a resolved local * import alias. * * @param options - Inputs used to resolve replacement/import insertion safety. * * @returns A report fixer when safe; otherwise `null`. */ export declare const createSafeValueReferenceReplacementFix: ({ context, importedName, imports, reportFixIntent, sourceModuleName, targetNode, }: Readonly) => null | TSESLint.ReportFixFunction; /** * Create a fixer that safely rewrites a target node using custom replacement * text derived from a resolved helper local name. * * @param options - Inputs for safe helper-name resolution and replacement-text * generation. * * @returns A report fixer when safe; otherwise `null`. */ export declare const createSafeValueNodeTextReplacementFix: ({ context, importedName, imports, replacementTextFactory, reportFixIntent, sourceModuleName, targetNode, }: Readonly) => null | TSESLint.ReportFixFunction; /** * Create a fixer that rewrites `receiver.method(args...)` to * `importedFn(receiver, args...)`. * * @returns A report fixer when safe; otherwise `null`. */ export declare const createMethodToFunctionCallFix: ({ callNode, context, importedName, imports, reportFixIntent, sourceModuleName, }: Readonly) => null | TSESLint.ReportFixFunction; /** * Create a fixer that rewrites `receiver[member]` to `importedFn(receiver)`. * * @returns A report fixer when safe; otherwise `null`. */ export declare const createMemberToFunctionCallFix: ({ context, importedName, imports, memberNode, reportFixIntent, sourceModuleName, }: Readonly) => null | TSESLint.ReportFixFunction; /** * Create a fixer that rewrites a target node to an imported helper invocation. * * @param options - Target/argument nodes and import metadata for call * * @returns A report fixer when safe; otherwise `null`. */ export declare const createSafeValueArgumentFunctionCallFix: ({ argumentNode, autofixImportInsertionStrategy, context, importedName, imports, negated, reportFixIntent, sourceModuleName, targetNode, }: Readonly) => null | TSESLint.ReportFixFunction; export {}; //# sourceMappingURL=imported-value-symbols.d.ts.map