Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Does this work with React files?Β #1

@tilomitra

Description

@tilomitra

Thanks a lot for creating this! I was testing out the codemod on my NodeJS files and it works great. However, it errors out when I try it on React components that have JSX. I get this error:

 ERR ./components/storefront/CalendarTimeButton.js Transformation error (Unexpected token, expected "," (26:23))
SyntaxError: Unexpected token, expected "," (26:23)
    at Object._raise (/Users/tilo/.npm/_npx/26609/lib/node_modules/moment-dayjs-codemod/node_modules/@babel/parser/src/parser/error.js:134:45)
    at Object.raiseWithData (/Users/tilo/.npm/_npx/26609/lib/node_modules/moment-dayjs-codemod/node_modules/@babel/parser/src/parser/error.js:129:17)
    at Object.raise (/Users/tilo/.npm/_npx/26609/lib/node_modules/moment-dayjs-codemod/node_modules/@babel/parser/src/parser/error.js:78:17)
    at Object.unexpected (/Users/tilo/.npm/_npx/26609/lib/node_modules/moment-dayjs-codemod/node_modules/@babel/parser/src/parser/util.js:179:16)
    at Object.expect (/Users/tilo/.npm/_npx/26609/lib/node_modules/moment-dayjs-codemod/node_modules/@babel/parser/src/parser/util.js:144:28)
    at Object.tsParseDelimitedListWorker (/Users/tilo/.npm/_npx/26609/lib/node_modules/moment-dayjs-codemod/node_modules/@babel/parser/src/plugins/typescript/index.js:385:16)
    at Object.tsParseDelimitedList (/Users/tilo/.npm/_npx/26609/lib/node_modules/moment-dayjs-codemod/node_modules/@babel/parser/src/plugins/typescript/index.js:345:14)
    at Object.tsParseBracketedList (/Users/tilo/.npm/_npx/26609/lib/node_modules/moment-dayjs-codemod/node_modules/@babel/parser/src/plugins/typescript/index.js:407:27)
    at Object.tsParseTypeParameters (/Users/tilo/.npm/_npx/26609/lib/node_modules/moment-dayjs-codemod/node_modules/@babel/parser/src/plugins/typescript/index.js:508:26)
    at /Users/tilo/.npm/_npx/26609/lib/node_modules/moment-dayjs-codemod/node_modules/@babel/parser/src/plugins/typescript/index.js:2748:31

My component compiles fine, so I'm not sure where this syntax error is coming from. The stack trace seems to suggest its within the jscodeshift parser. Was wondering if you had experience with this and could point me in a direction. Thanks! πŸ™

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions