Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 483 Bytes

require-super-in-init.md

File metadata and controls

24 lines (20 loc) · 483 Bytes

Call _super in init lifecycle hooks

Rule name: require-super-in-init

When overriding the init lifecycle hook inside Ember Components, Controllers, Routes or Mixins, it is necessary to include a call to _super.

// BAD
export default Ember.Component.extend({
  init() {
    this.set('items', []);
  },
});
// GOOD
export default Ember.Component.extend({
  init() {
    this._super(...arguments);
    this.set('items', []);
  },
});