ember-codemods / ember-module-migrator

Automated migration for new Ember application layout.
74 stars 15 forks source link

fails for an app that uses decorators #86

Open jbailey4 opened 6 years ago

jbailey4 commented 6 years ago

For each module that contains a decorator (e.g. @computed) I get the following error:

error parsing file `[path/to/file]` failed to apply codeshift. Possible invalid JS file. Returning original file unchanged. error: This experimental syntax requires enabling one of the following parser plugin(s): 'decorators, decorators2' (48:2)

I traced the problem down to this issue -> https://github.com/facebook/jscodeshift/issues/232

Seems like the parser passed to jscodeshift should be set to "babylon", which includes the decorators flag.

hakilebara commented 6 years ago

I had the same issue. Have you tried editing the plugins used by the babel parser of jscodeshift?

// in /usr/local/lib/node_modules/jscodeshift/parser/babel5Compat.js

plugins: [
    // a list of plugins,
    'decorators-legacy',
]

also try using the latest version of ember-module-migrator npm -g install https://github.com/rwjblue/ember-module-migrator.git#master