Open eiowlta opened 2 years ago
It may just be a matter of changing the jshint configuration at https://github.com/espruino/EspruinoWebIDE/blob/master/js/core/editorJavaScript.js#L16-L21
edit: but you can't just bump the ES version because then it won't warn about some features that aren't implemented.
I disabled code hints in the settings just to test. The error squiggles do go away but the console still gives an error when uploading.
Error parsing JavaScript, but uploading anyway. SyntaxError: Unexpected token (50:24)
It seems the version of acorn you're using doesn't support the operator, so it would have to be updated and then both the linter and acorn would have to be configured to only allow the features we support, if that's even possible.
A quick scan suggests async, exponentiation and spread would also need to be implemented, along with the standard library additions, in order to bring it up to parity with ES11 if we wanted to go that route instead. I definitely wouldn't mind tackling some of those when I get the time.
Ahh - good point about Acorn. I imagine even if Jshint doesn't natively support turning on/off individual features it should be possible to tweak it quite easily.
A quick scan suggests async, exponentiation and spread would also need to be implemented, along with the standard library additions, in order to bring it up to parity with ES11 if we wanted to go that route instead
In Espruino itself? There are some issues open on the main Espruino GitHub for some of these, but while exponentiation would be trivial, some others could be very hard to implement. Async especially is likely not even possible (apart from in simple cases) given the way Espruino runs as it parses (rather than compiling to bytecode)
Nullish coalescing support was added to espruino in 2v14 but the editor still considers it a syntax error. Editor is v0.76.1.