-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Update: check template literal in yoda (fixes #12863) #12876
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.
The code looks good. Can you please update the documentation too?
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.
Looks good! I left a couple of minor suggestions.
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, thanks!
Thanks for contributing! |
…2876) * Fix: check template literal in yoda (fixes eslint#12863) * fix JSDOC, typo, add test cases * add test cases * update the documentation * Edit jsdoc * Add test case
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[x] Bug fix (template)
[ ] 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:
What changes did you make? (Give an overview)
I added checking for template literals, which have no expressions.
Is there anything you'd like reviewers to focus on?
In the actual version(
v6.8.0
), a comparison between a literal and expression is warned, even if operands in the expressions are consist of literals only.Online Demo
From this point of view, I think template literal with only literal expressions should be warned, so added these test cases.
But I'm not sure whether it is intended behavior or not.