節點模塊使用靜態道具: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