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

Add attributes setting #979

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

edoardocavazza
Copy link

This Pull Request replaces PR #977 and introduces a global setting to configure attributes, as suggested here.

It allows for attribute support for label-has-associated-control rule.

Related issues: #894, #961

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be a bit confused; i was suggesting only a setting, and no rule config changes at all.

@@ -103,6 +104,7 @@ This rule takes one optional object argument of type object:
}
```

`htmlForAttributes`: is an array of strings that specify the attribute to check for an associated control. Default is `["htmlFor"]`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just this one? Why not an object map, so we can always handle class/className, and any others that are needed?

@@ -10,7 +10,8 @@ export type ESLintSettings = {
[string]: mixed,
'jsx-a11y'?: {
polymorphicPropName?: string,
components?: {[string]: string},
components?: { [string]: string },
attributes?: { for?: string[] },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the name “attributes” or “htmlForAttributes”?

@edoardocavazza
Copy link
Author

Uh I am sorry, I thought it was a good idea to make the rule configurable too. I'll drop rule options, keeping the global setting.

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

Successfully merging this pull request may close these issues.

None yet

2 participants