Skip to content

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

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

Closed
z-ZYS-s opened this issue Jul 9, 2018 · 2 comments
Closed

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

z-ZYS-s opened this issue Jul 9, 2018 · 2 comments

Comments

@z-ZYS-s
Copy link

z-ZYS-s commented Jul 9, 2018

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',
    ] }],
}
@michalsnik
Copy link
Member

Hey @rainfore It has been fixed in #421 and waits for the next major release :)

@z-ZYS-s
Copy link
Author

z-ZYS-s commented Jul 16, 2018

Thanks! I think my issue is duplicated with #410

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants