question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

This experimental syntax requires enabling one of the following parser plugin(s) with Babel

See original GitHub issue

I’m working on a ember app where I use decorators. I want to use es5-getter-ember-codemod so I did :

jscodeshift -t https://rawgit.com/rondale-sc/es5-getter-ember-codemod/master/es5-getter-em
ber-codemod.js --babel --parser babel ./app/ 
ERR app/models/user.js Transformation error
SyntaxError: This experimental syntax requires enabling one of the following parser plugin(s): 'decorators, decorators2' (5:2)
    at _class.raise (/home/dougui/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:779:15)
    at _class.expectOnePlugin (/home/dougui/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:2101:18)
    at _class.parseDecorator (/home/dougui/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:4126:10)
    at _class.parseObj (/home/dougui/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:3475:34)
    at _class.parseExprAtom (/home/dougui/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:3124:21)
    at _class.parseExprAtom (/home/dougui/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:5480:54)
    at _class.parseExprAtom (/home/dougui/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:8119:52)
    at _class.parseExprSubscripts (/home/dougui/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:2758:21)
    at _class.parseMaybeUnary (/home/dougui/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:2737:21)
    at _class.parseExprOps (/home/dougui/.config/yarn/global/node_modules/jscodeshift/node_modules/babylon/lib/index.js:2646:21)
All done. 
Results: 
10 errors
10 unmodified
0 skipped
0 ok

With --parse babylon I have no errors but nothing is modified.

I tried to add a .babelrc file with :

{
  "plugins": ["transform-decorators-legacy"],
}

But it doesn’t worked.

It works when I use babel ./app.

This can be related to #252

Do you have a clue?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:26
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
jbadancommented, Jun 27, 2018

I ended up doing the same as @loopmode above, but got it working by tweaking some different settings in that block.

I eventually just switched to using --parser flow to avoid the problem entirely.

3reactions
loopmodecommented, Jun 28, 2018

Uh, I didn’t even try --parser flow - if it works, that’s awesome. Will check.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint: Parsing error: This experimental syntax requires ...
ESLint: Parsing error: This experimental syntax requires enabling one of the following parser plugin(s): 'jsx, flow, typescript' (2:9). Here is ...
Read more >
[Bug]: ESLint: Parsing error: This experimental syntax requires ...
[Bug]: ESLint: Parsing error: This experimental syntax requires enabling one of the following parser plugin(s): "jsx", "flow", "typescript". #14546.
Read more >
[Error Debugging] This experimental syntax requires enabling ...
This experimental syntax requires enabling one of the following parser plugin (s): 'jsx, flow, typescript'.
Read more >
parsing error: this experimental syntax requires enabling one ...
"Parsing error: This experimental syntax requires enabling one of the following parser plugin(s): "flow", "typescript"." This is the code from that component. < ......
Read more >
eslint/eslint - Gitter
Parsing error: This experimental syntax requires enabling the parser plugin: 'throwExpressions'. What plugin should I use?? I currently have below plugins ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found