-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
no-control-regex
error should indicate which unexpected chars were found
#6293
Comments
Hi @ljharb, thanks for the issue! What you are proposing is an improvement to the error message, correct? I totally agree this would be helpful. |
Yes, an improvement to the error message. Column position would be great too but imo the more important thing is the character itself. |
@ljharb Since the problem is a control character, are you thinking of the character (which might be invisible) or its code, or both? If the code, in hexadecimal or decimal, or both? |
@pedrottimark the escaped form, ie, |
@eslint/eslint-team is anyone willing to champion this change? |
I'm still attempting to implement it, if that helps it stay open. I was blocked on #6752 being merged, so it's only been 6 days since then :-) |
I have the pull request ready, but since this issue isn't yet marked as accepted, it seems like I shouldn't file it yet. |
👍 on this change. |
I'll champion. |
Sounds good to me. 👍 |
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. |
@eslint/eslint-team Can we get one more 👍 here to mark this as accepted? We have a PR that already has been code reviewed and just waiting for this issue to be accepted. |
Makes sense to me 👍 |
* Update: improve error message in `no-control-regex` (fixes #6293) * fixup: this will be squashed before the PR is merged * fixup: this will be squashed before the PR is merged * fixup: Add more test cases; fix a bug. * fixup: try to improve variable names.
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-L8What 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.
The text was updated successfully, but these errors were encountered: