attributes-order doesn't specify where slot-scope goes.
See original GitHub issueTell 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…~
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
@michalsnik The PR fixes just that, and I was going to make sure the tests cover the new change, but they don’t yet cover
[slot]
anyway, so it could go in as is I guess. All the change does is add[slot-scope]
to the same category as[slot]
, namelyUNIQUE
.Thanks for posting this issue and working on it @GufNZ! Let me know once it’s ready so I can review 😃 Let’s leave
<slot>
case for now and focus on treatingslot-scope
as equal in terms of order toslot
attribute.