My Vuejs project includes a component with the following mounted method:
mounted() {
try {
let x = 'abc';
console.log(x);
let body = <HTMLElement> document.querySelector("body");
} catch (e) {
console.log(e);
}
}
The compilation process using vue-cli-service lint is failing with this error:
Parsing error: Unexpected token, expected "}"
console.log(e);
......................^
My eslintrc.js configuration looks like this (using babel-eslint as the parser):
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/essential',
],
rules: {
quotes: ['error', 'single']
},
parserOptions: {
parser: 'babel-eslint',
}
};
These are the dependencies listed in package.json:
"dependencies": {
// List of dependencies
},
"devDependencies": {
// List of dev dependencies
}
What could be causing this issue? When I run eslint file_path, I get the same error message.