Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nullish coalescing support to WebIDE #271

Open
eiowlta opened this issue Jul 15, 2022 · 3 comments
Open

Add nullish coalescing support to WebIDE #271

eiowlta opened this issue Jul 15, 2022 · 3 comments

Comments

@eiowlta
Copy link

eiowlta commented Jul 15, 2022

Nullish coalescing support was added to espruino in 2v14 but the editor still considers it a syntax error. Editor is v0.76.1.

@gfwilliams
Copy link
Member

gfwilliams commented Jul 15, 2022

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.

@eiowlta
Copy link
Author

eiowlta commented Jul 15, 2022

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.

@gfwilliams
Copy link
Member

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants