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

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?

@mdjermanovic mdjermanovic added rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion feature This change adds a new feature to ESLint labels Nov 15, 2020
Copy link
Member

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

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, done!

Copy link
Member

@btmills btmills left a 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

@mdjermanovic mdjermanovic merged commit 98c00c4 into master Nov 20, 2020
@mdjermanovic mdjermanovic deleted the no-nonoctal-decimal-escape branch November 20, 2020 11:46
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators May 20, 2021
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion feature This change adds a new feature to ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New rule proposal: no-nonoctal-decimal-escape
3 participants