Description
What rule do you want to change?
define-props-declaration
Does this change cause the rule to produce more or fewer warnings?
Does not change the number of warnings.
How will the change be implemented? (New option, new default behavior, etc.)?
Implementing a fix
method in the context.report
descriptor
parameter.
The rule will support separateInterface
option that will opt-in to define type passed to the defineProps
as an interface above defineProps
call.
Please provide some example code that this change will affect:
The rule will be able to autofix the following code:
<script setup lang="ts">
const props = defineProps({
kind: String
})
</script>
transforming it to:
<script setup lang="ts">
const props = defineProps<{ kind: string }>()
</script>
What does the rule currently do for this code?
It des not fix it.
What will the rule do after it's changed?
The rule will have the autofix feature transforming runtime syntax to type-based syntax
Additional context
Activity
FloEdelmann commentedon May 27, 2024
PR welcome, but note that the autofix would need to handle quite complex cases like transforming
{ foo: String as PropType<'a' | 'b'>, bar: User, baz: Number }
to{ foo: 'a' | 'b'; bar: User; baz: number }
.feat: autofix in `define-props-declaration`: runtime syntax to type-b…
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
mpiniarski commentedon May 27, 2024
Pull request created #2466
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
feat: autofix in `define-props-declaration`: runtime syntax to type-b…
5 remaining items