节点模块使用静态道具:EsLint - 无法在JavaScript文件
- EsLint 1.10.3
- 巴贝尔-EsLint 4.1.6
- Eslint-插件反应的3.15.0
示例文件被LINTED:
class NotepadComponent extends React.Component {
static displayName = 'NotepadComponent'
static defaultProps = {
activeTab: 'type'
}
}
在命令行下,我可以使用babel进行lint和transpile,没有任何问题。问题是试图从视觉工作室绒毛。我正在使用内部使用esLint的Web Analyzer plugin。
这Visual Studio的模块定义C:\Users\My-Username
下一个.eslintrc
文件,我已经先行一步,并更新了这个文件,主文件夹,使用此配置node_modules:
"parser": "babel-eslint",
"ecmaFeatures": {
"jsx": true,
"classes": true
},
"plugins": [
"react"
],
"env": {
"browser": true,
"node": true,
"es6": true,
"jquery": true
},
但我仍然得到“JSX分析器:意外的令牌=“错误:
有关使Web Analyzer的行为与命令行工具相同的任何想法?
static关键字是ecmascript 2015定义的一部分:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static – amhed