ES6的箭头函数和解构都无法支持,在他内置的eslint插件上面始终是报错的
请问有谁折腾成功了么
npm install -g eslint
npm install --save-dev babel-eslint
npm install --save-dev eslint-plugin-react
{
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true,
"jquery": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": true,
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"octalLiterals": true,
"regexUFlag": true,
"regexYFlag": true,
"spread": true,
"superInFunctions": true,
"templateStrings": true,
"unicodeCodePointEscapes": true,
"globalReturn": true,
"jsx": true,
"experimentalObjectRestSpread": true
}
},
"plugins": [
"react"
],
"rules": {
"strict": 0
}
}
5.关闭vscode的语法验证:"javascript.validate.enable" : false
你装的是jshint不是eslint
eslint显示如下:
首先编辑eslint配置文件 .eslintrc
然后安装以下模块:
然后应该就可以了。