CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-babel-plugin-transform-es2015-literals

Babel plugin that compiles ES2015 unicode string and number literals to ES5

86

0.97x
Overview
Eval results
Files

rubric.jsonevals/scenario-4/

{
  "context": "This criteria evaluates how well the engineer uses @babel/plugin-transform-literals package capabilities to implement AST metadata manipulation. The focus is on proper use of Babel's visitor pattern, correct manipulation of the 'extra' property on AST nodes, and appropriate handling of NumericLiteral and StringLiteral node types.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Plugin structure",
      "description": "Uses @babel/helper-plugin-utils 'declare' function to create the plugin with proper API version assertion and returns a plugin object with a 'name' property and 'visitor' object",
      "max_score": 15
    },
    {
      "name": "Visitor pattern",
      "description": "Implements Babel visitor pattern correctly with visitor functions for 'NumericLiteral' and 'StringLiteral' node types",
      "max_score": 15
    },
    {
      "name": "Extra property deletion",
      "description": "Removes the 'extra' property from AST nodes (using 'delete node.extra') rather than directly modifying node values, allowing Babel's generator to produce normalized output",
      "max_score": 25
    },
    {
      "name": "Binary/octal pattern detection",
      "description": "Correctly identifies binary (0b/0B) and octal (0o/0O) numeric literals using pattern matching (e.g., regex /^0[ob]/i on node.extra.raw or node.extra.rawValue) before removing extra property",
      "max_score": 15
    },
    {
      "name": "Unicode escape detection",
      "description": "Correctly identifies string literals containing unicode escapes by checking for '\\u' pattern in node.extra.raw or node.extra.rawValue before removing extra property",
      "max_score": 15
    },
    {
      "name": "Hexadecimal preservation",
      "description": "Does NOT transform hexadecimal literals (0x/0X prefix) - either explicitly excludes them or naturally preserves them by only matching binary/octal patterns",
      "max_score": 10
    },
    {
      "name": "Test coverage",
      "description": "Provides test cases covering binary literal transformation, octal literal transformation, unicode string normalization, and verification that hexadecimal literals remain unchanged",
      "max_score": 5
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/npm-babel-plugin-transform-es2015-literals

tile.json