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

attribute-hyphenation: Ignore tag name pattern or function #2377

Open
jschill opened this issue Jan 23, 2024 · 0 comments
Open

attribute-hyphenation: Ignore tag name pattern or function #2377

jschill opened this issue Jan 23, 2024 · 0 comments

Comments

@jschill
Copy link

jschill commented Jan 23, 2024

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.

@jschill jschill changed the title attribute-hyphenation: Ignore tag name pattern attribute-hyphenation: Ignore tag name pattern or function Jan 23, 2024
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

1 participant