eslint-plugin-storybook icon indicating copy to clipboard operation
eslint-plugin-storybook copied to clipboard

`no-redundant-story-name` case insensitivity

Open benedfit opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. Warn/error when storyName is a case-insensitive variant of the name generated by the export name:

e.g. WithText.storyName = 'With Text'; will currently warn/error but WithText.storyName = 'with text'; will not

Describe the solution you'd like The ability to configure the no-redundant-story-name rule to use/ignore case when determining in the name is redundant

Describe alternatives you've considered Would also be open to this being the default behaviour if that's easier.

Additional context I am working on a codebase where we used the storybook provided codemon to migrate our old storiesOf stories to CSF. Due to most of our old story names being all in lower-case, we now have a lot of instances where PascalCase.storyName = 'lower case'. Engineers are then copying this format and spreading the issue. So while I can fix the existing set, I'd like a way to catch any future instances

benedfit avatar Jun 13 '22 15:06 benedfit

Hey @benedfit thanks for opening this issue! I am not sure how valid this request is, given that there is a difference between the scenarios which you described:

  1. WithText.storyName = 'With Text';
  2. WithText.storyName = 'with text';

They will yield different results in the sidebar. People might actually want to specify names to be lower case, whilst the story name is upper case.

yannbf avatar Jan 25 '23 08:01 yannbf

@yannbf I agree that there would be scenarios where folks want to specify lower case, so that's why it would be great for it to be an optional settings, and for it to work as it currently does by default

benedfit avatar Jan 25 '23 09:01 benedfit