-
-
Notifications
You must be signed in to change notification settings - Fork 681
Add vue/no-unregistered-components
rule
#1114
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
Conversation
Also remove text about where rule is included
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR! I think this rule will helpful people in some cases!
I have change requests.
…r ingore patterns
- Correct rule categories (null) - Ignore `component :is="..."` component for well known HTML tags. - Ignore `component`, `suspense`, `teleport` as unknown components.
@ota-meshi I think all the concerns are now fixed, tests are passing locally but the CI is blocking for |
Seems like |
Ok I think I'm almost there, just missing the |
usedComponentNodes.push({ node, name: node.value.value }) | ||
}, | ||
"VElement[name='template']" (rootNode) { | ||
templateLocation = templateLocation || rootNode.loc.start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is no longer needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the templateLocation variable.
- Remove no longer needed variable. - Handle edge case where a component is registered using kebab-case but later on is used using PascalCase. e.g: registered as `foo-bar` and used as `FooBar` is not valid. - Handle edge case `<component is />`, where `node.value` would be `null`. See https://github.com/mysticatea/vue-eslint-parser/blob/master/docs/ast.md#vattribute - Add more tests to prove all these changes
@ota-meshi great insights into this, thanks for it. I've just pushed 7c3198c fixing (hopefully) all the new concerns. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making the changes!
However, there is one request remaining.
usedComponentNodes.push({ node, name: node.value.value }) | ||
}, | ||
"VElement[name='template']" (rootNode) { | ||
templateLocation = templateLocation || rootNode.loc.start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the templateLocation variable.
Yep, code updated, I forgot that one 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! Looks good to me!
Hey guys, How to lint <script setup>
// import Layout from '@/components/common/Layout.vue';
import { RouterView } from 'vue-router';
import '@/stores';
</script>
<template>
<Layout>
<RouterView />
</Layout>
</template> 'vue/no-unregistered-components': [
'error',
{
ignorePatterns: ['van(\\-\\w+)+', 'el(\\-\\w+)+'],
},
], |
Closes #1112
Inspired by rules/no-unused-components so thanks to Michał Sajnóg.
What are your thoughts @ota-meshi? let me know if this is missing something or you have some concerns, thanks!