Skip to content

Commit 0715943

Browse files
committed
chore: refactor componentPropsTypeCode creation
1 parent 7d9e731 commit 0715943

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: lib/rules/define-props-declaration.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ function* fixTypeBased(fixer, node, props, context) {
2424
getComponentPropData(prop, sourceCode)
2525
)
2626

27-
const componentPropsTypeCode = `{${componentPropsData
28-
.map(({ name, type, required, defaultValue }) => {
27+
const componentPropsTypes = componentPropsData.map(
28+
({ name, type, required, defaultValue }) => {
2929
const isOptional = required === false || defaultValue
3030
return `${name}${isOptional ? '?' : ''}: ${type}`
31-
})
32-
.join(PROPS_SEPARATOR)}}`
31+
}
32+
)
33+
34+
const componentPropsTypeCode = `{${componentPropsTypes.join(PROPS_SEPARATOR)}}`
3335

3436
// remove defineProps function parameters
3537
yield fixer.replaceText(node.arguments[0], '')

0 commit comments

Comments
 (0)