Closed beaussan closed 1 year ago
Thanks for opening this issue @beaussan! That makes total sense. Are you willing to make a PR for this? This is the place where you'd need to touch: https://github.com/storybookjs/eslint-plugin-storybook/blob/main/lib/rules/context-in-play-function.ts#L70
I'll try yes ! I saw the file when I opened the issue and I should have some time today to at least give it a try.
I have a bit of ast / eslint knoledge, but the thing I don't know how to achieve is how to get the the name of the argument of the current function.
My first idea is to try to go up the ast tree to get the function itself, but that maybe flaky
I always recommend trying https://astexplorer.net/ out, it helps you immensely when figuring out AST structures! And from there you can start playing around 🎡
@beaussan LMK if you need any help from a french fellow
Thanks to the both of you !
I finally got some time to work on this, and made a PR :tada:
Describe the bug Context in play function only support only "context" as a variable names. Any other variable names gives a lint error.
To Reproduce Given this code :
the lint should not fail since we are passing the context, but with a different variable name
Expected behavior There should not have any lint errors since it respects the lint rule.