CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-babel-plugin-transform-eval

Babel plugin that transforms eval() calls containing string literals by parsing and compiling the string content at transform time

Overall
score

98%

Overview
Eval results
Files

rubric.jsonevals/scenario-9/

{
  "context": "This criteria evaluates how well the engineer uses Babel's AST traversal capabilities to analyze function calls in JavaScript code. The focus is on correct usage of @babel/parser for parsing and @babel/traverse for traversing the AST using the visitor pattern and NodePath API.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Parser usage",
      "description": "Uses @babel/parser (or parser.parse()) to parse the input JavaScript code string into an AST. The parse function should be called with the code string and appropriate options if needed.",
      "max_score": 20
    },
    {
      "name": "Traverse import/usage",
      "description": "Imports and correctly uses @babel/traverse (the default export or traverse function) to traverse the AST. Should call traverse with the AST and a visitor object.",
      "max_score": 20
    },
    {
      "name": "Visitor pattern",
      "description": "Implements a visitor object with a CallExpression visitor method (or handler) to identify all function call nodes in the AST. The visitor should follow the visitor pattern expected by @babel/traverse.",
      "max_score": 25
    },
    {
      "name": "NodePath API",
      "description": "Uses the NodePath object (the path parameter in the visitor) to access node properties and location information. Should access path.node or similar to get the CallExpression node data.",
      "max_score": 15
    },
    {
      "name": "Location tracking",
      "description": "Extracts line and column numbers from the node's location information (typically via path.node.loc or path.node.loc.start) to populate the callLocations array with correct line and column values.",
      "max_score": 10
    },
    {
      "name": "Function name extraction",
      "description": "Correctly extracts function names from different types of call expressions (simple calls like foo(), method calls like obj.method()) to populate the uniqueFunctions and callLocations arrays with accurate names.",
      "max_score": 10
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/npm-babel-plugin-transform-eval

tile.json