From b925fc6eb0190cca1a848c186fc17e47320e8318 Mon Sep 17 00:00:00 2001 From: Douglas Wade Date: Sun, 10 Apr 2022 16:17:20 -0700 Subject: [PATCH 1/2] Add failing test case --- tests/lib/rules/multi-word-component-names.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/lib/rules/multi-word-component-names.js b/tests/lib/rules/multi-word-component-names.js index bb0fba770..6c1e852b6 100644 --- a/tests/lib/rules/multi-word-component-names.js +++ b/tests/lib/rules/multi-word-component-names.js @@ -202,6 +202,17 @@ tester.run('multi-word-component-names', rule, { }, }).$mount('#app') ` + }, + { + filename: 'test.vue', + code: ` + + + ` } ], invalid: [ @@ -309,6 +320,19 @@ tester.run('multi-word-component-names', rule, { line: 4 } ] + }, + { + filename: 'test.vue', + code: ` + `, + errors: [ + { + message: 'Component name "Item" should always be multi-word.', + line: 3 + } + ] } ] }) From 9ed3f92017bfae5d831939e8a6b66a81023e9cd8 Mon Sep 17 00:00:00 2001 From: Douglas Wade Date: Mon, 11 Apr 2022 21:54:57 -0700 Subject: [PATCH 2/2] fix #1836: support script[setup] in multi-word-component-names --- lib/rules/multi-word-component-names.js | 2 +- tests/lib/rules/multi-word-component-names.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rules/multi-word-component-names.js b/lib/rules/multi-word-component-names.js index 4e4e7db28..6f73de294 100644 --- a/lib/rules/multi-word-component-names.js +++ b/lib/rules/multi-word-component-names.js @@ -60,7 +60,7 @@ module.exports = { ignores.add(casing.kebabCase(ignore)) } } - let hasVue = false + let hasVue = utils.isScriptSetup(context) let hasName = false /** diff --git a/tests/lib/rules/multi-word-component-names.js b/tests/lib/rules/multi-word-component-names.js index 6c1e852b6..d11b11d3f 100644 --- a/tests/lib/rules/multi-word-component-names.js +++ b/tests/lib/rules/multi-word-component-names.js @@ -204,7 +204,7 @@ tester.run('multi-word-component-names', rule, { ` }, { - filename: 'test.vue', + filename: 'MultiWord.vue', code: `