Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 657 Bytes

square-brackets.md

File metadata and controls

38 lines (30 loc) · 657 Bytes

Check for [] usage in the dependent keys

Rule name: square-brackets

Dependent key can't end with @each (must be []). [] can't be used in the middle of the dependent key (must be at the end). Dot must be before [].

Usage

{
  "plugins": [
    "ember-cleanup"
  ],
  "rules": {
    "ember-cleanup/square-brackets": 2
  }
}

Valid

Component.extend({
  prop: computed('a.[]', function () {
    // ...
  })    
});

Invalid

Component.extend({
  prop1: computed('a.@each', function () {}),
  prop2: computed('a.[].b', function () {}),
  prop3: computed('a[]', function () {})
});