Replace use of Ember.on
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
__testfixtures__
__tests__
.eslintrc
.gitignore
LICENSE
README.md
package.json
transform.js

README.md

Ember on codemod

To conform to this linting rule, this codemod will replace uses of Ember.on with their method equivalent.

Changes

willChange

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

will become

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

wontChange

non-lifecycle events

export default Ember.Component.extend({
  onSomething: Ember.on('something', function() {

  }),
});

initted observers

cos probably done for a reason and observer needs manual refactoring and proper testing

export default Ember.Component.extend({
  a: Ember.on('init', Ember.observer('something', function() {

  })),
});

with params

soon to be deprecated, should remain as a linting error until refactored

export default Ember.Component.extend({
  onDidReceiveAttrs: Ember.on('didReceiveAttrs', function({ newAttrs, oldAttrs }) {

  }),
});