一、‘module’ is not defined (no-undef)
出现小括弧no-XXX(no-undef、no-mixed-spaces-and-tabs)类似的报错,在.eslintrc.js配置文件的rules里添加对应的配置,‘no-XXX’: ‘off’。如:
###双引号或者单引号均可
'no-undef': 'off',
'no-mixed-spaces-and-tabs': 'off',
二、console.log报错
console.log改成window.console.log()
window.console.log()
三、Parsing error: Unexpected token import at
①先下载cnpm i -d @typescript-eslint/parser --legacy-peer-deps
添加–legacy-peer-deps是为了忽视依赖冲突,我这里使用cnpm,因为之前添加了镜像,如果不行的话可以试试npm
②修改.eslintrc.js配置,如下
"parser": "vue-eslint-parser",
"parserOptions": {
"parser":"babel-eslint",
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
}