Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Loose order of some attributes (attributes-order) #515

Closed
@z-ZYS-s

Description

Tell us about your environment

  • ESLint Version: 4.19.1
  • eslint-plugin-vue Version: 4.5.0
  • Node Version: 8.9.4

Please show your full configuration:

{
 extends: 'plugin:vue/recommended',
 parser: 'vue-eslint-parser',
 plugins: ['vue'],
 rules: {
 'vue/attributes-order': [2],
 }
}

What did you do? Please include the actual source code causing the issue.

<template>
<div>
 <u-button ref="button" color="primary" href="https://vuejs.org/" disabled style="width: 100%" @click="onClick">Vue</u-button>
 <u-button ref="button" color="primary" :href="href" :disabled="disabled" :style="styleObject" @click="onClick">Vue</u-button>
</div>
</template>

What did you expect to happen?

<template>
<div>
 <u-button ref="button" color="primary" href="https://vuejs.org/" disabled style="width: 100%" @click="onClick">Vue</u-button>
 <u-button ref="button" color="primary" :href="href" :disabled="disabled" :style="styleObject" @click="onClick">Vue</u-button>
</div>
</template>

What actually happened? Please include the actual, raw output from ESLint.

<template>
<div>
 <u-button ref="button" color="primary" href="https://vuejs.org/" disabled style="width: 100%" @click="onClick">Vue</u-button>
 <u-button ref="button" :href="href" :disabled="disabled" :style="styleObject" color="primary" @click="onClick">Vue</u-button>
</div>
</template>

It often happens in developing that I exchange same attributes from normal to binding. I want a consistent order by their name but eslint fixer will force to change it. But I don't want just to close this rule.
So is there any way to ignore the order of BINDING and OTHER_ATTR and keep other types?

Rule config like this:

rules: {
 'vue/attributes-order': [2, { order: [
 'DEFINITION',
 'LIST_RENDERING',
 'CONDITIONALS',
 'RENDER_MODIFIERS',
 'GLOBAL',
 'UNIQUE',
 ['BINDING', 'OTHER_ATTR'],
 'EVENTS',
 'CONTENT',
 ] }],
}

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

        AltStyle によって変換されたページ (->オリジナル) /