Babel plugin that compiles ES2015 unicode string and number literals to ES5
86
{
"context": "This criteria evaluates how well the engineer uses the @babel/helper-plugin-utils package and Babel's visitor pattern API to implement a Babel transformation plugin. The focus is on proper plugin structure, correct visitor implementation, and appropriate AST node manipulation.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Plugin wrapper usage",
"description": "Uses the `declare` function from @babel/helper-plugin-utils to create the plugin wrapper",
"max_score": 15
},
{
"name": "API version assertion",
"description": "Calls `api.assertVersion(7)` or `api.assertVersion(REQUIRED_VERSION(7))` to validate Babel version compatibility",
"max_score": 10
},
{
"name": "Plugin structure",
"description": "Returns an object with `name` property and `visitor` property containing the visitor implementation",
"max_score": 15
},
{
"name": "NumericLiteral visitor",
"description": "Implements a visitor function for the `NumericLiteral` node type to handle hexadecimal literals",
"max_score": 20
},
{
"name": "Hexadecimal detection",
"description": "Correctly identifies hexadecimal literals by checking if `node.extra` and `node.extra.raw` exist and match the pattern for hex literals (starting with 0x or 0X)",
"max_score": 15
},
{
"name": "AST manipulation approach",
"description": "Modifies the `node.extra.raw` property to change the formatted output, or removes/updates `node.extra` to allow the generator to reformat",
"max_score": 15
},
{
"name": "Prefix normalization",
"description": "Converts hexadecimal prefix to lowercase '0x' format in the transformed output",
"max_score": 5
},
{
"name": "Digit normalization",
"description": "Converts hexadecimal digits (a-f) to uppercase in the transformed output",
"max_score": 5
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-babel-plugin-transform-es2015-literalsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10