Skip to content

vue/attributes-order fails with binded and unbinded prop #1053

Closed
@jacekkarczmarczyk

Description

@jacekkarczmarczyk

Tell us about your environment

  • ESLint version: 6.8.0
  • eslint-plugin-vue version: 6.2.0
  • Node version: 12.10.0

Please show your full configuration:

module.exports = {
  root: true,
  env: {
    node: true,
    jest: true,
  },
  plugins: [
    '@typescript-eslint',
    'vuetify',
  ],
  extends: [
    'standard',
    'plugin:vue/recommended',
    '@vue/typescript/recommended',
  ],
  parserOptions: {
    parser: '@typescript-eslint/parser',
  },
  rules: {
    // some rules omitted
    'vue/attributes-order': ['error', {
      order: [
        'DEFINITION',
        'LIST_RENDERING',
        'CONDITIONALS',
        'RENDER_MODIFIERS',
        'GLOBAL',
        'UNIQUE',
        'TWO_WAY_BINDING',
        'OTHER_DIRECTIVES',
        'OTHER_ATTR',
        'EVENTS',
        'CONTENT',
      ],
      alphabetical: true,
    }],
  },
};

What did you do?

<template>
  <div>
    <div
      class=""
      :class="{}"
    />
    <div
      :class="{}"
      class=""
    />
  </div>
</template>

What did you expect to happen?

lint --fix should set order in both divs either to :class class or class :class

What actually happened?

error: Attribute ":class" should go before "class" (vue/attributes-order) at src\App.vue:7:9:
   5 |       <div
   6 |         class=""
>  7 |         :class="{}"
     |         ^
   8 |       />
   9 |       <div
  10 |         :class="{}"


error: Attribute "class" should go before ":class" (vue/attributes-order) at src\App.vue:11:9:
   9 |       <div
  10 |         :class="{}"
> 11 |         class=""
     |         ^
  12 |       />
  13 |     </div>
  14 |

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions