JSX parsing plugin for the Acorn JavaScript parser that enables fast parsing of React JSX syntax
76
{
"context": "This criteria evaluates how well the engineer uses acorn-jsx to parse JSX code and extract information about different types of children (text, elements, and expressions) within JSX elements. The focus is on correct usage of the acorn-jsx parser and proper traversal of the resulting AST to identify JSXText, JSXElement, and JSXExpressionContainer nodes.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Parser initialization",
"description": "Uses acorn.Parser.extend() to create a parser with JSX support, passing the jsx plugin function",
"max_score": 15
},
{
"name": "Parse JSX code",
"description": "Calls Parser.parse() with appropriate options (ecmaVersion, sourceType) to parse the JSX code into an AST",
"max_score": 15
},
{
"name": "Navigate to children",
"description": "Correctly accesses the children array from the JSXElement node structure (openingElement, closingElement, children)",
"max_score": 15
},
{
"name": "Identify JSXText nodes",
"description": "Detects children with type 'JSXText' and extracts the text value from the appropriate property (value or raw)",
"max_score": 15
},
{
"name": "Identify JSXElement nodes",
"description": "Detects children with type 'JSXElement' and extracts element name from openingElement.name structure",
"max_score": 15
},
{
"name": "Identify JSXExpressionContainer nodes",
"description": "Detects children with type 'JSXExpressionContainer' to identify expression children",
"max_score": 15
},
{
"name": "Handle mixed children",
"description": "Correctly processes and categorizes all children when multiple types are present in the same parent element",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-acorn-jsxdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10