'import ``,ESLint: Cannot read property 'range' of null Occurred while linting
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
Solution 1:[1]
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-lock.json
and node_modules
then re-install with npm i
or yarn
. This will restore your packages and reset downline versions.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Todd Hale |