Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule Proposal: no-computed-in-data #958

Closed
1 of 4 tasks
scyclops opened this issue Sep 12, 2019 · 1 comment
Closed
1 of 4 tasks

Rule Proposal: no-computed-in-data #958

scyclops opened this issue Sep 12, 2019 · 1 comment

Comments

@scyclops
Copy link

Please describe what the rule should do:

Ensure computed properties are not used in the data() function because data() runs before computed properties are calculated. So computed properties are undefined when used in data().

What category should the rule belong to?

  • Enforces code style
  • Warns about a potential error
  • Suggests an alternate way of doing something
  • Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

<script>
export default {
    data(){
        return {
            value: 'hello ' + this.world
        }
    },
    computed: {
        world() {
            return 'world'
        }
    }
}
</script>

@ota-meshi
Copy link
Member

The rule has been implemented #1653.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants