@storybook/codemod
Version:
A collection of codemod scripts written with JSCodeshift
22 lines (20 loc) • 587 B
TypeScript
/**
* Adds a `component` parameter for each storiesOf(...) call.
*
* For example:
*
* Input { Button } from './Button'; storiesOf('Button', module).add('story', () => <Button
* label="The Button" />);
*
* Becomes:
*
* Input { Button } from './Button'; storiesOf('Button', module) .addParameters({ component: Button
* }) .add('story', () => <Button label="The Button" />);
*
* Heuristics:
*
* - The storiesOf "kind" name must be Button
* - Button must be imported in the file
*/
declare function transformer(file: any, api: any): any;
export { transformer as default };