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

98

1.28x
Quality

Pending

Does it follow best practices?

Impact

98%

1.28x

Average score across 10 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

criteria.jsonevals/scenario-6/

{
  "context": "This criteria evaluates how effectively the engineer uses Babel's static analysis and AST manipulation capabilities to implement a dead code elimination plugin. The focus is on proper usage of path.evaluate() for compile-time evaluation, AST node type checking, and AST node replacement operations.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Visitor pattern usage",
      "description": "Implements a Babel plugin that returns an object with a visitor property containing an IfStatement visitor method to traverse and analyze if statements",
      "max_score": 15
    },
    {
      "name": "Path evaluation API",
      "description": "Uses path.evaluate() or path.get('test').evaluate() to perform compile-time evaluation of the conditional expression in if statements",
      "max_score": 25
    },
    {
      "name": "Evaluation confidence check",
      "description": "Checks the confidence property of the evaluation result (e.g., result.confident) to determine if the expression can be safely evaluated at compile time",
      "max_score": 15
    },
    {
      "name": "True condition handling",
      "description": "When condition evaluates to true, uses path.replaceWithMultiple() or path.replaceWith() with the consequent block's body to replace the if statement with only the consequent statements",
      "max_score": 15
    },
    {
      "name": "False condition handling",
      "description": "When condition evaluates to false, either removes the if statement using path.remove() (if no else branch) or replaces it with the alternate branch body using path.replaceWithMultiple() or path.replaceWith()",
      "max_score": 15
    },
    {
      "name": "Block statement handling",
      "description": "Correctly extracts statements from BlockStatement nodes by accessing the body property (e.g., path.node.consequent.body) when replacing the if statement",
      "max_score": 10
    },
    {
      "name": "Type checking utilities",
      "description": "Uses @babel/types functions such as t.isBlockStatement() or node.type checking to validate AST node types before manipulation",
      "max_score": 5
    }
  ]
}

tile.json