Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 1.12 KB

no-empty-attrs.md

File metadata and controls

43 lines (29 loc) · 1.12 KB

ember/no-empty-attrs

Be explicit with Ember data attribute types.

Ember Data handles not specifying a transform in model description. Nonetheless this could lead to ambiguity. This rule ensures that the right transform is specified for every attribute.

Note: this rule is not in the recommended configuration because the Ember Data team recommends not using transforms unless you actually want to transform something.

Examples

Examples of incorrect code for this rule:

const { Model, attr } = DS;

export default Model.extend({
  name: attr(),
  points: attr(),
  dob: attr()
});

Examples of correct code for this rule:

const { Model, attr } = DS;

export default Model.extend({
  name: attr('string'),
  points: attr('number'),
  dob: attr('date')
});

In case you need a custom behavior, it's good to write your own transform.

Help Wanted

Issue Link
❌ Missing native JavaScript class support #560