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

story-exports: Support stories that are function declarations. #66

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

etlovett
Copy link
Contributor

Issue: I didn't bother filing one.

What Changed

While it's not the form the docs recommend, export function Primary() {} is functionally equivalent to export const Primary = () => {} and therefore fully supported by Storybook, so it should be fully supported by eslint-plugin-storybook as well. This PR is therefore very much in the same vein as #58.

I chose not to update the docs for the rule since the function declaration form is not the recommended approach for Storybook, but I'd be happy to include this newly-supported format in the docs if you'd prefer. Just let me know.

In the tests I also added a few missing dedent calls and one missing output block for the future when this rule has auto-fixing in place.

Checklist

Check the ones applicable to your change:

  • Ran yarn update-all
  • Tests are updated
  • Documentation is updated

Change Type

Indicate the type of change your pull request is:

  • maintenance
  • documentation
  • patch
  • minor
  • major

While it's not the form the docs recommend, `export function Primary() {}` is functionally equivalent to `export const Primary = () => {}` and therefore fully supported by Storybook, so it should be fully supported by eslint-plugin-storybook as well.
@yannbf yannbf added bug Something isn't working linear labels Dec 20, 2021
Copy link
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @etlovett ! Looks awesome <3

@yannbf yannbf added release Create a release when this pr is merged patch Increment the patch version when merged labels Dec 20, 2021
@yannbf yannbf merged commit 730db17 into storybookjs:main Dec 20, 2021
@github-actions
Copy link

🚀 PR was released in v0.5.4 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linear patch Increment the patch version when merged release Create a release when this pr is merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants