Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.28 KB

story-exports.md

File metadata and controls

41 lines (28 loc) · 1.28 KB

story-exports

Included in these configurations:

  • recommended
  • flat/recommended
  • csf
  • flat/csf

Rule Details

In CSF, a story file should contain a default export that describes the component, and at named exports that describe the stories. This rule enforces the definition of at least one named export in story files.

Examples of incorrect code for this rule:

export default {
  title: 'Button',
  args: { primary: true },
  component: Button,
}
// no named export

Examples of correct code for this rule:

export default {
  title: 'Button',
  args: { primary: true },
  component: Button,
}
export const Primary = {} // at least one named export!

When Not To Use It

This rule should only be applied in your .stories.* files. Please ensure you are defining the storybook rules only for story files. You can see more details here.

Further Reading

More information about defining stories here: https://storybook.js.org/docs/react/writing-stories/introduction#defining-stories