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

New: Add no-nonoctal-decimal-escape rule (fixes #13765) #13845

Merged
merged 3 commits into from Nov 20, 2020

Conversation

@mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Nov 15, 2020

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?

nzakas
nzakas approved these changes Nov 19, 2020
Copy link
Member

@nzakas nzakas left a comment

LGTM. Just one note in the docs.

Loading

@@ -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:
Copy link
Member

@nzakas nzakas Nov 19, 2020

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?

Loading

Copy link
Member Author

@mdjermanovic mdjermanovic Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, done!

Loading

Copy link
Member

@btmills btmills left a comment

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

Loading

@mdjermanovic mdjermanovic merged commit 98c00c4 into master Nov 20, 2020
13 checks passed
Loading
@mdjermanovic mdjermanovic deleted the no-nonoctal-decimal-escape branch Nov 20, 2020
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants