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
.
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
.
-
5
Make sure the language level for the project is set to ES6 and not ES5. Go to
Settings->Languages & Frameworks->JavaScript
and set it to ECMAScript 6. – Randy Casburn Commented Jul 18, 2019 at 13:20 - A semicolon is optional in es6+. If you are coding es5, you should consider warning. Otherwise, change the javascript version in the Editor to get rid of this warning. – Artin Falahi Commented Jul 18, 2019 at 13:26
1 Answer
Reset to default 4this 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.