-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Bug?]: Bug in mock-auth plugin's RegEx breaks storybook-vite #11588
Comments
@Philzen Thanks for taking the time to report! ... and I see you have a PR in! 🙌 I know @arimendelow has been working on Storybook updates here #11581 I'll get him to review your stuff. |
Ha, this is interesting — @Philzen, just reviewed your other PR and left a comment on it. A short term fix here, of course, is to just ignore ESLint on this line, such that your imports aren't reordered. @ahaywood, do you think it's worth adding a note in #11581 to be careful when reordering any Redwood-generated imports? I feel like trying to include something about this in the docs would be confusing without the proper context. @Philzen, if you want to open a PR for fixing this, I'd be happy to review it! As you can see from your own excellent investigation, all that needs to happen here is removing |
@ahaywood pls note the other PR was completely unrelated to this issue.
@arimendelow i found https://github.com/redwoodjs/redwood/blob/main/packages/eslint-config/README.md very helpful for this (which is to from the docs) (my two cents would be that a json config with Everyone having ever tried to extend an already extensive ruleset such as So therefore IMHO the regex is simply making an assumption here that it shouldn't rely on. I'm no RegEx guru, but played around with it a bit and believe the change proposed in #11593 seems to do the trick, kindly take a gander. |
Left a comment on your PR! Looks mostly good to me :) Thanks for putting that together so quickly! These are all great points 😄 I'm no RegEx guru either, hence us winding up here in the first place — your proposal is certainly an improvement. |
What's not working?
Having recently upgraded our stack to RW 7.7.4 and also migrated storybook to Vite, i today found that it suddenly stopped rendering any stories whatsoever, throwing:
After some headscratching about the sudden breakage i realized we had a change to
auth.ts
import order – before it was:which worked fine, but now (b/c we added an eslint rule to sort them alphabetically to get nicer, deterministic import diffs) it is
and breaks when starting storybook-vite.
After some digging, i assume the culprit is this RegEx:
redwood/packages/storybook/src/plugins/mock-auth.ts
Line 14 in 62509c9
How do we reproduce the bug?
Apparently it happens when
createAuth
is followed by a comma, as in a list of named imports.What's your environment? (If it applies)
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: