[英]How to deal with conflicting eslint rules in AirBNB configuration
I'm a noob trying to write a POC in Vue.我是一个尝试在 Vue 中编写 POC 的菜鸟。 I'm using ESLint with the AirBNB configuration, and am running into a conflict.我在 AirBNB 配置中使用 ESLint,但遇到了冲突。
Here is the error catching part of my Axios call:这是我的 Axios 调用的错误捕获部分:
.catch((error) => {
errorMsg.value = error;
console.log('Error is ' + error);
console.log(`Error is {error}`);
});
And here is the linter errors I am receiving:这是我收到的 linter 错误:
50:21 error Unexpected string concatenation prefer-template
51:21 error Strings must use singlequote quotes
✖ 2 problems (2 errors, 0 warnings)
Because of these two conflicting rules, it appears I cannot get the output I want.由于这两个相互冲突的规则,我似乎无法获得我想要的输出。 What am I doing wrong?我究竟做错了什么?
String interpolation in JS requires a $
sign. JS 中的字符串插值需要$
符号。 So you should be using:所以你应该使用:
.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.