Skip to content
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

Make attributes "buckets" configurable #2514

Open
markusheiden opened this issue Jul 22, 2024 · 3 comments
Open

Make attributes "buckets" configurable #2514

markusheiden opened this issue Jul 22, 2024 · 3 comments

Comments

@markusheiden
Copy link

markusheiden commented Jul 22, 2024

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")
@FloEdelmann
Copy link
Member

FloEdelmann commented Jul 22, 2024

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.

@markusheiden
Copy link
Author

markusheiden commented Jul 22, 2024

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.

@markusheiden
Copy link
Author

markusheiden commented Jul 22, 2024

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.

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