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

New rule: No unnecessary regex global flags #1152

Closed
tom-sherman opened this issue Jun 22, 2018 · 5 comments

Comments

@tom-sherman
Copy link

commented Jun 22, 2018

I recently came across an ugly pattern in Regex regarding the g flag. See here for details: https://stackoverflow.com/questions/2630418/javascript-regex-returning-true-then-false-then-true-etc

Would have been nice for the linter to warn that I'm using a global flag when I was using ^ and $ characters at the beginning and end of the regex.

Thoughts?

@stale

This comment has been minimized.

Copy link

commented Sep 20, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Sep 20, 2018

@LinusU

This comment has been minimized.

Copy link
Member

commented Sep 20, 2018

This sounds very nice! @tom-sherman, is there an existing ESLint rule for this?

@stale stale bot removed the stale label Sep 20, 2018

@tom-sherman

This comment has been minimized.

Copy link
Author

commented Sep 20, 2018

@LinusU It doesn't look to be. Should I create an issue in ESlint to discuss adding it?

@LinusU

This comment has been minimized.

Copy link
Member

commented Sep 20, 2018

Yes please ☺️

@stale

This comment has been minimized.

Copy link

commented Dec 19, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Dec 19, 2018

@stale stale bot closed this Dec 26, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Mar 26, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.