Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.26 KB

no-ember-super-in-es-classes.md

File metadata and controls

50 lines (36 loc) · 1.26 KB

ember/no-ember-super-in-es-classes

💼 This rule is enabled in the ✅ recommended config.

🔧 This rule is automatically fixable by the --fix CLI option.

this._super is not allowed in ES class methods.

While this._super() is the only way to invoke an overridden method in an EmberObject.extend-style class, the _super method doesn't work properly when using native class syntax. Fortunately, native classes come with their own mechanism for invoking methods from a parent.

Examples

Examples of incorrect code for this rule:

import Component from '@ember/component';

export default class MyComponent extends Component {
  init(...args) {
    this._super(...args);
    // Other logic
  }
}

Examples of correct code for this rule:

import Component from '@ember/component';

export default class MyComponent extends Component {
  init(...args) {
    super.init(...args);
    // Other logic
  }
}
import Component from '@ember/component';

export default Component.extend({
  init(...args) {
    this._super(...args);
    // Other logic
  }
});