[英]ESLint Double Quotes in double quotes
I am using ESLint to format my Javascript code.我正在使用 ESLint 格式化我的 Javascript 代码。 There I have the following piece of code:
我有以下代码:
'<div id="' + sId + '" '; ...
I get an ESLint warning telling me 'Strings should use double quotes', so I went ahead and changed the surrounding single quotes to double quotes and escaped the inner double quote.我收到一个 ESLint 警告,告诉我“字符串应该使用双引号”,所以我继续将周围的单引号更改为双引号,并转义了内部双引号。 This lead to an ESLint error, which suggested I use the single quotes exactly as you see above.
这会导致 ESLint 错误,这表明我完全按照您在上面看到的那样使用单引号。
Is there a way to solve this conflict so that I don't get the error or the warning?有没有办法解决这个冲突,这样我就不会收到错误或警告? Info: I am stuck with ES5.
信息:我被 ES5 困住了。
Many thanks in advance!提前谢谢了!
You can:你可以:
"<div id=\"" + sId + "\" ";
)"<div id=\"" + sId + "\" ";
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.