vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.47k stars 667 forks source link

Exclude some tags from vue/v-on-event-hyphenation and vue/attribute-hyphenation #2605

Open highfredo opened 1 week ago

highfredo commented 1 week ago

What rule do you want to change? vue/v-on-event-hyphenation and vue/attribute-hyphenation

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

How will the change be implemented? (New option, new default behavior, etc.)? New option to exclude some tags from applying rules. For example

{
  rules: {
    "vue/v-on-event-hyphenation": ["always", {
      exclude: ["custom-element-tag", /custom-element-.+/]
    }]
  }
}

Please provide some example code that this change will affect:

<template>
  <!-- error -->
  <vue-component fooBar="baz"></button>
  <!-- ok -->
  <vue-component foo-bar="baz"></button>
  <custom-element-tag barFoo="foo" @fooBar="baz"></custom-element-tag>
</template>

What does the rule currently do for this code?

What will the rule do after it's changed?

Additional context I'm working on a project that includes some custom elements that don't follow kebab case rule, so when applying the rule these elements are broken. This would help keep kebab-case in the vue component tags and camelCase in the custom elements

Not to be confused with ignore, which ignores attributes, not tags.