eslint-codemod-utils
Version:
A collection of AST helper functions for more complex ESLint rule fixes.
17 lines (16 loc) • 912 B
TypeScript
import type { EslintCodemodUtilsBaseNode, Loose, StringableASTNode } from '../types';
export type NodeMap<T extends EslintCodemodUtilsBaseNode = EslintCodemodUtilsBaseNode> = {
[E in T as E['type']]: (eventNodeListener: E) => StringableASTNode<E>;
};
/**
* Internally focused function to help resolve / parse the AST. It hands off
* to the `typeToHelperLookup` map to apply the correct transformation.
*
* This function can be applied to any valid `espree`/`typescript-eslint` node
* — whether it was produced by a parser (with full `loc`/`range`) or
* synthesised by a consumer through one of the node-factory helpers (which
* return `StringableASTNode<T>` where `loc`/`range` are optional).
*
* @internal
*/
export declare const node: <EstreeNodeType extends import("@typescript-eslint/types/dist/generated/ast-spec").Node>(estNode: Loose<EstreeNodeType>) => StringableASTNode<EstreeNodeType>;