Skip to content

Latest commit

 

History

History
56 lines (37 loc) · 1.29 KB

no-stories-of.md

File metadata and controls

56 lines (37 loc) · 1.29 KB

storiesOf is deprecated and should not be used (no-stories-of)

Included in these configurations:

  • csf-strict
  • flat/csf-strict

Rule Details

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
  }
}

Further Reading

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)"