eslint-plugin-vue
eslint-plugin-vue copied to clipboard
attribute-hyphenation: Ignore tag name pattern or function
What rule do you want to change? attribute-hyphenation
Does this change cause the rule to produce more or fewer warnings? Fewer
How will the change be implemented? (New option, new default behavior, etc.)?
An option to ignore tags based on their names. Either by adding a new option ignoreTags which accept a regexp
const options = {
ignoreTags: /^ctag/ // ignore html-tags starting with "ctag", such as <ctag-input> or <ctag-hey>.
}
...Or maybe change the current ignore option to accept a function with a signature like this function (tagName: string, propName: string): boolean
// ignore tags starting with "ctag" or attributes starting with "cprop-"
const options = {
ignore: (tagName: string, propName: string) => /^ctag/.test(tagName) || /^cprop-/.test(tagName)
}
Please provide some example code that this change will affect:
<template>
<ctag-button fooBar="baz"></ctag-button>
</template>
What does the rule currently do for this code? If you have attribute-hyphenation activated with always, the fooBar attribute above will be an error.
What will the rule do after it's changed? This rule wont be applied to this tag.
Additional context When using custom components with Lit, you are free to use whatever casing you want on the attributes. And thats fine as long as you are in control of the custom components and can set the attribute names yourself. But when including shared custom components with different linting rules that you have no control of, it would be great to ignore them from being linted.