8000 [Bug] Removal of bound prop ordering (vue/attribute-order) · Issue #737 · vuejs/eslint-plugin-vue · GitHub
[go: up one dir, main page]

Skip to content

[Bug] Removal of bound prop ordering (vue/attribute-order) #737

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

8000
Closed
johnleider opened this issue Dec 22, 2018 · 2 comments
Closed

[Bug] Removal of bound prop ordering (vue/attribute-order) #737

johnleider opened this issue Dec 22, 2018 · 2 comments

Comments

@johnleider
Copy link

Tell us about your environment Windows 10

  • ESLint version: v5.10.0
  • eslint-plugin-vue version: >= v5.0.0-beta.0
  • Node version: v.10.13.0

Please show your full configuration:

module.exports = {
  extends: [
    'standard',
    'plugin:vue/recommended'
  ],

  parserOptions: {
    parser: 'babel-eslint',
    ecmaVersion: 2017,
    sourceType: 'module'
  },

  rules: {
    'max-len': 'off',
    'indent': 'off',
    'vue/component-name-in-template-casing': ['error', 'kebab-case'],
    'vue/script-indent': ['error', 2, {
      'baseIndent': 1,
      'switchCase': 1,
      'ignores': []
    }],
    'vue/max-attributes-per-line': ['error', {
      'singleline': 1,
      'multiline': {
        'max': 1,
        'allowFirstLine': false
      }
    }],
    'vue/html-closing-bracket-newline': ['error', {
      'singleline': 'never',
      'multiline': 'always'
    }],
    'vue/html-closing-bracket-spacing': 'error',
    'vue/no-v-html': 'off'
  }
}

What did you do?

<element
  color="blue"
  gradient="to top, rgba(0,0,0,.32), rgba(0,0,0,.32)"
  :src="require('@/assets/bg.jpg')"
  min-height="100vh"
/>

What did you expect to happen?
:src to move above color/gradient

What actually happened?
:src receives no warning

This was altered in #421. Not completely clear as to whether it was an unintentional change or intended. If it was intended, please reconsider allowing the separation of bound props from unbound.

@michalsnik
Copy link
Member

Hi @johnleider

This was intentional change. We decided to treat bindings and attributes as the same thing in regards to order. You can keep it however you want, but we just won't auto-fix it. We often change regular attributes to bindings, and not forcing different location simplifies diff and does not mess with how you want to keep your attributes in place. Some want bindings first, some group it by name or something else. So what this rule does is to force only essential groups of attributes in certain way, but not those that often changes from one to another with a single sign.

Also If we'd introduce order by bound, unbound. Properties like class or style might end up looking like this:

:class=""
:style=""
id=""
...
class=""
style=""

or we'd have to introduce exceptions, making this rule not very consistent.

As @chrisvfritz mentioned in #410 Style Guide does not make a distinction between those either.

However if you still think that having this possibility has more benefits, you might try to add extra option, let's say boundAttributesFirst and submit PR :)

@FloEdelmann
Copy link
Member

Since this issue is very old and the behavior is intended, I'll close it now.

@FloEdelmann FloEdelmann closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0