AST utility module for statically analyzing JSX
50
Pending
Does it follow best practices?
Impact
50%
1.42xAverage score across 10 eval scenarios
Pending
The risk profile of this skill
Transform parsed JSX attribute nodes into serializable shapes that preserve how arrays, objects, and callable constructs appear in the original JSX.
settings attribute set to { layout: "grid", ...preset, meta: { active: true, ...extras }, tags: ["a", ...labels, "z"] } returns a shape { name: "settings", value: { layout: "grid", meta: { active: true }, tags: ["a", undefined, "z"] } }, treating unknown object spreads as empty objects and unknown array spreads as undefined slots while keeping literal members intact and in order. @test{ config: { limits: { retries: 3 }, path: ["/home", null, 9] } } yields { name: "config", value: { limits: { retries: 3 }, path: ["/home", null, 9] } } with the same nesting depth and primitive values. @testaction={::this.handleClick} or action={foo::bar}) returns the string form of the bind call such as "this.handleClick.bind(this)" or "bar.bind(foo)" while retaining other props untouched. @testnew expression (e.g., connection={new Client('abc')}) yields an empty object {} for that value, and any literal siblings inside arrays or objects around it remain preserved. @test@generates
export interface PropShape {
/** Attribute name */
name: string;
/** Reconstructed value from the JSX attribute */
value: any;
}
/**
* Converts JSXAttribute nodes into named shapes, reconstructing
* array/object expressions (including spreads), bind expressions, and new expressions.
*/
export function extractPropShapes(attributes: any[]): PropShape[];Utilities for reading JSX attribute names and reconstructing prop values from AST nodes.
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10