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
Proposed new rule: wrong-quotes-for-template-string #6186
Comments
Duplicate of #5850 |
Damn. I searched to make sure I wasn't creating a duplicate issue, but forgot to search closed issues. So, since #5850 has been closed, does that mean this rule won't get implemented? Or is there still a chance? I know it's a bit anecdotal, but I've seen this mistake bite myself and some other devs on my team quite a few times. |
Okay, we need a champion and two more 👍 @BigstickCarpet if accepted, we will ask you to try to implement it yourself (see http://eslint.org/docs/developer-guide/contributing/new-rules#implementation-is-your-responsibility for details). The core team just doesn't have the time to implement every rule that is suggested. |
I'm willing to implement the rule if this gets accepted. |
I'll support this. Seems like a good rule to have. 👍 |
I'll give a 👍 but we still need a champion to shepherd this through the process. |
I might be willing to implement this if we can find a champion. |
I'm a champion. (and we need one more 👍) |
Looks like @michaelficarra have a 👍 On the issue, so marking as accepted. |
Hooray, glad this is finally going to be added :-D |
Ah, I didn't see @jfmengels' comment earlier. Still want to implement? I'm out of town for a week so I won't try to stake a claim here 😄 |
Yes :) I'll try to take a stab at it tonight. |
When does this rule warn? Please describe and show example code:
This rule would warn when a string appears to use ES6 template string variable substitution, but isn't using a backtick quotes. The goal is to eliminate an easy code mistake, such as the following:
This code would warn:
This code would not warn:
Is this rule preventing an error or is it stylistic?
This rule aims to prevent a common ES6 coding mistake. It's easy to mistakenly use the wrong quotes (e.g. double-quotes instead of backticks) for a template string. When this happens, the code lints and runs perfectly fine, but at runtime, the string value will contain the raw
"${name}"
rather than the variable value"John Doe"
.Why is this rule a candidate for inclusion instead of creating a custom rule?
This is a rule that would benefit everybody who is using ES6 template strings. It's not limited to a specific framework or platform.
Are you willing to create the rule yourself?
Maybe. Not sure how hard it would be.
The text was updated successfully, but these errors were encountered: