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

importing story meta from another module and re-exporting it is not working #158

Open
pkyeck opened this issue Jun 12, 2024 · 1 comment

Comments

@pkyeck
Copy link

pkyeck commented Jun 12, 2024

Describe the bug
I split up my stories for a certain component b/c the file was just getting bigger and bigger but I wanted to have a central file with the meta information like so:

// ComponentA.meta.ts

export const meta: Meta<Props> = {
  title: 'Templates/Common/ComponentA',
  render: (args) => ComponentA(args),
  tags: ['tag1'],
  // ...
}

// ComponentAExtra1.stories.ts

export { meta as default } from './ComponentA.meta'
export const ComponentAExtra1Story: StoryObj<Props> = {
  // ...
}

// ComponentAExtra2.stories.ts

export { meta as default } from './ComponentA.meta'
export const ComponentAExtra2Story: StoryObj<Props> = {
  // ...
}

but the plugin is complaining that

The file should have a default export. eslint(storybook/default-exports)

Should this be working? I also tried to import first and then export default meta then the plugin is not complaining but storybook will tell me: CSF: missing default export

Is it possible to share the meta object and how?

@yannbf
Copy link
Member

yannbf commented Jul 11, 2024

Hey @pkyeck throughout the years I've never seen users do what you just did! 🤔
I would honestly not recommend doing what you're doing because the Storybook team doesn't really test this internally, so it's possible that some tools in the ecosystem might miss it. But if you feel strongly about it, you could make a PR to the eslint plugin to support this use case, and I can help you get it merged.

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

No branches or pull requests

2 participants