From cc35c58f564504393553a5cba4d6dd99c7147cdc Mon Sep 17 00:00:00 2001 From: Matthieu Mota Date: Sat, 11 Jun 2022 04:40:33 +0200 Subject: [PATCH] Fix regression on no-unused-components rule (#1909) --- lib/rules/no-unused-components.js | 4 ++-- tests/lib/rules/no-unused-components.js | 30 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) 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 + } + ] } ] })