Skip to content

Rule Proposal: no undef component in template when using <script setup> #1693

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

Closed
niaodan2b opened this issue Nov 1, 2021 · 0 comments · Fixed by #1763
Closed

Rule Proposal: no undef component in template when using <script setup> #1693

niaodan2b opened this issue Nov 1, 2021 · 0 comments · Fixed by #1763

Comments

@niaodan2b
Copy link

Please describe what the rule should do:
Warn against components that appear in the template but not defined/imported in script-setup

What category should the rule belong to?
[ ] Enforces code style (layout)
[X] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

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

// Bad: OtherComponent not defined
<template>
  <div>
    <SomeComponent />
    <OtherComponent />
  </div>
</template>

<script setup>
import SomeComponent from '@/components/SomeComponent.vue'
</script>

//Good:
<template>
  <div>
    <SomeComponent />
    <OtherComponent />
  </div>
</template>

<script setup>
import SomeComponent from '@/components/SomeComponent.vue'
import OtherComponent from '@/components/OtherComponent.vue' // or: const OtherComponent = xxx.
</script>

//Also Good:
<template>
  <div>
    <some-component />
    <other-component />
  </div>
</template>

<script setup>
import SomeComponent from '@/components/SomeComponent.vue'
import OtherComponent from '@/components/OtherComponent.vue' // or: const OtherComponent = xxx.
</script>

Additional context
This is like the script-setup version of "no-unregistered components" rule

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