Skip to content

Make attributes "buckets" configurable #2514

Open

Description

@markusheiden

What rule do you want to change?
vue/attributes-order

Does this change cause the rule to produce more or fewer warnings?
The same as before.

How will the change be implemented? (New option, new default behavior, etc.)?
More flexible configuration, e.g. by adding options.

Please provide some example code that this change will affect:
Quasar uses row-key in q-table that is IMO similar to key used for v-for.
Currently, I cannot order these to the same position, see examples below.

What does the rule currently do for this code?

q-table(v-model="row", row-key="id")

What will the rule do after it's changed?
By adding row-key to UNIQUE, it would allow:

q-table(row-key="id", v-model="row")

Activity

  1. FloEdelmann commented on Jul 22, 2024

    @FloEdelmann
    Member

    Instead of "UNIQUE", you can specify the attributes directly, and you can use an array to allow them to be in any order internally, so e.g. replace "UNIQUE" with ["id", "row-key"] in your rule configuration.

  2. markusheiden commented on Jul 22, 2024

    @markusheiden
    Author

    I would like a possibility to just add some attributes without the need to redefine all existing ones nor the order of the buckets. But I will try the suggested solution.

    Just to be sure, because that's not in the docs: I have to configure the order by using an array of attributes in place of UNIQUE? The docs just mention that possibility for using arrays of bucket names.

  3. markusheiden commented on Jul 22, 2024

    @markusheiden
    Author

    That did not work:

    'vue/attributes-order': [
      'error',
      {
        order: [
          'DEFINITION',
          'LIST_RENDERING',
          'CONDITIONALS',
          'RENDER_MODIFIERS',
          'GLOBAL',
          /* UNIQUE: */ ['ref', 'key', /* added: */ 'row-key'],
          'TWO_WAY_BINDING',
          'OTHER_DIRECTIVES',
          'OTHER_ATTR',
          'EVENTS',
          'CONTENT'
        ],
        alphabetical: false
      }
    ]
    Error: .eslintrc.cjs:
            Configuration for rule "vue/attributes-order" is invalid:
            Value ["ref","key","row-key"] should be equal to one of the allowed values.
            Value "ref" should be equal to one of the allowed values.
            Value ["ref","key","row-key"] should match some schema in anyOf.
    
  4. ValentinYoushkevich commented on Oct 28, 2026

    @ValentinYoushkevich
    Contributor

    Arrays only accept group names for now, which is why that config fails. I suggested in #2324 to also allow plain attribute names in order, so ['UNIQUE', 'row-key'] would work for this case without redefining the other groups. I'll open a PR for both once that approach is OK.

  5. ValentinYoushkevich commented on Oct 28, 2026

    @ValentinYoushkevich
    Contributor

    Opened #3222, which covers this with ['UNIQUE', 'row-key'].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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