MCPcopy Create free account
hub / github.com/donghaxkim/react-rewrite / findJSXElementAt

Function findJSXElementAt

packages/cli/src/transform.ts:31–40  ·  view source on GitHub ↗
(j: any, root: any, line: number, col: number)

Source from the content-addressed store, hash-verified

29 * Returns the ASTPath or null.
30 */
31export function findJSXElementAt(j: any, root: any, line: number, col: number): any | null {
32 let target: any = null;
33 root.find(j.JSXElement).forEach((p: any) => {
34 const loc = p.node.openingElement.loc;
35 if (loc && loc.start.line === line && loc.start.column === col) {
36 target = p;
37 }
38 });
39 return target;
40}
41
42/**
43 * Reorder JSX siblings by swapping elements at the given lines.

Callers 3

resolveNodesFunction · 0.85
updateClassNameFunction · 0.85
updateTextContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected