Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Readme for no-unsafe-regex has wrong example #1535

Closed
DerZyklop opened this issue Sep 30, 2021 · 1 comment · Fixed by #1764
Closed

Readme for no-unsafe-regex has wrong example #1535

DerZyklop opened this issue Sep 30, 2021 · 1 comment · Fixed by #1764
Assignees
Labels

Comments

@DerZyklop
Copy link

I copy–pasted the examples into my code editor:

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v36.0.0/docs/rules/no-unsafe-regex.md

The second example that should fail, does not fail:

Screenshot 2021-09-30 at 13 32 07

If you want to copy-paste:

let regex;
regex = /^(a?){25}(a){25}$/;
regex = RegExp(Array(27).join('a?') + Array(27).join('a'));
regex = /(x+x+)+y/;
regex = /foo|(x+x+)+y/;
regex = /(a+){10}y/;
regex = /(a+){2}y/;
regex = /(.*){1,32000}[bc]/;

regex = /\bOakland\b/;
regex = /\b(Oakland|San Francisco)\b/i;
regex = /^\d+1337\d+$/i;
regex = /^\d+(1337|404)\d+$/i;
regex = /^\d+(1337|404)*\d+$/i;
regex = RegExp(Array(26).join('a?') + Array(26).join('a'));
@DerZyklop DerZyklop added the bug label Sep 30, 2021
@fisker
Copy link
Collaborator

fisker commented Mar 29, 2022

no-unsafe-regex is known problematic see #153.
I'll update the examples.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants