In order to use optional catch binding, I need to use ES10. So I set Visual Studio Code to esversion: 10. However, the settings.json keeps giving me the Problem "Value is not accepted. Valid values: 3, 5, 6, 7, 8, 9."
JSHint docs specifically name esversion 10: see https://jshint.com/docs/options/
Does anyone know why esversion 10 is not accepted in VSCode, and even better, how to change that?
Settings.json file is at C:\Users<username>\AppData\Roaming\Code\User, if you don't get to it via File>Preferences>Settings. Seach for "jshint" and it will give you a link to Edit in settings.json.
It seems that the JSHint extension for Visual Studio Code does not get up to date with every JSHint update. For example, if you write "esversion": 10 (or even "esversion": 15 !!!) in the settings.json, the line gets a warning, as you describe, but code like optional catch binding is now allowed! So, "esversion": 10 is understood correctly, despite the warning.
Thus, one solution is to leave this warning in settings.json, but have JSHint working fine in every other file.
But, this is what I prefer (workaround, not solution):
In the settings.json file leave it "esversion": 9 and when you happen to need the optional catch binding or some other es10 feature, put in the top of this specific file:
/* jshint esversion: 10 */
You need to type this extra line, but now, there are no errors anywhere. Plus, this way you can see when you use any recent features, which may be anavailable to some users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With