Babel plugin that automatically adds displayName properties to React class components created with createClass
Overall
score
96%
Create a small transform helper that processes JavaScript/TypeScript source containing React createClass usages and ensures that missing displayName properties are injected while existing displayName definitions remain untouched.
createClass call includes a displayName property, the transformed output keeps the original value without adding or changing anything else. @testcreateClass call assigned to an identifier (e.g., const Card = createClass({...})) that lacks displayName, the transformed output injects a single displayName matching the identifier. @testcreateClass calls appear inside object properties or nested expressions, only those lacking displayName get one; any call that already declares displayName is left unchanged, and no duplicates appear. @test@generates
export interface TransformOptions {
filename?: string;
parserPlugins?: string[];
}
export function annotateDisplayNames(source: string, options?: TransformOptions): string;Runs the source transform pipeline.
Injects display names for React createClass components only when missing.
Install with Tessl CLI
npx tessl i tessl/npm-babel-plugin-transform-react-display-name