-
-
Notifications
You must be signed in to change notification settings - Fork 686
refactor: use regexp-groups to simplify ignores #2776
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
base: master
Are you sure you want to change the base?
Conversation
|
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.
I like the idea! It would be great to see it used a lot more in the whole codebase 🙂
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>
Does that count as
so that I should start converting the rest of the applicable locations? |
That would be great! Do you want to want to give it a go? |
Ready for review/merge. There are a few locations left, that either use plain string[] ignore lists or just use a single ignore pattern, that I haven't touched, but I think they can be enhanced in later PRs on demand. |
Implement idea suggested here: #2773 (comment)
Excluding/Ignoring things is a common task in rules. This PR creates a helper that hides all the string[] -> regexp[] -> boolean logic in a simple helper function.
The current project contains at least 9 instances of
.map(toRegExp)
+ a few more using more verbose syntax.If the general design of this feature is accepted, I will convert the other locations to the new feature and mark this PR as
POC.I'm not super happy with the method name and jsdocs, so any input would be appreciated.