storybookjs / mdx1-csf

MDX to CSF compiler using MDXv1
MIT License
4 stars 12 forks source link

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

Closed JReinhold closed 1 year ago

JReinhold commented 1 year ago

Works on https://github.com/storybookjs/storybook/issues/20496

Mirror PR for MDX2: https://github.com/storybookjs/mdx2-csf/pull/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

📦 Published PR as canary version: 0.0.5--canary.21.beb53e0.0
:sparkles: Test out this PR locally via: ```bash 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 - Update to 7.0 / mdx2-csf structure [#19](https://github.com/storybookjs/mdx1-csf/pull/19) ([@shilman](https://github.com/shilman)) #### 🐛 Bug Fix - Throw descriptive error when 'of' prop is detected [#21](https://github.com/storybookjs/mdx1-csf/pull/21) ([@JReinhold](https://github.com/JReinhold)) - Move mdx import out of loader into compile [#20](https://github.com/storybookjs/mdx1-csf/pull/20) ([@shilman](https://github.com/shilman)) - ReDoS attack patch [#17](https://github.com/storybookjs/mdx1-csf/pull/17) ([@iarmbears](https://github.com/iarmbears)) #### Authors: 3 - [@iarmbears](https://github.com/iarmbears) - Jeppe Reinhold ([@JReinhold](https://github.com/JReinhold)) - Michael Shilman ([@shilman](https://github.com/shilman))