Skip to content
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

No changes to files after running against files containing .extend #11

Open
patreeceeo opened this issue Jul 31, 2019 · 4 comments
Open

Comments

@patreeceeo
Copy link

Maybe I'm missing something very obvious, but when I use this codemod as described in the README against files using the .extend API, those files remain unchanged.

image

NPM version: 6.10.2
Node version: v8.12.0
OS: macOS 10.13.6

Would you need any other information?

Thanks for making this!

@patreeceeo
Copy link
Author

Seems that the root cause is that I'm using Typescript:

Encountered an error while processing ../resources-ui/src/app/components/Buttons/Button/index.tsx:
Error: Cannot combine flow and typescript plugins.
    at validatePlugins (/Users/patrick.canfield/Code/styled-components-codemods/node_modules/@babel/parser/lib/index.js:6080:11)
    at getParser (/Users/patrick.canfield/Code/styled-components-codemods/node_modules/@babel/parser/lib/index.js:11323:5)
    at parse (/Users/patrick.canfield/Code/styled-components-codemods/node_modules/@babel/parser/lib/index.js:11306:12)
    at Object.parse (/Users/patrick.canfield/Code/styled-components-codemods/node_modules/babel-codemod/src/RecastPlugin.ts:14:16)
    at Object.parse (/Users/patrick.canfield/Code/styled-components-codemods/node_modules/recast/lib/parser.js:28:30)
    at parse (/Users/patrick.canfield/Code/styled-components-codemods/node_modules/babel-codemod/src/RecastPlugin.ts:11:17)
    at parser (/Users/patrick.canfield/Code/styled-components-codemods/node_modules/@babel/core/lib/transformation/normalize-file.js:163:23)
    at normalizeFile (/Users/patrick.canfield/Code/styled-components-codemods/node_modules/@babel/core/lib/transformation/normalize-file.js:138:11)
    at runSync (/Users/patrick.canfield/Code/styled-components-codemods/node_modules/@babel/core/lib/transformation/index.js:44:43)
    at runAsync (/Users/patrick.canfield/Code/styled-components-codemods/node_modules/@babel/core/lib/transformation/index.js:35:14)
1 file(s), 0 modified, 1 errors

If I just remove L9 from src/v4/common.js, which adds the flow plugin, it works as expected.

@patreeceeo
Copy link
Author

Why is the flow plugin included? Can it be not included by default unless, say, the user passes a --with-flow flag or something?

@BretCameron
Copy link

I can second that the codemod doesn't work with TypeScript, but removing flow fixes this. It would be good to make this plugin optional.

@danieldunderfelt
Copy link
Member

danieldunderfelt commented Mar 13, 2022

I'm trying to run this against a plain JS codebase with npx, no changes for .extend. If I install the codemods in the project and run with yarn, it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants