ember-codemods / ember-native-class-codemod

A codemod-cli project for converting Ember objects to es6 native classes
68 stars 38 forks source link

Transformation error (Received an unexpected value [object Object]) #540

Open bmaehr opened 11 months ago

bmaehr commented 11 months ago

I have tried the codemode with multiple different ember verisions and projects and never got it to work. I get for each file the error message:

 ERR app/components/change/change-edit.js Transformation error (Received an unexpected value [object Object])
TypeError: Received an unexpected value [object Object]
    at fromAST (C:\Users\bmaehr\AppData\Local\Yarn\Data\global\node_modules\jscodeshift\src\/core.js:73:9)
    at core (C:\Users\bmaehr\AppData\Local\Yarn\Data\global\node_modules\jscodeshift\src\/core.js:47:5)
    at getDecoratorPathSpecifiers (C:\Users\bmaehr\AppData\Local\Yarn\Data\global\node_modules\ember-native-class-codemod\transforms\helpers\/import-helper.js:166:42)
    at createDecoratorImportDeclarations (C:\Users\bmaehr\AppData\Local\Yarn\Data\global\node_modules\ember-native-class-codemod\transforms\helpers\/import-helper.js:188:39)
    at maybeTransformEmberObjects (C:\Users\bmaehr\AppData\Local\Yarn\Data\global\node_modules\ember-native-class-codemod\transforms\helpers\/transform.js:24:58)
    at transformer (C:\Users\bmaehr\AppData\Local\Yarn\Data\global\node_modules\ember-native-class-codemod\transforms\ember-object\/index.js:41:39)
All done.

If I print out the object at that place it looks like this:

<ref *1> NodePath {
  value: Node {
    type: 'ImportDeclaration',
    start: 132,
    end: 183,
    loc: SourceLocation {
      start: [Position],
      end: [Position],
      filename: undefined,
      identifierName: undefined,
      lines: [Lines],
      tokens: [Array],
      indent: 0
    },
    importKind: 'value',
    specifiers: [],
    source: Node {
      type: 'StringLiteral',
      start: 166,
      end: 182,
      loc: [SourceLocation],
      extra: [Object],
      value: '@ember/service',
      regex: null
    }
  },
  parentPath: NodePath {
    value: [ [Node], [Node], [Node], [Node], [Node] ],
    parentPath: NodePath {
      value: [Node],
      parentPath: [NodePath],