`no-control-regex` error should indicate which unexpected chars were found
See original GitHub issueWhat version are you using? 2.11.1
What did you do?
enabled no-control-regex
and ran it on https://github.com/es-shims/String.prototype.trim/blob/e89adeefcbd6fb59563e62d230b8036d65a8bf69/implementation.js#L7-L8
What happened? Got “Unexpected control character in regular expression”
What did you expect to happen? I’d like to know which control character was unexpected, so I can quickly fix it.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Javascript Unexpected control character(s) in regular expression
The rule no-control-regex is on. Reason why it's enabled by default: Control characters are special, invisible characters in the ASCII range 0- ...
Read more >Bug: Unexpected Verdicts for the Rule "no-control-regex ...
It's due to intent to report code such as new RegExp('<TAB>') , but since the rule only examines the pattern (string value) and...
Read more >no-control-regex - ESLint - Pluggable JavaScript Linter
This rule disallows control characters and some escape sequences that match control characters in regular expressions. The following elements of regular ...
Read more >JS-0004 · Found control characters in regular expressions
These characters are rarely used in JavaScript strings, so a regular expression containing these characters is most likely a mistake.
Read more >Searching - Notepad++ User Manual
If the left and right characters of your search string are both non-word characters (so not letters, numbers, underscore, and optionally additional characters...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Open question: Do we have consensus that we’ll just tweak the error message for now, no location tweaks? (Location info would require reporting one violation per character instead of per literal.)
I’m 👎 (but not strongly) to location info, because I think the characters showing up in the lint message is already a huge win for 99% of use cases. If users want line/column info and create an issue to that effect, we can reconsider then. That’s just my thought on the matter, others may disagree.
Makes sense to me 👍