Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 651 Bytes

no-empty-attrs.md

File metadata and controls

25 lines (19 loc) · 651 Bytes

Be explicit with Ember data attribute types

Rule name: no-empty-attrs

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.

const { Model, attr } = DS;

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

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

In case when you need a custom behavior it's good to write own Transform