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
Update: prefer-regex-literal detects regex literals passed to RegExp (fixes #12840) #12842
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.
Code looks good, I have just a couple of minor suggestions about the documentation and a few nice-to-have tests.
The rule `prefer-regex-literal` now detects when regex literals are unnecessarily passed to the `RegExp` constructor.
@mdjermanovic thanks for your feedback. I’ve addressed all you comments, PTAL. |
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.
Looks great, thanks!
Thanks for contributing! |
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to item)
What changes did you make? (Give an overview)
I’ve changed the rule
prefer-regex-literal
so that it detects regex literals that are passed to theRegExp
constructor.Is there anything you'd like reviewers to focus on?
I have implemented the rule change as the new default behavior. Once a decision has been made in prefer-regex-literals: should report regex literals passed to RegExp constructor #12840 I’m happy to change the if necessary and move the new behavior behind an optionThe new behavior is now implemented behind an option.