-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
CSF and import/no-anonymous-default-export #12914
Comments
Thanks @robcaldecott! This is super annoying for CSF users since we REQUIRE an anonymous default export for the component's metadata 🙈 |
Hi @robcaldecott import { Meta } from "@storybook/react";
export default {
title: "My stories"
} as Meta; That makes the warning go away for me. It wouldn't be a good idea to turn off a good ESLint rule if we can just adapt our code to it. |
I think an eslint rule just for stories is preferable than the Meta workaround but YMMV. 😉 |
Another workaround here: facebook/create-react-app#9914 (comment)
|
Ta-da!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.0-alpha.7 containing PR #13452 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
the second workaround removes the |
This is still an issue for me.
|
Anyone who upgrades to
react-scripts
4.0.0 may notice that a newimport/no-anonymous-default-export
eslint
rule is now enabled by default. This will cause warning in your CSF story files for yourdefault export
, e.g.:This soon gets annoying so if you want to disable this warning for your stories edit the
eslintConfig
section in yourpackage.json
to look something like this:This will leave the new warning in place for your components but exclude your stories.
For more info on this warning from Dan Abramov: https://twitter.com/dan_abramov/status/1255229440860262400
The text was updated successfully, but these errors were encountered: