I'm a noob trying to write a POC in Vue. I'm using ESLint with the AirBNB configuration, and am running into a conflict.
Here is the error catching part of my Axios call:
.catch((error) => {
errorMsg.value = error;
console.log('Error is ' + error);
console.log(`Error is {error}`);
});
And here is the linter errors I am receiving:
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. 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
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.