Codemods skipping with no reason given #64610
Replies: 13 comments
|
openmultiplayer/web@a411e14#diff-ba4e88e9a806fe3d7a3d8dc7cc336cefcf0bbec0ca54ba284362b56943e9cbcb Looking at the code before you made the changes it seems that you tried to run the codemod over functions that could not be detected as being React components as they did not return JSX, potentially this can be made clearer while running the codemod. |
|
I have the same problem: when I run |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@webdif could you show us how your component.js looks like? |
|
@ShooTeX I have very simple components, like this: // component.js
export default ({ prop1, prop2 }) => {
/* ... */
}; |
|
Still struggling with this...any workarounds anyone's discovered? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
I would like to fix this but I am not finding good "Getting Started" notes in https://github.com/vercel/next.js/tree/canary/packages/next-codemod, if someone who has contributed could write some notes on how they test a local problem codebase against a local build of next-codemod that would be super helpful. |
|
Okay, @timneutkens I'm 95% sure the problem here isn't an issue with the codemod but an issue with the babel plugin that is telling us to run the codemod. That babel plugin is throwing out myriad warnings for functions that dont return JSX and dont qualify for the codemod. A fix is in progress here: https://github.com/vercel/next.js/pull/32636/files but I'm struggling with how to test it. |
|
@Southclaws can you provide an example of a file that returns JSX and should be named but isnt? That would be super helpful. |
|
Can confirm this is skipping all my project files even if i have a lot of runtime warnings telling me to use named exports. Is this supposed to work only for files that return JSX? It gives me warnings for non JSX things. Eg |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Describe the bug
Trying to run the name-default-component codemod but it's just skipping all my files.
To Reproduce
Clone
https://github.com/openmultiplayer/webcd into
frontend/src/components/templatesrun
codemod name-default-componentExpected behavior
The components to be transformed into export default function X() ...
Screenshots
All reactions