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

reactDocgen "none"/false behaves the same as passing "react-docgen" #12491

Closed
AndrewLeedham opened this issue Sep 15, 2020 · 2 comments
Closed

Comments

@AndrewLeedham
Copy link
Contributor

Describe the bug
The docs state that the typescript.reactDocgen main.js config option can have 1 of three values: react-docgen-typescript, react-docgen or none. However, the docs here include "also valid 'react-docgen-typescript' | false" on line 126, saying that false should be used not "none", the core types seem to back this up. Furthermore, "none" or false seem to have the same effect which is to behave exactly like "react-docgen" was passed.

To Reproduce
Steps to reproduce the behavior:

  1. Setup a fresh react + typescript project.
  2. Add the docgen rule to your main.js typescript: {reactDocgen: "none"}
  3. Log the webpack config in your main.js webpackFinal: (config) => { console.log(JSON.stringify(config, null, 2)); return config; }
  4. Launch storybook.
  5. You should see that the babel-plugin-react-docgen plugin was included in the outputted config.

Expected behavior
I would expect the typescript.reactDocgen option to perform as follows:

  • "react-docgen": to include babel-plugin-react-docgen
  • "react-docgen-typescript": to include the ReactDocgenTypescriptPlugin
  • "none" or false: to include neither

Perhaps 1 of "none" or false should be decided on.

Code snippets
https://github.com/storybookjs/storybook/blob/master/app/react/src/server/framework-preset-react-docgen.ts#L13 seems to be the crux of the problem. Looks like it needs a 3rd case for "none" or false.

System:

System:
    OS: macOS 10.15.6
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
  Binaries:
    Node: 14.4.0 - ~/.nvm/versions/node/v14.4.0/bin/node
    Yarn: 1.22.4 - ~/.yarn/bin/yarn
    npm: 6.14.5 - ~/.nvm/versions/node/v14.4.0/bin/npm
  Browsers:
    Chrome: 85.0.4183.102
    Firefox: 74.0
    Safari: 13.1.2
  npmPackages:
    @storybook/addon-essentials: ^6.0.21 => 6.0.21 
    @storybook/addon-links: ^6.0.21 => 6.0.21 
    @storybook/node-logger: ^6.0.21 => 6.0.21 
    @storybook/react: ^6.0.21 => 6.0.21

Additional context
I am wanting to disable react-docgen, as I am pre-compiling from TSX to JSX before storybook gets involved and am including docgen info there myself.

@shilman
Copy link
Member

shilman commented Sep 16, 2020

Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.0-alpha.10 containing PR #12492 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Sep 16, 2020
@shilman
Copy link
Member

shilman commented Sep 26, 2020

Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.22 containing PR #12492 that references this issue. Upgrade today to try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants