Skip to content

attributes-order doesn't specify where slot-scope goes. #432

Closed
@GufNZ

Description

@GufNZ

Tell us about your environment

  • ESLint Version: 4.18.2
  • eslint-plugin-vue Version: 4.3.0
  • Node Version: 8.9.4

Please show your full configuration: N/A

What did you do? Please include the actual source code causing the issue.
I have a template that uses a component supporting scoped slots, but the rule vue/attributes-order does not specify where the slot-scope attribute should go and treats it like a normal attribute in terms of order.

Before I updated to the version including this rule, I'd always written them first, like below:

<template>
   <component-with-scoped-slots>
      <div slot="left" slot-scope="{ someVar }" :class="leftSlotClasses">...</div>
      <div slot="right" slot-scope="{ someVar }" :class="rightSlotClasses">...</div>
   </component-with-scoped-slots>
</template>

What did you expect to happen?
I expected the position of slot and slot-scope to be the same in this rule.

What actually happened? Please include the actual, raw output from ESLint.
Since slot-scope is not explicitly covered, it is treated like any other custom attr, and expected to be after any bound ones.
[eslint] Attribute ":class" should go before "slot-scope". (vue/attributes-order)

I can make them read at the expected positions thusly:

   <div slot="left" :slot-scope="'{ someVar }'" :class="leftSlotClasses">...</div>

but that feels like cheating..

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions