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
Fix: prefer-template autofix produces syntax error with octal escapes #12085
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, but would like another set of eyes on this before merging. Thanks!
Reproduction:
Marking as accepted. |
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. I actually didn't know about this restriction and had to go do some reading. Thanks for contributing and for the learning opportunity!
What is the purpose of this pull request? (put an "X" next to item)
[X] Bug fix
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
Not a syntax error in autofix.
What actually happened? Please include the actual, raw output from ESLint.
Parsing error: Octal literal in template string
Parsing error: Octal literal in template string
What changes did you make? (Give an overview)
Made a new regex in
astUtils
, which fixes two bugs:\0
were missed (e.g."\0 \1"
). This bug was probably inherited fromno-octal-escape
(fixed there in Update: fix no-octal-escape false negatives after \0 #12079)"\08"
and"\09"
are octal escapes (Report '\08' and '\09' in no-octal-escape #12080) these two de facto produce parsing errors in template literals.Is there anything you'd like reviewers to focus on?
I'll also fix the
quotes
rule in another PR when this gets merged.