2017-06-18 159 views
0

爲什麼eslint會拋出這個錯誤? JavaScript在React Native內運行時沒有問題。 https://reactnavigation.org/docs/intro/eslint解析錯誤:意外的令牌=

使用Javascript::代碼從反應導航例如在截取

static navigationOptions = { header: null }; 

eslint錯誤:

error Parsing error: Unexpected token = 

.eslintrc.js文件:

module.exports = { 
    "extends": "standard", 
    "plugins": [ 
     "react", 
     "react-native" 
    ] 
}; 
+0

是配置ES6您eslint? – amiramw

回答

6

的語法尚未標準化,但是包含在Javascript中的階段2提案(請參見「類字段」 「在https://github.com/tc39/proposals)。

嘗試增加上述 「擴展」 下列選項中您.eslintrc.js:

"parser": "babel-eslint",