eslint解析错误:意外令牌= [英] eslint Parsing error: Unexpected token =

查看:165
本文介绍了eslint解析错误:意外令牌=的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么eslint会引发此错误? Javascript在React Native内部运行没有问题。该代码取自react-navigation示例: https://reactnavigation.org/docs/intro/

Why is eslint throwing this error? The Javascript runs without issue inside of React Native. The code was taken from the react-navigation example at : https://reactnavigation.org/docs/intro/

Javascript:

Javascript:

static navigationOptions = { header: null };

错误提示:

error  Parsing error: Unexpected token =

.eslintrc.js文件:

.eslintrc.js file:

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


推荐答案

语法尚未标准化,但阶段2个包含在Javascript中的提案(请参见 https://github.com/tc39/proposals)。

The syntax is not yet standardised, but a stage-2 proposal for inclusion in Javascript (see "Class Fields" on https://github.com/tc39/proposals).

尝试在.eslintrc.js中的扩展上方添加以下选项:

Try adding the following option above "extends" in your .eslintrc.js:

"parser": "babel-eslint",

这篇关于eslint解析错误:意外令牌=的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆