Skip to content

Commit a473a0d

Browse files
authored
Fix 1836 (#1844)
* Add failing test case * fix #1836: support script[setup] in multi-word-component-names
1 parent 46da539 commit a473a0d

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lib/rules/multi-word-component-names.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module.exports = {
6060
ignores.add(casing.kebabCase(ignore))
6161
}
6262
}
63-
let hasVue = false
63+
let hasVue = utils.isScriptSetup(context)
6464
let hasName = false
6565

6666
/**

tests/lib/rules/multi-word-component-names.js

+24
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,17 @@ tester.run('multi-word-component-names', rule, {
202202
},
203203
}).$mount('#app')
204204
`
205+
},
206+
{
207+
filename: 'MultiWord.vue',
208+
code: `
209+
<template>
210+
<AppButton />
211+
</template>
212+
213+
<script setup lang="ts">
214+
import AppButton from "@/components/AppButton.vue";
215+
</script>`
205216
}
206217
],
207218
invalid: [
@@ -309,6 +320,19 @@ tester.run('multi-word-component-names', rule, {
309320
line: 4
310321
}
311322
]
323+
},
324+
{
325+
filename: 'test.vue',
326+
code: `
327+
<script setup lang="ts">
328+
import Item from "@/components/Item.vue";
329+
</script>`,
330+
errors: [
331+
{
332+
message: 'Component name "test" should always be multi-word.',
333+
line: 1
334+
}
335+
]
312336
}
313337
]
314338
})

0 commit comments

Comments
 (0)