Babel plugin that automatically adds displayName properties to React class components created with createClass
Overall
score
96%
{
"context": "Evaluates whether the solution leverages babel-plugin-transform-react-display-name to validate React.createClass/createReactClass calls and inject displayName values correctly. Focuses on using the plugin with Babel transforms to enforce single object-literal arguments and to preserve existing displayName declarations while handling invalid inputs.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Plugin setup",
"description": "Configures Babel to run babel-plugin-transform-react-display-name when transforming source (e.g., via @babel/core.transformSync or equivalent).",
"max_score": 20
},
{
"name": "Valid transform",
"description": "With a single object-literal argument, the transform injects displayName derived from the surrounding identifier for both React.createClass and createReactClass calls using the plugin output.",
"max_score": 25
},
{
"name": "Multiple args guard",
"description": "Detects createClass invocations with more than one argument and raises the required error (including the filename) instead of letting the plugin silently proceed.",
"max_score": 20
},
{
"name": "Non-object guard",
"description": "Rejects createClass calls whose first argument is not an ObjectExpression (e.g., function call or identifier) with the specified error message before or after plugin execution.",
"max_score": 20
},
{
"name": "DisplayName preservation",
"description": "Ensures existing displayName keys remain unchanged by the plugin, returning code identical aside from formatting produced by the transform.",
"max_score": 15
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-babel-plugin-transform-react-display-name