Babel plugin that transforms eval() calls containing string literals by parsing and compiling the string content at transform time
Overall
score
98%
{
"context": "This criteria evaluates the engineer's ability to use Babel's plugin system APIs, specifically focusing on visitor-based transformations, AST node manipulation using @babel/types, and proper plugin structure. The evaluation assesses correct usage of visitor patterns, node type checking, AST builders, and access to file state.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Plugin structure",
"description": "Plugin exports a function that returns an object with a 'visitor' property. The function follows Babel's plugin API convention.",
"max_score": 15
},
{
"name": "Visitor pattern usage",
"description": "Uses visitor pattern to visit CallExpression nodes, implementing either a CallExpression visitor method or MemberExpression visitor method to detect console method calls.",
"max_score": 20
},
{
"name": "Node type checking",
"description": "Uses @babel/types methods to check node types, such as t.isMemberExpression(), t.isIdentifier(), or equivalent type checking functions to validate console.log/warn/error patterns.",
"max_score": 15
},
{
"name": "AST node creation",
"description": "Uses @babel/types builder functions (e.g., t.stringLiteral()) to create the location string node that will be prepended to console arguments.",
"max_score": 15
},
{
"name": "Node manipulation",
"description": "Correctly modifies the arguments array of the CallExpression by using methods like unshift(), push(), or array manipulation to prepend the location information.",
"max_score": 15
},
{
"name": "State access",
"description": "Accesses plugin state or path state to retrieve file information, such as using state.file.opts.filename, this.file.opts.filename, or path.hub.file.opts.filename to get the current file path.",
"max_score": 10
},
{
"name": "Location information",
"description": "Uses node.loc or path.node.loc to access line number information from the AST node's location data.",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-babel-plugin-transform-evaldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10