Eslint-plugin-vue: vue/attributes-order: v-dom-portal errors if placed after v-if

Created on 7 Mar 2018  路  7Comments  路  Source: vuejs/eslint-plugin-vue

Tell us about your environment

  • ESLint Version: 4.14.0
  • eslint-plugin-vue Version: 4.3.0
  • Node Version: 8.9.4

Please show your full configuration:

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

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

<div v-if="isVisible" v-dom-portal="true" :class="classes"></div>

What did you expect to happen?
v-dom-portal directive should not fail linting, as it should be OTHER_ATTR imo

What actually happened? Please include the actual, raw output from ESLint.
Instead it seems to be recognised as either DEFINITION or LIST_RENDERING, and the following message displays:

Attribute "v-dom-portal" should go before "v-if". (vue/attributes-order)
bug work in progress

Most helpful comment

What about letting us cherrypick the exact attributes? For example, I would like the v-t directive (from vue-i18n) to be grouped with v-text and v-html, while having the other directives in a different priority.

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

All 7 comments

Having similar issue after updating to eslint-plugin-vue 4.3.0.

Yup, same thing here. Seems to happen with any custom directive in the form v-xxxx

I think all custom directives should be recognised as OTHER_ATTR, and I have submitted a PR and wait for review.

Yes, all custom directives should be recognised as OTHER_ATTR, but bindings do not count here @ydfzgyj

I'm giving it second thought, and maybe we should create another category for OTHER_DIRECTIVES? I wouldn't want to see them mixed with normal attributes and bindings, how about you?

What about letting us cherrypick the exact attributes? For example, I would like the v-t directive (from vue-i18n) to be grouped with v-text and v-html, while having the other directives in a different priority.

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

I agree with @skyrpex, I also think we should put them all into a separate category, but translation ones should go into content.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lichnow picture lichnow  路  3Comments

chrisvfritz picture chrisvfritz  路  3Comments

gluons picture gluons  路  4Comments

armano2 picture armano2  路  4Comments

casprwang picture casprwang  路  4Comments