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

CSF3: Handle auto-title redundant filename #17421

Merged
merged 2 commits into from
Feb 4, 2022

Conversation

shilman
Copy link
Member

@shilman shilman commented Feb 4, 2022

Issue: #15534

What I did

Technically breaking change in experimental auto-title:

Input: atoms/button/button.stories.js

  • Before: Atoms/Button/Button
  • After: Atoms/Button

Input: atoms/button/index.stories.js

  • Before: Atoms/Button/Index
  • After: Atoms/Button

See attached migration notes for full explanation

How to test

See attached test

@nx-cloud
Copy link

nx-cloud bot commented Feb 4, 2022

☁️ Nx Cloud Report

CI ran the following commands for commit 39b3e6e. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

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.

Awesome stuff! A couple comments

MIGRATION.md Outdated Show resolved Hide resolved
MIGRATION.md Outdated Show resolved Hide resolved
)
).toMatchInlineSnapshot(`To/Button`);
});

Copy link
Member

Choose a reason for hiding this comment

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

What's the outcome of a test with this?

auto(
  './path/to/button/index.stories.js',
  normalizeStoriesEntry({ directory: './path' }, options)
)

Copy link
Member Author

Choose a reason for hiding this comment

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

To/Button/Index -- do you think we should remove Index?

Copy link
Member

Choose a reason for hiding this comment

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

I'd say so, normally index is ommited when importing e.g.

import { Button } from './components/Button'

so personally I'd expect a similar behavior. @tmeasday @ndelangen WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, "Index" is meaningless to everyone, we should ignore it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Thanks gang! 🙏

Copy link
Member

Choose a reason for hiding this comment

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

Do we also cope with just stories.js? I feel like that filename would make sense for a folder.

Copy link
Member

@yannbf yannbf Feb 6, 2022

Choose a reason for hiding this comment

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

There was an issue in the eslint-plugin-storybook repo about supporting stories.js files. We never suggest that though, and I believe our internal defaults are all about *.stories.*. Do you think we should support stories.* ? I've never seen people having something like test.js in their folders, just index.test.js or Component.test.js

Copy link
Member

Choose a reason for hiding this comment

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

I've seen it before, but I'm OK with saying it's not something we recommend.

@shilman shilman changed the title CSF3: Fix auto-title duplicate filename CSF3: Fix auto-title redundant filename Feb 4, 2022
@shilman shilman merged commit d1cee82 into next Feb 4, 2022
@shilman shilman deleted the 15534-fix-auto-title-duplicates branch February 4, 2022 11:59
@shilman shilman changed the title CSF3: Fix auto-title redundant filename CSF3: Handle auto-title redundant filename Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants