Skip to content

Commit cc35c58

Browse files
authored
Fix regression on no-unused-components rule (#1909)
1 parent a8ab4fd commit cc35c58

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

lib/rules/no-unused-components.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ module.exports = {
120120
name === casing.camelCase(n))
121121
)
122122
) {
123-
return
123+
continue
124124
}
125125
} else {
126126
// In any other case the used component name must exactly match
127127
// the registered name
128128
if (usedComponents.has(name)) {
129-
return
129+
continue
130130
}
131131
}
132132

tests/lib/rules/no-unused-components.js

+30
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,36 @@ tester.run('no-unused-components', rule, {
695695
line: 13
696696
}
697697
]
698+
},
699+
700+
// Many components and one in middle is no present
701+
{
702+
filename: 'test.vue',
703+
code: `
704+
<template>
705+
<div>
706+
<Foo />
707+
<fio.fio />
708+
<baz />
709+
</div>
710+
</template>
711+
<script>
712+
export default {
713+
components: {
714+
Foo,
715+
'fio.fio': FioFio,
716+
Bar,
717+
Baz
718+
},
719+
}
720+
</script>
721+
`,
722+
errors: [
723+
{
724+
message: 'The "Bar" component has been registered but not used.',
725+
line: 14
726+
}
727+
]
698728
}
699729
]
700730
})

0 commit comments

Comments
 (0)