Babel plugin to ensure function declarations at the block level are block scoped
89
{
"context": "This criteria evaluates how well the engineer uses @babel/plugin-transform-block-scoped-functions to transform function declarations while preserving function identity through proper name management and conversion to anonymous function expressions.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Plugin Integration",
"description": "Uses @babel/plugin-transform-block-scoped-functions plugin correctly in the Babel transformation pipeline, either through .babelrc configuration or programmatic API usage with @babel/core (transform, transformSync, or transformAsync).",
"max_score": 25
},
{
"name": "Function Name Preservation",
"description": "The transformation preserves the original function declaration's name as the let-bound variable identifier, ensuring function identity is maintained in the block scope.",
"max_score": 25
},
{
"name": "Anonymous Expression Conversion",
"description": "Named function declarations are correctly converted to anonymous function expressions (function without name) assigned to the let variable, matching the plugin's transformation pattern.",
"max_score": 20
},
{
"name": "Strict Mode Handling",
"description": "Correctly detects or handles strict mode context, applying transformations to all function declarations in strict mode and only to async/generator functions in non-strict mode.",
"max_score": 15
},
{
"name": "Special Function Types",
"description": "Properly handles async functions, generator functions, and async generator functions, ensuring they are transformed regardless of strict mode status.",
"max_score": 10
},
{
"name": "Context Exclusions",
"description": "Correctly skips transformation for functions that are direct children of function bodies or within export declarations, as per the plugin's behavior.",
"max_score": 5
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-babel--plugin-transform-block-scoped-functions