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

Does not match field "body" #335

Open
MichalBryxi opened this issue Jul 20, 2020 · 0 comments
Open

Does not match field "body" #335

MichalBryxi opened this issue Jul 20, 2020 · 0 comments

Comments

@MichalBryxi
Copy link

MichalBryxi commented Jul 20, 2020

Given this code snippet:

import Service from '@ember/service';
import { computed } from '@ember/object';

export default Service.extend({
  strategies: computed(() => []), // offending line
});

I will get following error output:

...
Sending 1 files to free worker...
 ERR ./addon/services/global-search.js Transformation error ([] does not match field "body": [MethodDefinition | VariableDeclarator | ClassPropertyDefinition | ClassProperty | ClassMethod | TSDeclareMethod | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSIndexSignature | TSMethodSignature | TSPropertySignature] of type ClassBody)
Error: [] does not match field "body": [MethodDefinition | VariableDeclarator | ClassPropertyDefinition | ClassProperty | ClassMethod | TSDeclareMethod | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSIndexSignature | TSMethodSignature | TSPropertySignature] of type ClassBody
    at addParam (/Users/mbryxi/ember/ember-native-class-codemod/node_modules/jscodeshift/node_modules/ast-types/lib/types.js:565:23)
    at /Users/mbryxi/ember/ember-native-class-codemod/node_modules/jscodeshift/node_modules/ast-types/lib/types.js:594:21
    at Array.forEach (<anonymous>)
    at Function.builder [as classBody] (/Users/mbryxi/ember/ember-native-class-codemod/node_modules/jscodeshift/node_modules/ast-types/lib/types.js:592:30)
    at classBody (/Users/mbryxi/ember/ember-native-class-codemod/transforms/helpers/transform-helper.js:402:9)
    at NodePath.createClass (/Users/mbryxi/ember/ember-native-class-codemod/transforms/helpers/parse-helper.js:229:33)
    at /Users/mbryxi/ember/ember-native-class-codemod/node_modules/jscodeshift/src/Collection.js:77:36
    at Array.forEach (<anonymous>)
    at Collection.forEach (/Users/mbryxi/ember/ember-native-class-codemod/node_modules/jscodeshift/src/Collection.js:76:18)
    at forEach (/Users/mbryxi/ember/ember-native-class-codemod/transforms/helpers/parse-helper.js:200:42)
All done.
Results:
1 errors
0 unmodified
0 skipped
0 ok
Time elapsed: 1.931seconds

For my test I had to used own patched version of ember-native-class-codemod that has patched version of
ember-codemods-telemetry-helpers
to mitigate other error that is described in #314

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

1 participant