Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix false positives for v-bind="obj" with v-model in vue/attributes-order rule #1771

Merged
merged 3 commits into from Jan 24, 2022

Conversation

ota-meshi
Copy link
Member

fixes #1767

lib/rules/attributes-order.js Outdated Show resolved Hide resolved
lib/rules/attributes-order.js Outdated Show resolved Hide resolved
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 and others added 2 commits January 24, 2022 10:06
Co-authored-by: Flo Edelmann <florian-edelmann@online.de>
Co-authored-by: Flo Edelmann <florian-edelmann@online.de>
@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