eslint-plugin-storybook
eslint-plugin-storybook copied to clipboard
Support for new context syntax in `rules/context-in-play-function` not working as expected
Describe the bug
The rules/context-in-play-function rule does not support the new context argument syntax introduced in Storybook v8.2.0, which allows self-referencing context within play functions. When trying to pass a context when invoking the play function of another story, an error is thrown.
To Reproduce Steps to reproduce the behavior:
- Upgrade to Storybook v8.2.0.
- Implement the new context passing syntax in a story's
playfunction as shown below:play: async ({ context, canvasElement, parameters }) => { await Default.play?.(context); } - Observe the error:
Pass a context when invoking play function of another story.
Expected behavior Expected no errors when passing the context as an argument in the play function of another story. The implementation should recognize and validate the new syntax as per the changes introduced in Storybook v8.2.0.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Reference to the pull request that introduced the change in Storybook v8.2.0: PR #28353
The previous syntax was:
play: async ({ canvasElement }) => {
await FirstStory.play({ canvasElement });
}
It has been updated to:
play: async ({ context, canvasElement }) => {
await FirstStory.play(context);
}
This update seems not to be fully supported by eslint-plugin-storybook, specifically the rule rules/context-in-play-function.
the same issue. any progress here?
Hey @Jazzmanpw @Hiroshiba thanks for reporting. PRs are welcome!