UNPKG

eslint-codemod-utils

Version:

A collection of AST helper functions for more complex ESLint rule fixes.

17 lines (16 loc) 643 B
import { typeToHelperLookup } from '../constants'; /** * 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 const node = (estNode) => { const handler = typeToHelperLookup[estNode.type]; return handler(estNode); };