Skip to content

vue/attributes-order doesn't order v-bind correct #1767

Closed
@ijcnvv

Description

@ijcnvv

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • Vue version": 3.2.27
  • ESLint version: 8.7.0
  • eslint-plugin-vue version: 8.3.0
  • Node version: 16.13.0
  • Operating System: macOS Monterey 12.1

Please show your full configuration:

extends: [
        'eslint:recommended',
        'plugin:vue/vue3-essential',
        'plugin:vue/vue3-strongly-recommended',
        'plugin:vue/vue3-recommended',
],
rules: {
        'vue/attributes-order': 2,
}

What did you do?

<base-menu
        v-model:placement="placement"
        v-bind="menuProps"
        :value="focused"
        :class="className"
        @click:outside="hideOptions"
    />

What did you expect to happen?
no warning on console

What actually happened?

Module Warning (from ./node_modules/vue-loader/dist/templateLoader.js):
(Emitted value instead of an instance of Error) (deprecation COMPILER_V_BIND_OBJECT_ORDER) v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.
  Details: https://v3.vuejs.org/guide/migration/v-bind.html
2  |      <base-menu
3  |          v-model:placement="placement"
4  |          v-bind="menuProps"
   |          ^^^^^^^^^^^^^^^^^^
5  |          :value="focused"
6  |          :class="className"

What did you do?

<base-menu
        v-bind="menuProps"
        v-model:placement="placement"
        :value="focused"
        :class="className"
        @click:outside="hideOptions"
    />

What did you expect to happen?
no warning on console

What actually happened?

ERROR in component.vue:4:9
vue/attributes-order: Attribute "v-model:placement" should go before "v-bind".
    2 |     <base-menu
    3 |         v-bind="menuProps"
    4 |         v-model:placement="placement"

Repository to reproduce this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions