Babel plugin that automatically adds displayName properties to React class components created with createClass
Overall
score
96%
{
"context": "Evaluates how the solution wires @babel/plugin-transform-react-display-name into a @babel/core transform to inject displayName for default-exported React components using file and directory names while preserving existing values.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Plugin Included",
"description": "Babel transform configuration explicitly registers @babel/plugin-transform-react-display-name in the plugins list used by the implementation function.",
"max_score": 20
},
{
"name": "File Basename Inference",
"description": "Transformation invokes @babel/core (e.g., transform or transformSync) with a filename such that @babel/plugin-transform-react-display-name injects displayName for a default export based on the file's basename (e.g., Card.js -> Card).",
"max_score": 30
},
{
"name": "Index Folder Fallback",
"description": "For index.* files, the Babel call provides the full path so @babel/plugin-transform-react-display-name uses the parent directory name as the inferred displayName for the default export.",
"max_score": 25
},
{
"name": "Preserves Existing",
"description": "Relies on @babel/plugin-transform-react-display-name's behavior of skipping injection when a displayName already exists instead of overwriting it manually.",
"max_score": 15
},
{
"name": "Uses Transform Output",
"description": "Returns code (or equivalent output) produced by @babel/core with @babel/plugin-transform-react-display-name applied, rather than custom string manipulation that would bypass the plugin.",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-babel-plugin-transform-react-display-name