Skip to content

Latest commit

 

History

History
53 lines (42 loc) · 833 Bytes

no-set-in-computed-property.md

File metadata and controls

53 lines (42 loc) · 833 Bytes

no-set-in-computed-property

This rule ensures no calls to Ember.set() or this.set() are made within a computed property.

ESLint Configuration

{
  "rules": {
    "ember-standard/no-set-in-computed-property": 2
  }
}

Valid

import Ember from 'ember'
const {computed} = Ember

export default Component({
  foo: computed('bar', function () {
    return this.get('bar') + '-baz'
  })
})

Invalid

import Ember from 'ember'
const {computed} = Ember

export default Component({
  foo: computed('bar', function () {
    this.set('baz', 'spam')
    return this.get('bar') + '-baz'
  })
})
import Ember from 'ember'
const {computed, set} = Ember

export default Component({
  foo: computed('bar', function () {
    set('baz', 'spam')
    return this.get('bar') + '-baz'
  })
})