Included in these configurations:
- csf-strict
- flat/csf-strict
Since Storybook 5.2, the CSF format was introduced and the storiesOf
API has been deprecated.
Examples of incorrect code for this rule:
import { storiesOf } from '@storybook/react'
import Button from '../components/Button'
storiesOf('Button', module).add('primary', () => <Button primary />)
Examples of correct code for this rule:
import Button from '../components/Button';
export default = {
component: Button
}
export const Primary = () => <Button primary />
import Button from '../components/Button';
export default = {
component: Button
}
export const Primary = {
args: {
primary: true
}
}
For more information about the change from storiesOf
to CSF
, read here: https://github.com/storybookjs/storybook/blob/master/lib/core/docs/storiesOf.md
To automatically migrate all of your codebase, run this codemod in the root folder of your project:
npx storybook@latest migrate storiesof-to-csf --glob="*/**/*.stories.@(tsx|jsx|ts|js)"