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

Rule suggestion: remove no-control-regex from defaults #1143

Open
lionel-rowe opened this issue Mar 25, 2023 · 0 comments · May be fixed by #1340
Open

Rule suggestion: remove no-control-regex from defaults #1143

lionel-rowe opened this issue Mar 25, 2023 · 0 comments · May be fixed by #1340
Labels
bug Something isn't working

Comments

@lionel-rowe
Copy link

lionel-rowe commented Mar 25, 2023

The regex /[\x00-\x1f\x7f]/ gives this warning:

Unexpected control character(s) in regular expression: \x0.
Disable the rule if the control character (\x... or \u00..) was intentional, otherwise rework your RegExp
deno-lint(no-control-regex)

Aside from the fact the warning is wrong (it's \x00, not \x0; also it doesn't trigger if \x7f is the only control char in the regex), regexes such as /[\x00-\x1f\x7f]/ are a somewhat common occurrence and a completely reasonable thing to want to write, particularly if you're doing something like parsing raw IO from stdin/stdout.

Alternatively: change the rule to only trigger for control character literals, which impede readability due to rendering as tofu in most fonts, and are much more likely to be there erroneously, whether in regexes or elsewhere.

@bartlomieju bartlomieju added the bug Something isn't working label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants