storybookjs / eslint-plugin-storybook

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

The `no-redundant-story-name` rule doesn't account for automatic whitespace when names have numbers #62

Closed tombakerjr closed 2 years ago

tombakerjr commented 2 years ago

Describe the bug The no-redundant-story-name rule doesn't account for the whitespace that is automatically added by Storybook when it formats the story name for display, e.g. a story with the name H1 will be formatted for display as H 1, and adding H1.storyName = 'H1'; triggers this rule.

To Reproduce Steps to reproduce the behavior:

  1. Create a story with the name H1
  2. Add H1.storyName = 'H1';
  3. See that the rule is triggered
  4. "Fix" the error so the rule is no longer triggered
  5. Observe the displayed name is H 1 in the rendered Storybook

Expected behavior I expect this rule to be aware of Storybook's formatting behavior, specifically when story names include a number.

Screenshots I don't think any are needed, but happy to add some if my explanation is unclear.

Additional context To me, this is an extremely low priority thing since I can easily ignore the rule on a couple lines in my Typography docs, but I wanted to mention it just in case.

yannbf commented 2 years ago

Hey @tombakerjr thanks a lot for flagging this! This should now be fixed in v0.5.5.

Thanks for using this library! <3

tombakerjr commented 2 years ago

Thank you!!!