![](/img/trans.png)
[英]How to selectively enable eslint rules from eslint-config-airbnb
[英]How to deal with conflicting eslint rules in AirBNB configuration
我是一个尝试在 Vue 中编写 POC 的菜鸟。 我在 AirBNB 配置中使用 ESLint,但遇到了冲突。
这是我的 Axios 调用的错误捕获部分:
.catch((error) => {
errorMsg.value = error;
console.log('Error is ' + error);
console.log(`Error is {error}`);
});
这是我收到的 linter 错误:
50:21 error Unexpected string concatenation prefer-template
51:21 error Strings must use singlequote quotes
✖ 2 problems (2 errors, 0 warnings)
由于这两个相互冲突的规则,我似乎无法获得我想要的输出。 我究竟做错了什么?
JS 中的字符串插值需要$
符号。 所以你应该使用:
.catch((error) => {
errorMsg.value = error;
console.log('Error without interpolation'); // Single quotes for simple strings
console.log(`Error is ${error}`); // Template for interpolation
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.