Skip to content

Commit

Permalink
Fix 1836 (#1844)
Browse files Browse the repository at this point in the history
* Add failing test case

* fix #1836: support script[setup] in multi-word-component-names
  • Loading branch information
doug-wade committed Apr 12, 2022
1 parent 46da539 commit a473a0d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/multi-word-component-names.js
Expand Up @@ -60,7 +60,7 @@ module.exports = {
ignores.add(casing.kebabCase(ignore))
}
}
let hasVue = false
let hasVue = utils.isScriptSetup(context)
let hasName = false

/**
Expand Down
24 changes: 24 additions & 0 deletions tests/lib/rules/multi-word-component-names.js
Expand Up @@ -202,6 +202,17 @@ tester.run('multi-word-component-names', rule, {
},
}).$mount('#app')
`
},
{
filename: 'MultiWord.vue',
code: `
<template>
<AppButton />
</template>
<script setup lang="ts">
import AppButton from "@/components/AppButton.vue";
</script>`
}
],
invalid: [
Expand Down Expand Up @@ -309,6 +320,19 @@ tester.run('multi-word-component-names', rule, {
line: 4
}
]
},
{
filename: 'test.vue',
code: `
<script setup lang="ts">
import Item from "@/components/Item.vue";
</script>`,
errors: [
{
message: 'Component name "test" should always be multi-word.',
line: 1
}
]
}
]
})

0 comments on commit a473a0d

Please sign in to comment.