Open patreeceeo opened 5 years ago
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.
Why is the flow plugin included? Can it be not included by default unless, say, the user passes a --with-flow
flag or something?
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.
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!
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.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!