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

label-has-associated-control controlComponents should allow regex #720

Closed
twavv opened this issue Jun 29, 2020 · 6 comments
Closed

label-has-associated-control controlComponents should allow regex #720

twavv opened this issue Jun 29, 2020 · 6 comments

Comments

@twavv
Copy link

twavv commented Jun 29, 2020

See the title. :^)

Ideally, I'd like to be able to specify "controlComponents": "Input$" to match any component that ends with Input (e.g., <TextInput />, <EmailInput />, <BirthdateInput />, etc.).

@ljharb
Copy link
Member

ljharb commented Jun 29, 2020

I'd prefer a glob to a regex string; ie, *Input.

@twavv
Copy link
Author

twavv commented Jun 30, 2020

2 cents: I would vote for regex over glob. Regexes are more powerful and I think they're more common in this kind of thing (I've only ever seen globs used for file paths). How would you express .+(Input|Area|Box) using a glob (e.g., if we wanted to allow TextInput or TextBox or TextArea as valid "input" components)? The downside is that regexes are a bit harder to use. ¯_(ツ)_/¯

@ljharb
Copy link
Member

ljharb commented Jun 30, 2020

"More powerful" is a downside, not an upside.

I'd expect that example to be ["*Input", "*Area", "*Box"].

@twavv
Copy link
Author

twavv commented Jun 30, 2020

You say potato, I say potato. 😉

I don't have super strong feelings either way, but the eslint core rules use regexes over globs.
e.g. https://eslint.org/docs/rules/no-unused-vars

@ljharb
Copy link
Member

ljharb commented Jul 1, 2020

Depends on which rules you look at.

Accepting a regex string opens us up to a host of potential CVEs id rather avoid.

@hallzac2
Copy link
Contributor

hallzac2 commented Oct 8, 2020

I created #749 to add glob support 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants