意外的标记=箭头使用StandardJS的函数(Unexpected token = for a arrow Function using StandardJS)

编程入门 行业动态 更新时间:2024-10-11 11:13:48
意外的标记=箭头使用StandardJS的函数(Unexpected token = for a arrow Function using StandardJS)

标准JS为什么说sign =是一个意外的令牌? 我正在使用PhpStorm。

代码工作得很好,我只是按照https://github.com/whoisandy/react-rangeslider的教程,得到了这个错误。

handleOnChange = (value) => { this.setState({ volume: value }) }

Why the Standard JS is saying that the sign = is a unexpected token? I'm using PhpStorm.

The code works perfectly, I'm just following the tutorial from https://github.com/whoisandy/react-rangeslider and got this error.

handleOnChange = (value) => { this.setState({ volume: value }) }

最满意答案

错误来自Standard linter,而不是来自PHPStorm解析器,这就是为什么在首选项中更改JavaScript language version没有帮助...您正在使用ES7提议进行类属性( https://github.com/tc39/proposal-class-public - 场 )。 但它还不是任何规范的一部分,标准linter使用的解析器不支持它。 您需要在此处使用不同的解析器 - 请参阅https://standardjs.com/#how-do-i-use-experimental-javascript-es-next-features

Error comes from Standard linter, not from PHPStorm parser, that's why changing JavaScript language version in preferences doesn't help... You are using ES7 proposal for class properties (https://github.com/tc39/proposal-class-public-fields). But it's not yet a part of any spec, and the parser used by Standard linter doesn't support it. You need using a different parser here - see https://standardjs.com/#how-do-i-use-experimental-javascript-es-next-features

更多推荐

本文发布于:2023-07-27 15:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1292336.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:箭头   函数   标记   意外   arrow

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!