【发布时间】:2019-05-09 14:08:31
【问题描述】:
我正在尝试将 @babel/plugin-proposal-private-methods 插件与 ESLint 一起使用,但是,任何使用新功能的代码都会导致此错误:
ESLint:解析错误:此实验性语法需要启用解析器插件:'classPrivateMethods'
根据这个错误消息,应该在哪里启用这个插件并不是很明显,而且我找不到任何关于如何将“解析器插件”添加到我的.eslintrc 的说明(如下所示)。
{
"parser": "babel-eslint",
"env": {
"browser": true,
"jquery": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"plugins": [
"react"
],
"parserOptions": {
"sourceType": "script",
"ecmaVersion": 6,
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"camelcase": 0,
"curly": 0,
"wrap-iife": [
2,
"any"
],
"linebreak-style": 2,
"comma-style": [
2,
"last"
],
"new-cap": 2,
"strict": [
2,
"function"
],
"no-undef": 2,
"no-unused-vars": 0,
"no-console": 0,
"react/prop-types": 0
}
}
如何启用此解析器插件?
【问题讨论】:
标签: javascript babeljs eslint