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

Enhancement: show error for state objects in functional components #805

Open
3 tasks done
richardtallent opened this issue May 27, 2018 · 0 comments
Open
3 tasks done

Comments

@richardtallent
Copy link

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: OS X
  • Vetur version: 0.12.3
  • VS Code version: 1.23.1

Problem

When a component has the functional attribute, it would be nice if Vetur recognized this and showed an error if the developer has data or computed objects in the exported script, as functional components have no state.

I don't know enough about functional components to know if there are other restrictions around lifecycle events, watchers, etc.

Reproducible Case

<template functional>
  <h1>{{ foo }}</h1>
</template>
<script>
export default {
	data: () => ({
		foo: 1,
	}),
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants