Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule to check exports against includeStories #85

Open
aaronadamsCA opened this issue Feb 25, 2022 · 0 comments
Open

Add rule to check exports against includeStories #85

aaronadamsCA opened this issue Feb 25, 2022 · 0 comments

Comments

@aaronadamsCA
Copy link

Is your feature request related to a problem? Please describe.
Some of our CSF3 stories export option arrays. These get imported by other stories, for example to loop through options in a composite story:

export const ALIGN: Array<TypographyProps["align"]> = [
  "left",
  "center",
  "right",
  "justify",
];

To ensure this doesn't gum up the Storybook UI, we define includeStories: /[a-z]/ in our default exports, so that our all-caps exports are excluded.

Describe the solution you'd like
A new rule should check that all named exports matching includeStories are in fact stories. This way, if we forget to define includeStories, the rule will notice that we're exporting named non-stories and flag them.

Describe alternatives you've considered
We could move the exports to other files, but this is exactly the reason includeStories exists. We'd prefer not to move Storybook-only utility constants into non-Storybook files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants