storybookjs / eslint-plugin-storybook

🎗Official ESLint plugin for Storybook
MIT License
248 stars 56 forks source link

extend story-exports rule to support export lists, fixes #57 #58

Closed stephenhmarsh closed 2 years ago

stephenhmarsh commented 2 years ago

Issue: #57

What Changed

Fixed a bug where the story-exports rule gave a false negative because it did not check for exports from an export list, only from inline export declarations.

Checklist

Check the ones applicable to your change:

Change Type

Indicate the type of change your pull request is:

yannbf commented 2 years ago

Hey @stephenhmarsh thanks a lot for your contribution! I moved the logic into a utility function so that it can be reused by other rules. I also changed the check from local to exported, although I'm not sure which would matter the most 🤔 @shilman thoughts?

const primary = {} <-- local name

export { primary } <-- exported name
stephenhmarsh commented 2 years ago

Welcome! Yeah I just went with local initially because I wasn't sure either. Like, if someone does export { story1 as name1 }, how does that change things like checks against excludeStories, etc.?

yannbf commented 2 years ago

Welcome! Yeah I just went with local initially because I wasn't sure either. Like, if someone does export { story1 as name1 }, how does that change things like checks against excludeStories, etc.?

the checks will be done with what's being exported from the package, therefore I believe we should go with the exported check!

yannbf commented 2 years ago

Thanks a lot for your contribution @stephenhmarsh !! Superb stuff 👌

github-actions[bot] commented 2 years ago

:rocket: PR was released in v0.5.3 :rocket:

stephenhmarsh commented 2 years ago

Awesome thanks @yannbf 👍