Babel plugin to ensure function declarations at the block level are block scoped
89
{
"context": "This criteria evaluates how effectively the engineer utilizes @babel/plugin-transform-block-scoped-functions to build a transpiler that transforms block-scoped function declarations. The focus is on proper package integration, correct visitor pattern implementation, and appropriate handling of different JavaScript contexts.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Plugin Integration",
"description": "Properly integrates @babel/plugin-transform-block-scoped-functions into a Babel transformation pipeline using @babel/core's transform or transformSync functions",
"max_score": 15
},
{
"name": "BlockStatement Visitor",
"description": "Correctly implements or utilizes the BlockStatement visitor to detect and transform function declarations within block statements",
"max_score": 20
},
{
"name": "SwitchCase Visitor",
"description": "Correctly implements or utilizes the SwitchCase visitor to handle function declarations within switch case bodies",
"max_score": 15
},
{
"name": "Strict Mode Detection",
"description": "Properly leverages the plugin's strict mode detection to transform all functions in strict mode, or implements equivalent strict mode checking using Babel's AST path analysis methods",
"max_score": 15
},
{
"name": "Async/Generator Handling",
"description": "Correctly handles async functions and generator functions transformation in non-strict mode by utilizing the plugin's built-in detection of async and generator function types",
"max_score": 15
},
{
"name": "Function Body Filtering",
"description": "Properly filters out function declarations that are direct children of function bodies, either by using the plugin's built-in filtering or by implementing equivalent parent node checks",
"max_score": 10
},
{
"name": "Variable Declaration Output",
"description": "Produces correct output where transformed functions become let-bound variable declarations with function expressions, preserving function names in the variable binding",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-babel--plugin-transform-block-scoped-functions