Starting in Ember 3.1, native ES5 getters are available, which eliminates much of the need to use get and getProperties on Ember objects. In particular, getProperties no longer needs to be used with destructuring assignments.
This rule disallows unnecessarily using this.getProperties() with destructuring assignments.
WARNING: there are a number of circumstances where getProperties still needs to be used, and you may need to manually disable the rule for these:
- Ember proxy objects (
ObjectProxy,ArrayProxy) - Objects implementing the
unknownPropertymethod
Examples of incorrect code for this rule:
const { abc, def } = this.getProperties('abc', 'def');import { getProperties } from '@ember/object';
const { abc, def } = getProperties(this, 'abc', 'def');Examples of correct code for this rule:
const { abc, def } = this;const { foo, barBaz } = this.getProperties('foo', 'bar.baz'); // Allowed because of nested path.- JavaScript Destructuring Assignment Spec
- Ember 3.1 Release Notes describing "ES5 Getters for Computed Properties"
- Ember getProperties Spec
- Ember ES5 Getter RFC
- es5-getter-ember-codemod
- More context about the proxy object exception to this rule