简体   繁体   中英

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.

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 .

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.

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.

To solve this issue, you can go to Settings -> Leanguages & Frameworks -> Javascript and check what value is set there. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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