Skip to content

Force TypeScript only defineProps #1959

Closed
@mesqueeb

Description

@mesqueeb

Please describe what the rule should do:
Forces the TypeScript only way of defining props.

What category should the rule belong to?

[x] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

GOOD

const props = defineProps<{
  /**
   * The kind of button to render
   */
  kind: 'primary' | 'secondary',
}>()

BAD

const props = defineProps({
  /**
   * The kind of button to render
   */
  kind: { type: String as PropType<'primary' | 'secondary'> },
})

BAD

const props = defineProps({
  /**
   * The kind of button to render
   */
  kind: { type: String },
})

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions