Skip to content

Rule Proposal: valid-slot-scope  #661

Closed
@ota-meshi

Description

@ota-meshi
Member

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

Activity

self-assigned this
on Nov 22, 2018
changed the title [-]Rule Proposal: `valid-valid-slot-scope` [/-] [+]Rule Proposal: `valid-slot-scope` [/+] on Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @armano2@ota-meshi

      Issue actions

        Rule Proposal: `valid-slot-scope` · Issue #661 · vuejs/eslint-plugin-vue