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

feat(no-global-regexp-flag-in-query): Detect global RegExp in variable declarations #678

Merged
merged 2 commits into from Oct 19, 2022

Conversation

sjarva
Copy link
Collaborator

@sjarva sjarva commented Oct 18, 2022

Checks

  • I have read the contributing guidelines.
  • If some rule is added/updated/removed, I've regenerated the rules list (npm run generate:rules-list)
  • If some rule meta info is changed, I've regenerated the plugin shared configs (npm run generate:configs)

Changes

  • rename one rule-specific helper function
  • add a rule-specific helper array to keep tab of variable declarations that have a global RegExp
  • add detecting if the argument that is passed to a testing-library query has a global RegExp in its variable declaration
  • add unit test with this scenario

Context

Closes #592

P.S. If you feel that this PR is following the rules of Hactoberfest and this gets merged, it would be wonderful if this PR would be tagged with a hacktoberfest-accepted tag/label. Thanks!

@sjarva sjarva requested a review from Belco90 October 18, 2022 16:13
@sjarva
Copy link
Collaborator Author

sjarva commented Oct 18, 2022

Whoop whoop, this is my first PR that will make a minor release! 🥳 🎈

Copy link
Member

@Belco90 Belco90 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for implementing this feature!

@Belco90 Belco90 merged commit e2ea687 into main Oct 19, 2022
@Belco90 Belco90 deleted the pr/no-global-regex-in-variable branch October 19, 2022 16:19
@github-actions
Copy link

🎉 This PR is included in version 5.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sjarva
Copy link
Collaborator Author

sjarva commented Oct 19, 2022

Whoop whoop, it is released! Now I want to get my hands on a PR that makes a breaking change or major release 😅

@skovy have you done every such issue or is there some left for me? 😜

@Belco90
Copy link
Member

Belco90 commented Oct 19, 2022

@sjarva you can see what’s pending for v6 in this project: https://github.com/orgs/testing-library/projects/14

Since you and @skovy are writers in the repo, you should be able to assign the cards to yourself!

@github-actions
Copy link

🎉 This PR is included in version 6.0.0-alpha.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Improvement: Report RegExp with global flag saved in a variable
2 participants