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

Support for new context syntax in rules/context-in-play-function not working as expected #162

Open
Hiroshiba opened this issue Aug 3, 2024 · 1 comment

Comments

@Hiroshiba
Copy link

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:

  1. Upgrade to Storybook v8.2.0.
  2. Implement the new context passing syntax in a story's play function as shown below:
    play: async ({ context, canvasElement, parameters }) => {
      await Default.play?.(context);
    }
  3. 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.

@Jazzmanpw
Copy link

the same issue. any progress here?

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

No branches or pull requests

2 participants