eslint-codemod-utils
Version:
A collection of AST helper functions for more complex ESLint rule fixes.
15 lines (14 loc) • 498 B
JavaScript
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.
*
* In theory this function can be applied to any valid esprima node blindly and
* it will correctly resolve to an `eslint-codemod-utils` stringable node.
*
* @internal
*/
export const node = (estNode) => {
// @ts-expect-error
return typeToHelperLookup[estNode.type](estNode);
};