CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-babel--plugin-transform-block-scoped-functions

Babel plugin to ensure function declarations at the block level are block scoped

89

1.04x
Overview
Eval results
Files

rubric.jsonevals/scenario-1/

{
  "context": "This criteria evaluates how well the engineer uses the @babel/plugin-transform-block-scoped-functions package and related Babel APIs to build a tool that analyzes function declarations within switch case statements. The focus is on correct usage of Babel's AST traversal, parser, and plugin ecosystem to detect and report on switch case functions.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "AST Parsing",
      "description": "Uses @babel/parser or @babel/core's parse() method to parse JavaScript source code into an AST",
      "max_score": 15
    },
    {
      "name": "SwitchCase Visitor",
      "description": "Implements or uses a visitor pattern to traverse SwitchCase nodes in the AST (e.g., using @babel/traverse or implementing a plugin visitor)",
      "max_score": 20
    },
    {
      "name": "Function Detection",
      "description": "Correctly identifies FunctionDeclaration nodes within switch case consequents by checking node types",
      "max_score": 15
    },
    {
      "name": "Strict Mode Detection",
      "description": "Uses Babel's AST utilities or path methods (e.g., path.isInStrictMode() or examining directive nodes) to detect strict mode context",
      "max_score": 15
    },
    {
      "name": "Function Type Identification",
      "description": "Correctly identifies function types (regular, async, generator, async generator) by checking FunctionDeclaration node properties like async, generator, or examining metadata",
      "max_score": 20
    },
    {
      "name": "Case Value Extraction",
      "description": "Extracts the case test value (or identifies default cases) from SwitchCase nodes using appropriate AST properties",
      "max_score": 10
    },
    {
      "name": "Output Format",
      "description": "Produces valid JSON output with the required structure (functionName, caseValue, strictMode, functionType)",
      "max_score": 5
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/npm-babel--plugin-transform-block-scoped-functions

tile.json