Skip to content

Conversation

ota-meshi
Copy link
Member

fixes #1767

Comment on lines +1307 to +1328
{
filename: 'test.vue',
code: `
<template>
<div
v-if="x"
v-model="c"
v-bind="b"
v-bind:id="a">
</div>
</template>`,
output: `
<template>
<div
v-if="x"
v-bind="b"
v-bind:id="a"
v-model="c">
</div>
</template>`,
errors: ['Attribute "v-bind:id" should go before "v-model".']
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this create false positives in existing Vue 2 code? There, the order v-if, v-model, v-bind, v-bind:id would be perfectly fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there are any false positives because the id must be before the v-model.

https://vuejs.org/v2/style-guide/#Element-attribute-order-recommended

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, indeed.

@ota-meshi ota-meshi merged commit 017cc22 into master Jan 24, 2022
@ota-meshi ota-meshi deleted the issue1767 branch January 24, 2022 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vue/attributes-order doesn't order v-bind correct
2 participants