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
New: Add no-nonoctal-decimal-escape rule (fixes #13765) #13845
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just one note in the docs.
@@ -0,0 +1,58 @@ | |||
# Disallow `\8` and `\9` escape sequences in string literals (no-nonoctal-decimal-escape) | |||
|
|||
Although not being specified in the language until ECMAScript 2021, `\8` and `\9` escape sequences in string literals were allowed in most JavaScript engines, and treated as "useless" escapes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a link to the appropriate location in the spec both in this paragraph and under a "Further Reading" heading at the bottom?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reading through the tests, I've seen enough backslashes for at least a couple weeks. Including the suggestions//fixer is a nice touch especially considering no-octal-escape
doesn't include one. Nice work all around. LGTM
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[X] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
fixes #13765
What changes did you make? (Give an overview)
Added
no-nonoctal-decimal-escape
rule, which disallows\8
and\9
in string literals.Is there anything you'd like reviewers to focus on?