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

Fix regression on no-unused-components rule #1909

Merged
merged 1 commit into from Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/rules/no-unused-components.js
Expand Up @@ -120,13 +120,13 @@ module.exports = {
name === casing.camelCase(n))
)
) {
return
continue
}
} else {
// In any other case the used component name must exactly match
// the registered name
if (usedComponents.has(name)) {
return
continue
}
}

Expand Down
30 changes: 30 additions & 0 deletions tests/lib/rules/no-unused-components.js
Expand Up @@ -695,6 +695,36 @@ tester.run('no-unused-components', rule, {
line: 13
}
]
},

// Many components and one in middle is no present
{
filename: 'test.vue',
code: `
<template>
<div>
<Foo />
<fio.fio />
<baz />
</div>
</template>
<script>
export default {
components: {
Foo,
'fio.fio': FioFio,
Bar,
Baz
},
}
</script>
`,
errors: [
{
message: 'The "Bar" component has been registered but not used.',
line: 14
}
]
}
]
})