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

@ota-meshi ota-meshi commented Jan 21, 2022

fixes #1767

@ota-meshi ota-meshi added the bug label Jan 21, 2022
@ota-meshi ota-meshi requested a review from FloEdelmann Jan 21, 2022
lib/rules/attributes-order.js Outdated Show resolved Hide resolved
lib/rules/attributes-order.js Outdated Show resolved Hide resolved
{
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

@FloEdelmann FloEdelmann Jan 21, 2022

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

@ota-meshi ota-meshi Jan 24, 2022

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

@FloEdelmann FloEdelmann Jan 24, 2022

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 Jan 24, 2022
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
12 checks passed
@ota-meshi ota-meshi deleted the issue1767 branch Jan 24, 2022
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.

2 participants