6
votes

The error is because of this line of code

item.component = () => import(`@/views/${_component}`)

If I modify .eslintrc.js, it works

'indent' : "off",
'template-curly-spacing' : "off",

But this way, eslint won't help me format the code

when I run the following code, He can't work, but eslint has no errors:

item.component = () => import(`@/views/` + _component)
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
"eslint": "5.15.3",

node -v: v12.9.1

eslint -v: v6.8.0

vscode

1

1 Answers

6
votes

Try setting your eslint indent rule to contain: ignoredNodes for template literals. My eslintrc.js has the following:

rules: {
  indent: [2, "tab", { 
    ignoredNodes: ["TemplateLiteral"] 
  }],
  ... etc ...
}

That will ignore extended template literals.

If the above doesn't work, try deleting: package.json and node_modules then re-install with npm i or yarn.