-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[codemod] Not able to use other parser #29059
Comments
Can you provide one of the sample file with flow type? |
Sure if I have a type like this:
it would break on the
Thank you so much! |
Putting in a PR for this |
There was an issue with how the codemod was being run. 'tsx' was hardcoded in the const args = [ array in packages/mui-codemod/codemod.js You can temporarily fix the problem by changing
to
I put in a PR to fix this. #29229 If someone could see why circleci is breaking on it that would be great. Maybe something has to be overridden for markdown docs. -- |
I can help with that 👍 |
Thank you! |
@jennykortina, as a real-world user who uses flowtype with mui and who probably had way too much of their time devoured by this bug, would you please weigh in on #29229 and give us your perspective on what you expect from the mui codehelper and how the interface to it should be handled. |
@ElonVolo cool cool thank you for the help! I imagine a lot of flow and material users are having this same issue as a maybe flow type is very common (it's just saying the type maybe null). For the temporary fix are you saying to run it like this?
B/c i've tried that and it does not work. Or do I need to pass the parser flag differently? Thank you! |
@jennykortina, there were two basic problems you ran into:
For your temp workaround to work you literally have to go into the code of codemod.js with your editor of choice and manually change "tsx" to "flow". Maybe other's can shed a light on whether there's some existing override that would work (maybe pass something in the jscodeshift parameter). In any case, if there is a workaround that would work for flow, it should probably be explicit documented. But it seems like there's no super duper, easy, jumps-out-and-grabs-you way for someone to migrate a flowtype based project. e.g.
|
@ElonVolo ok thank you I will give that a try and report back so other's know if this works. thanks! |
This is fixed in https://github.com/mui-org/material-ui/releases/tag/v5.1.0 |
I am following the https://mui.com/guides/migration-v4/ guide. When I run
npx @mui/codemod v5.0.0/preset-safe ./ --no-babel --parser=flow
I get the following error:Current Behavior 😯
When I do a stack trace to the line it's failing on it's a "maybe" flow type eg
days: ?number
and if I fix that type to not be a maybe, it will crash on the next "maybe" flow type.Expected Behavior 🤔
I would expect it to run on maybe flow types without error
Steps to Reproduce 🕹
Steps:
on a component with a maybe flow type eg
days: ?number`Context 🔦
I am trying to upgrade material UI from 4 -> 5
The text was updated successfully, but these errors were encountered: