简体   繁体   English

WebStorm 上出现换行符或分号错误

[英]Expecting newline or semicolon error on WebStorm

After having done a bad manipulation on WebStorm, I now have errors such as expecting newline or semicolon". For example after an async or await . Even having disabled all my rules in Languages Injections I still have the same problem.在对 WebStorm 进行了错误操作后,我现在遇到了诸如期望换行或分号之类的错误。例如在asyncawait 。即使在Languages Injections中禁用了我的所有规则,我仍然遇到同样的问题。

Followed this topic关注了这个话题

async function reactEmoji(msg, index) {
  index = index - 1
  for (let i = 0; i < index; i++) {
      let emojiElement = emoji[i]
      await msg.react(emojiElement)
  }
}

Between async and function , I've got this error : Expecting newline or semicolon .asyncfunction ,我遇到了这个错误: Expecting newline or semicolon

this can be caused by a lot of different issues.这可能是由许多不同的问题引起的。 One of the most likely ones is that your language is set to ES5 instead ES6, or even something else.最有可能的情况之一是您的语言设置为 ES5 而不是 ES6,甚至其他语言。

Old versions of javascript don't even know the async keyword, resulting in an error between async and function, as async is an unknown variable at this point.旧版本的 javascript 甚至不知道async关键字,导致 async 和 function 之间出现错误,因为此时 async 是一个未知变量。

To solve this issue, you can go to Settings -> Leanguages & Frameworks -> Javascript and check what value is set there.要解决此问题,您可以转到Settings -> Leanguages & Frameworks -> Javascript并检查那里设置的值。 I suppose you'll want to set this to ECMAscript 6 if you are using a transpiler, else you would probably want ES2015/ECMAscript 5.如果您使用的是转译器,我想您会希望将其设置为ECMAscript 6 ,否则您可能需要 ES2015/ECMAscript 5。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM