-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
[New] label-has-associated-control
: Add glob support
#749
[New] label-has-associated-control
: Add glob support
#749
Conversation
It looks like the build is failing for older version of node 😦 I looked at |
I switched to using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good overall, just a few comments.
@@ -101,7 +101,7 @@ This rule takes one optional object argument of type object: | |||
|
|||
`labelComponents` is a list of custom React Component names that should be checked for an associated control. | |||
`labelAttributes` is a list of attributes to check on the label component and its children for a label. Use this if you have a custom component that uses a string passed on a prop to render an HTML `label`, for example. | |||
`controlComponents` is a list of custom React Components names that will output an input element. | |||
`controlComponents` is a list of custom React Components names that will output an input element. Glob format is also supported for names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add some examples, or a link to what "glob format" means.
label-has-associated-control
: Add glob support
Seems really close but for a few nits. |
@ljharb I incorporated the requested changes and add documentation / examples for glob format. Sorry about the long turn around time on this, life got a little hectic the past few weeks. |
No need to apologize! This is open source; we're all volunteering our time. Thank you for circling back to this one! |
@ljharb good to go? |
64c6eb0
to
7d5511d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also sorry for the delay on my end :-)
Description
Add glob support for label-has-associated-control rule. This will allow consumers of this library to have some more powerful matching capabilities when using the
controlComponents
option.To accomplish this, I brought in the
minimatch
library => https://github.com/isaacs/minimatchThere are tons of other libraries to do this same thing. It shouldn't be too hard to switch to any of the others if preferred or a lightweight implementation could be done to support the bare minimum.
This addresses issue #720.
Testing
npm i
npm run test