ember.jsember-clibroccolijs

Ember serve Build Error (EslintValidationFilter)


running ember serve i get the following error message

Build Error (EslintValidationFilter) in components/type-compte.js

Cannot read property 'body' of undefined

Stack Trace and Error Report: C:\...Temp/error.dump.d4e5703d56fd78302521e967efca5c25.log

the stack trace containe :

ERROR Summary:

  • broccoliBuilderErrorStack: TypeError: Cannot read property 'body' of undefined at CallExpression (C:\Users\PC\Desktop\dev\github\wikicours\node_modules\eslint-plugin-ember\lib\rules\require-super-in-init.js:92:60) at listeners.(anonymous function).forEach.listener (C:\Users\PC\Desktop\dev\github\wikicours\node_modules\eslint\lib\util\safe-emitter.js:47:58) at Array.forEach () at Object.emit (C:\Users\PC\Desktop\dev\github\wikicours\node_modules\eslint\lib\util\safe-emitter.js:47:38) at NodeEventGenerator.applySelector (C:\Users\PC\Desktop\dev\github\wikicours\node_modules\eslint\lib\util\node-event-generator.js:251:26) at NodeEventGenerator.applySelectors (C:\Users\PC\Desktop\dev\github\wikicours\node_modules\eslint\lib\util\node-event-generator.js:280:22) at NodeEventGenerator.enterNode (C:\Users\PC\Desktop\dev\github\wikicours\node_modules\eslint\lib\util\node-event-generator.js:294:14) at CodePathAnalyzer.enterNode (C:\Users\PC\Desktop\dev\github\wikicours\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:608:23) at Traverser.enter [as _enter] (C:\Users\PC\Desktop\dev\github\wikicours\node_modules\eslint\lib\linter.js:865:28) at Traverser._traverse (C:\Users\PC\Desktop\dev\github\wikicours\node_modules\eslint\lib\util\traverser.js:132:14)
  • codeFrame: Cannot read property 'body' of undefined
  • errorMessage: Build Canceled: Broccoli Builder ran into an error with EslintValidationFilter plugin. 💥 Cannot read property 'body' of undefined
  • errorType: Build Error
  • location:
    • column: [undefined]
    • file: components/type-compte.js
    • line: [undefined]
    • treeDir: C:\Users\PC\Desktop\dev\github\wikicours\tmp\broccoli_persistent_filtereslint_validation_filter-input_base_path-QtE3OUt9.tmp
  • message: Build Canceled: Broccoli Builder ran into an error with EslintValidationFilter plugin. 💥

and type-compte.js contente is :

export default Component.extend({
    init:computed('membre.typecompte',function(){
        this._super(...arguments);
        var membre = this.get('membre');
        console.log('membre : ', membre);
        var typecompte = membre.get('typecompte');
        console.log('typecompte : ', typecompte);
        var tc ='';
        if(typecompte===0){
           tc = 'enseignant';
        }else if(typecompte===1){
            tc = 'modirateur';
        }else if(typecompte===2){
            tc = 'administrateur';
        }
        this.set('typeCompte',tc);
    }),
});

Solution

  • Init can't be a computed property. Init has to be a function and you have to call _super