JS.VUE.NO.COMPUTED.PROPERTIES.IN.DATA

The computed property cannot be accessed in `data()` before initialization

Rule Details

This rule disallow accessing computed properties in data().
The computed property cannot be accessed in data() because is before initialization.

{'vue/no-computed-properties-in-data': ['error']}

Copy
<script>
export default {
  data() {
    return  {
      /* BAD */
      bar: this.foo
    }
  },
  computed: {
    foo () {}
  }
}
</script>

Options

Nothing.

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/