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

Throw descriptive error when 'of' prop is detected #21

Merged
merged 2 commits into from
Mar 16, 2023
Merged

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Mar 15, 2023

Works on storybookjs/storybook#20496

Mirror PR for MDX2: storybookjs/mdx2-csf#37

What Changed

This PR throws a descriptive error when the of prop on Meta or Story is found, as that is not supported in .stories.mdx files

How to test

Add a file to a sandbox like this:

import { Story, Meta } from '@storybook/blocks';
import * as ButtonStories from './Button.stories';
import { Button } from './Button';

<Meta title="storiesMdx" component={Button}/>

<Story of={ButtonStories.Primary} />

or

import { Story, Meta } from '@storybook/blocks';
import * as ButtonStories from './Button.stories';
import { Button } from './Button';

<Meta title="storiesMdx" of={ButtonStories} />

<Story story={ButtonStories.Primary} />

Change Type

  • maintenance
  • documentation
  • patch
  • minor
  • major
📦 Published PR as canary version: 0.0.5--canary.21.beb53e0.0

✨ Test out this PR locally via:

npm install @storybook/mdx1-csf@0.0.5--canary.21.beb53e0.0
# or 
yarn add @storybook/mdx1-csf@0.0.5--canary.21.beb53e0.0

Version

Published prerelease version: v1.0.0-next.2

Changelog

💥 Breaking Change

🐛 Bug Fix

Authors: 3

@JReinhold JReinhold requested a review from shilman March 15, 2023 09:34
@JReinhold JReinhold self-assigned this Mar 15, 2023
@JReinhold JReinhold added the patch Increment the patch version when merged label Mar 15, 2023
@JReinhold JReinhold changed the title descriptive error when using of prop Throw descriptive error when of prop is detected Mar 15, 2023
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Can you please add a unit test for this?

@JReinhold JReinhold requested a review from shilman March 16, 2023 12:20
@shilman shilman changed the title Throw descriptive error when of prop is detected Throw descriptive error when 'of' prop is detected Mar 16, 2023
@shilman shilman merged commit 407c7f2 into next Mar 16, 2023
@github-actions github-actions bot mentioned this pull request Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants