Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 577 Bytes

no-on-calls-in-components.md

File metadata and controls

29 lines (21 loc) · 577 Bytes

no-on-calls-in-components

✅ The "extends": "plugin:ember/recommended" property in a configuration file enables this rule.

Prevents using .on() in favour of component's lifecycle hooks.

The order of execution for on() is not deterministic.

Examples

Examples of incorrect code for this rule:

export default Component.extend({
  abc: on('didInsertElement', function () {
    /* custom logic */
  })
});

Examples of correct code for this rule:

export default Component.extend({
  didInsertElement() {
    /* custom logic */
  }
});