💼 This rule is enabled in the ✅ recommended config.
Disallows the use of the following classic API methods within a class:
getsetgetPropertiessetPropertiesgetWithDefaultincrementPropertydecrementPropertytogglePropertyaddObserverremoveObservernotifyPropertyChangecacheForproto
These are "classic" API methods, and their usage is discouraged in Octane.
Non-method versions of them can still be used, e.g. @ember/object#get and
@ember/object#set instead of this.get and this.set.
Examples of incorrect code for this rule:
export default class MyService extends Service {
constructor(...args) {
super(...args);
this.set('foo', 'bar');
}
}Examples of correct code for this rule:
@classic
export default class MyService extends Service {
constructor(...args) {
super(...args);
this.set('foo', 'bar');
}
}import { set } from '@ember/object';
export default class MyService extends Service {
constructor(...args) {
super(...args);
set(this, 'foo', 'bar');
}
}import { tracked } from '@glimmer/tracking';
export default class MyService extends Service {
@tracked foo = 'bar';
}