From a473a0d543655addf28b8bbc3c1e1393e2b30854 Mon Sep 17 00:00:00 2001 From: Douglas Wade Date: Tue, 12 Apr 2022 16:26:56 -0700 Subject: [PATCH] Fix 1836 (#1844) * Add failing test case * 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 | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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 bb0fba770..d11b11d3f 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: 'MultiWord.vue', + code: ` + + + ` } ], invalid: [ @@ -309,6 +320,19 @@ tester.run('multi-word-component-names', rule, { line: 4 } ] + }, + { + filename: 'test.vue', + code: ` + `, + errors: [ + { + message: 'Component name "test" should always be multi-word.', + line: 1 + } + ] } ] })