Skip to content

Commit

Permalink
feature: do not handle array prop declaration (vuejs#2465)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiniarski committed Jul 26, 2024
1 parent da17d74 commit 6634c2d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
11 changes: 1 addition & 10 deletions lib/rules/define-props-declaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,7 @@ const mapNativeType = (nativeType) => {
*/
function getComponentPropData(prop, sourceCode) {
if (prop.type === 'array') {
if (prop.node.type !== 'Identifier') {
throw new Error(`Unexpected prop type inside array: ${prop.node.type}`)
}

return {
name: prop.node.name,
type: 'string',
required: false,
defaultValue: undefined
}
throw new Error(`Unable to resolve types based on array prop declaration.`)
} else if (prop.type === 'object') {
if (prop.propName === null) {
throw new Error('Unexpected prop with null name.')
Expand Down
5 changes: 0 additions & 5 deletions tests/lib/rules/define-props-declaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,11 +642,6 @@ tester.run('define-props-declaration', rule, {
const props = defineProps([kind])
</script>
`,
output: `
<script setup lang="ts">
const props = defineProps<{ kind?: string }>()
</script>
`,
errors: [
{
message: 'Use type-based declaration instead of runtime declaration.',
Expand Down

0 comments on commit 6634c2d

Please sign in to comment.