diff --git a/lib/rules/no-unused-components.js b/lib/rules/no-unused-components.js
index 0cbaec9f7..f07b9ea54 100644
--- a/lib/rules/no-unused-components.js
+++ b/lib/rules/no-unused-components.js
@@ -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
}
}
diff --git a/tests/lib/rules/no-unused-components.js b/tests/lib/rules/no-unused-components.js
index f63b75f13..6f0e61a56 100644
--- a/tests/lib/rules/no-unused-components.js
+++ b/tests/lib/rules/no-unused-components.js
@@ -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: `
+
+
+
+
+
+
+
+
+ `,
+ errors: [
+ {
+ message: 'The "Bar" component has been registered but not used.',
+ line: 14
+ }
+ ]
}
]
})