【问题标题】:Nodeclipse not recognizing generator functionsNodeclipse 无法识别生成器功能
【发布时间】:2015-11-19 17:49:34
【问题描述】:

首先,我使用 --harmony 标志启动 Node。我在 Eclipse “Preferences > Nodeclipse > node options”中设置了这个标志

问题显示在 .js 文件本身中。

例如,我的一个控制器中有一个生成器方法...

show: function* () { ... }

Nodeclipse 在所有带有生成器函数的 .js 文件上都显示错误。 它显示带有消息的红色“x”...

Syntax error on "*".  Delete this token.

由于我使用的大多数节点模块都具有生成器功能,因此我在项目中出现了大约 500 个错误。

有人知道如何解决这个问题吗?

【问题讨论】:

标签: javascript generator nodeclipse


【解决方案1】:

a) 获取 Nodeclipse 1.1 http://www.nodeclipse.org/history

b) 手动操作:

移除 .project 中的 JSDT 属性

    <nature>org.eclipse.wst.jsdt.core.jsNature</nature>

在 .jshintrc 中启用 ES6

"esnext" : true, // Allow ES.next (ECMAScript 6) specific features such as `const` and `let`.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-18
    • 1970-01-01
    • 1970-01-01
    • 2021-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-18
    相关资源
    最近更新 更多