eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

Extend `vue/require-valid-default-prop` to check inside defineModel

Open seanogdev opened this issue 1 year ago • 1 comments

What rule do you want to change?

Extend vue/require-valid-default-prop to check defineModel

Does this change cause the rule to produce more or fewer warnings?

Potentially the same

How will the change be implemented? (New option, new default behavior, etc.)?

Add support for defineModel to check that it has a default prop

Please provide some example code that this change will affect:

const modelValue = defineModel({
  type: Boolean,
  default: false,
});

What does the rule currently do for this code?

It does not check for a default value

What will the rule do after it's changed?

A default value must be defined

Additional context

seanogdev avatar Jan 15 '24 13:01 seanogdev

Apparently, this issue requests two improvements, both of which make sense to me:

  1. Extend vue/require-valid-default-prop to check that default values inside defineModel are valid.
  2. Extend vue/require-default-prop to check that a default value exists inside defineModel.

FloEdelmann avatar Jan 15 '24 13:01 FloEdelmann