Skip to content

Rule Proposal: valid-slot-scope  #661

Closed
@ota-meshi

Description

@ota-meshi

Please describe what the rule should do:

This rule checks whether every slot-scope (or scope) attributes is valid.
This rule reports the following cases:

  • The slot-scope attribute does not have that attribute value. E.g. <div slot-scope></div>
  • The slot-scope attribute have the attribute value which is extra access to slot data. E.g. <div slot-scope="prop, extra"></div>
  • The slot-scope attribute have the attribute value which is rest parameter. E.g. <div slot-scope="...props"></div>

maybe "extra access" and "rest parameter" are mistakes of destructuring.

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:

<template>
  <TheComponent>
    <template slot-scope>
      ...
    </template>
  </TheComponent>
  <TheComponent>
    <template slot-scope="">
      ...
    </template>
  </TheComponent>
  <TheComponent>
    <template slot-scope="...props">
      ...
    </template>
  </TheComponent>
  <TheComponent>
    <template slot-scope="a, b, c">
      <!-- `b` and `c` are extra access. -->
      ...
    </template>
  </TheComponent>
</template>

Additional context

slot-scope

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions