Babel plugin to ensure function declarations at the block level are block scoped
89
{
"context": "This criteria evaluates how well the engineer uses Babel's NodePath API to traverse the AST and analyze parent context of function declarations. The focus is on proper usage of path.parent, path.parentPath, and node type checking methods to determine the surrounding context of function declarations.",
"type": "weighted_checklist",
"checklist": [
{
"name": "FunctionDeclaration visitor",
"description": "Implements a FunctionDeclaration visitor method in the plugin's visitor object that receives NodePath objects",
"max_score": 15
},
{
"name": "NodePath parent analysis",
"description": "Uses path.parent or path.parentPath to access and analyze parent nodes in the AST hierarchy",
"max_score": 25
},
{
"name": "Context identification logic",
"description": "Correctly identifies whether a function is in a block statement, function body, or export declaration by checking parent node types (e.g., path.parent.type or using path.getFunctionParent())",
"max_score": 25
},
{
"name": "Function property detection",
"description": "Accesses node.async and node.generator properties to detect async and generator functions",
"max_score": 15
},
{
"name": "Results collection mechanism",
"description": "Stores analysis results in plugin state or external structure for retrieval after traversal",
"max_score": 10
},
{
"name": "Correct output format",
"description": "Produces result objects with the exact structure specified in the API: name, context, async, and generator fields",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-babel--plugin-transform-block-scoped-functions