Skip to content

Rule proposition: no-shared-component-data must be a function. #79

Closed
@armano2

Description

@armano2

When using the data property on a component (i.e. anywhere except on new Vue), the value must be a function that returns an object.

based on style guide

Invalid:

Vue.component('some-comp', {
  data: {
    foo: 'bar'
  }
})
export default {
  data: {
    foo: 'bar'
  }
}

Valid:

new Vue({
  data: function () {
    return {
      foo: 'bar'
    }
  }
})
new Vue({
  data: {
    foo: 'bar'
  }
})
Vue.component('some-comp', {
  data: function () {
    return {
      foo: 'bar'
    }
  }
})
export default {
  data: function () {
    return {
      foo: 'bar'
    }
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions