- 报错信息一:
ESLint: Missing return type on function.(@typescript-eslint/explicit-module-boundary-types) 解决方法:在.eslintrc.js 里面加如下代码
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off"
},
- 报错信息二:
ESLint: Type string trivially inferred from a string literal, remove type annotation.(@typescript-eslint/no-inferrable-types) 解决方法:在.eslintrc.js 里面加如下代码
"rules": {
"@typescript-eslint/no-inferrable-types": "off"
},
- 报错信息三:
ESLint: Require statement not part of import statement. eslint@typescript-eslint/no-var-requires 解决方法:在.eslintrc.js 里面加如下代码
"rules": {
'@typescript-eslint/no-var-requires': 0
},
- 报错信息四:
ESLint: Forbidden non-null assertion.(@typescript-eslint/no-non-null-assertion) 解决方法:在.eslintrc.js 里面加如下代码
"rules": {
'@typescript-eslint/no-non-null-assertion': 'off'
},
- 报错信息五:
ESLint: 'xxx' is not defined.(no-undef) // 说明全局变量未定义 解决方法:在.eslintrc.js 里面加如下代码块
"rules": {
...
},
"globals":{
"xxx": true // xxx 为你的全局变量
},
原文出处链接:blog.csdn.net/qq_49575831…