Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.37 KB

no-get.md

File metadata and controls

44 lines (29 loc) · 1.37 KB

no-get

Starting in Ember 3.1, native ES5 getters are available, which eliminates much of the need to use get on Ember objects.

Rule Details

This rule disallows using this.get('someProperty') when this.someProperty can be used.

WARNING: there are a number of circumstances where get still needs to be used, and you may need to manually disable the rule for these:

  • Ember proxy objects (ObjectProxy, ArrayProxy)
  • Objects implementing the unknownProperty method

Examples

Examples of incorrect code for this rule:

const foo = this.get('someProperty');
import { get } from '@ember/object';
const foo = get(this, 'someProperty');

Examples of correct code for this rule:

const foo = this.someProperty;
const foo = this.get('some.nested.property'); // Allowed because of nested path.

References