Babel plugin that automatically adds displayName properties to React class components created with createClass
Overall
score
96%
Ensure a small build helper can transpile React component sources while preserving display names when JSX is compiled in both classic and automatic runtimes.
const Button = createReactClass({ render() { return <span/>; } }); export default Button; and runtime set to "classic", the output includes a displayName: "Button" property inside the component factory and JSX compiled using the classic runtime (e.g. React.createElement). @testexport default createReactClass({ render() { return <div/>; } }); and runtime set to "automatic", the output imports from react/jsx-runtime (no React import) and includes displayName: "Card" derived from the provided filename components/Card.jsx. @test"classic" and the filename ends with index.jsx, default-exported component factories receive displayName from the parent directory name (e.g. /app/profile/index.jsx yields displayName: "profile"). @test@generates
export interface TransformRequest {
source: string;
runtime: "classic" | "automatic";
filename?: string;
}
export function transpileWithDisplayNames(request: TransformRequest): string;Ensures component factory calls receive displayName during transformation.
Compiles JSX for both classic and automatic runtimes.
Install with Tessl CLI
npx tessl i tessl/npm-babel-plugin-transform-react-display-name