Skip to content

Rule proposal: The "model" property should contain a "prop" property and an "event" property validly. #824

Closed
@resessh

Description

@resessh

Please describe what the rule should do:

This rule requires prop and event properties in model property.

What category should the rule belong to?

  • Enforces code style
  • Warns about a potential error
  • Suggests an alternate way of doing something
  • Other (please specify:)

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

<script>
export default {
  model: {
    prop: 'someValue',
    // Needs 'event' property.
  },
};
</script>
<script>
export default {
  model: {
    props: 'someValue', // Needs 'prop' property.
    event: 'some-event',
  },
};
</script>

Additional context

  1. If settings is missing, v-model uses value as the prop and input as the event. But both settings should be required when use model property.
  2. Miss-typing with property name is easy to occur and founding the mistake is much harder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions