-
Notifications
You must be signed in to change notification settings - Fork 55
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
Disable rule of hooks in stories files #149
Disable rule of hooks in stories files #149
Conversation
LGTM, I am curious what @yannbf thinks about this! |
Can one plugin turn off a rule from another plugin? And are we sure hooks always keep working? Or only if they use storybook hooks? |
@kasperpeulen I think this answers your question: This very plugin is already doing that.
This does not impact runtime of hooks. |
@@ -9,6 +9,7 @@ export = { | |||
{ | |||
files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '*.story.@(ts|tsx|js|jsx|mjs|cjs)'], | |||
rules: { | |||
'react-hooks/rules-of-hooks': 'off', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure to add this to the other config files, else it's all good!
🚀 PR was released in |
To resolve this issue, please use the official storybook eslint plugin. the latest version should resolve this issue, see: https://github.com/storybookjs/eslint-plugin-storybook/releases/tag/v0.7.0 |
Closes: storybookjs/storybook#21115
What Changed
I chatted with @valentinpalkovic and we concluded that instead of writing an automigration adding code that in neither case looks "quite right", we considered maybe adding an exception to the config exposed by the plugin, which turns off the problems reported from
react-hooks
eslint plugin.Checklist
Check the ones applicable to your change:
yarn update-all
Change Type
Indicate the type of change your pull request is:
maintenance
documentation
patch
minor
major
📦 Published PR as canary version:
0.7.0--canary.149.b9dd4e1.0
✨ Test out this PR locally via:
npm install eslint-plugin-storybook@0.7.0--canary.149.b9dd4e1.0 # or yarn add eslint-plugin-storybook@0.7.0--canary.149.b9dd4e1.0