question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`no-control-regex` error should indicate which unexpected chars were found

See original GitHub issue

What 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:closed
  • Created 7 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
platinumazurecommented, Aug 4, 2016

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.

2reactions
btmillscommented, Aug 9, 2016

Makes sense to me 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found