敲黑板!不是配置环境变量!
如果通过
解决方法
1.打开package.json
2.找到"eslintConfig"
3.新增"globals",新增自己需要的变量名称
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"globals":{
"AMap":true //这里添加变量名称
},
"extends": [
"plugin:vue/essential",
"@vue/standard"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
vue老项目配置
1.找到.eslintrc.js
2.新增"globals",新增自己需要的变量名称
// https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parser: 'babel-eslint',
globals:{
WebControl:true,
EZUIPlayer:true
},
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
},
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
extends: 'standard',
// required to lint *.vue files
plugins: [
'html',
'vue'
],
// add your custom rules here
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
}
}