Closed ignas-sedunovas closed 2 years ago
Thanks @ignas-sedunovas! Here's my quick $.02:
The linter shouldn't crash, so we should add that test case and make sure it's handled gracefully
Doing any kind of dynamic analysis is complicated, so I think we should just ignore include/exclude
stories that are not literals. If the user wants to disable the rule for a particular export they can do that on the line above the export, or they can just disable the rule altogether.
@yannbf WDYT?
Thanks @ignas-sedunovas! Here's my quick $.02:
The linter shouldn't crash, so we should add that test case and make sure it's handled gracefully
Doing any kind of dynamic analysis is complicated, so I think we should just ignore
include/exclude
stories that are not literals. If the user wants to disable the rule for a particular export they can do that on the line above the export, or they can just disable the rule altogether.@yannbf WDYT?
I agree. I will handle the case so the plugin doesn't crash. Thank you so much for opening this issue @ignas-sedunovas!
Hey @ignas-sedunovas this should now be fixed in v0.5.5.
Thanks for using this library! <3
Describe the bug
prefer-pascal-case
andstory-exports
throw error if function'sname
property is used inincludeStories
/excludeStories
arrays.To Reproduce Exclude or include a story using the
name
property of it. Example:Produces an error such as:
Expected behavior ESLint does not crash
Additional context It seems that the problem is at https://github.com/storybookjs/eslint-plugin-storybook/blob/main/lib/utils/index.ts#L48, because it doesn't expect such usage as in my example. AST of my example produces a
PropertyAccessExpression
. It's valid string, but only at runtime.I'm using such approach in order to automatically rename the story also in
includeStories
/excludeStories
arrays when refactoring.Would you consider expanding the linter rules to allow such approach?