question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule Proposal `vue/attribute-order`

See original GitHub issue

Please describe what the rule should do:

Provide a template rule to enforce placing vue-specific attributes before other properties in a template tag.

What category of rule is this? (place an “X” next to just one item)

[X] Enforces code style [ ] Warns about a potential error [ ] Suggests an alternate way of doing something [ ] Other (please specify:)

Provide 2-3 code examples that this rule will warn about:

Configuration

‘vue/closing-bracket-location’: [‘alphabetical’ | ‘vue-first’]

Examples:

// bad
<a
  v-tooltip
  class="btn external-url"
  data-container="body"
  target="_blank"
  rel="noopener noreferrer nofollow"
  :title="title"
  :aria-label="title"
  :href="externalUrl">

// good
<a
  v-tooltip
  :title="title"
  :aria-label="title"
  :href="externalUrl"
  class="btn external-url"
  data-container="body"
  target="_blank"
  rel="noopener noreferrer nofollow">

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
michalsnikcommented, Oct 8, 2017

https://vuejs.org/v2/style-guide/#Element-attribute-order-recommended is the best point of reference how the config should look like 😃

2reactions
michalsnikcommented, May 6, 2018

No, it hasn’t been taken forward yet. Feel free to submit PR with proposed changes - so we can challenge it 😃

Another idea for possible settings:

'vue/attributes-order': [2, {
  groups: {
    CUSTOM_CONDITIONALS: ['v-show', 'v-cloak', 'v-if', 'v-else-if', 'v-else'],
    SOME_OTHER_GROUP: ['v-once', 'v-pre'],
  },
  order: [
    'CUSTOM_CONDITIONALS',
    'SOME_OTHER_GROUP',
    'OTHER_ATTRS'
  ],
}]

I think it would be even easier to set-up 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue/attributes-order
Rule Details #. This rule aims to enforce ordering of component attributes. The default order is specified in the Vue.js Style Guide and...
Read more >
Vue.js style guide - GitLab Docs
With more than one attribute, all attributes should be on a new line: ... Properties in a Vue Component: Check order of properties...
Read more >
eslint-plugin-weex-vue - npm Package Health Analysis | Snyk
We're using GitHub Releases. Contribution guide. In order to add a new rule, you should: Create issue on GH with description of proposed...
Read more >
Models and Collections for Vue.js - Vue Models & Collections
Check if any of the or rules pass in the order that they were chained. Nested validation. If a model's "validateRecursively" option is...
Read more >
Configuring searchable attributes the right way - Algolia
The order of searchable attributes directly affects search relevance: the engine considers attributes higher in the list more relevant than ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found