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

getting errors on files with decorators #232

Closed
farhansalam opened this issue Dec 12, 2017 · 2 comments
Closed

getting errors on files with decorators #232

farhansalam opened this issue Dec 12, 2017 · 2 comments

Comments

@farhansalam
Copy link

We are using @Radium decorators in our jsx file and running react-codemods which is giving

 ERR [ *path* ] Transformation error
SyntaxError: Unexpected token (16:0)
    at Parser.pp$5.raise (/Users/farhan/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/Users/farhan/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$1.parseDecorator (/Users/farhan/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:1939:10)
    at Parser.pp$1.parseDecorators (/Users/farhan/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:1924:26)
    at Parser.pp$1.parseStatement (/Users/farhan/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:1818:10)
    at Parser.pp$1.parseBlockBody (/Users/farhan/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:2268:21)
    at Parser.parseBlockBody (/Users/farhan/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:4820:18)
    at Parser.pp$1.parseTopLevel (/Users/farhan/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:1778:8)
    at Parser.parse (/Users/farhan/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:1673:17)
    at Object.parse (/Users/farhan/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:7305:37)

How to use babel plugins like transform-decorators-legacy with jscodeshift.

@DrewML
Copy link
Contributor

DrewML commented Dec 12, 2017

You'll need to specify babylon as the parser (documentation in the readme).

jscodeshift already enables the decorators parser flag in Babylon, which is the plugin that decorators-legacy uses

@farhansalam
Copy link
Author

@DrewML Works perfectly with babylon i was trying with babel.

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

2 participants