I'm able to use the latest versions of Chrome, Firefox, and Edge (Chromium) with Tampermonkey and they all support using const
in my userscript. However, for Opera 73.0.3856.284 with Tampermonkey 4.11.6120, I'm getting an error, "eslint: null - Parsing error: The keyword 'const' is reserved". While I know I can use var
or let
I was wondering if there was a specific reason that was causing this error. My userscript is inteded to be cross-browser and I was hoping if there was a way to use const without getting this error. The image below is just a userscript I made with only const to show the error:
Edit: I ran a test userscript with this code:
const x = 2;
alert(x);
and the alert gave 2. Thus, I suspect that the code is running fine, but this is an internal error by Tampermonkey. In fact, I strongly believe this to be the case as I just saw this issue: https://github.com/Tampermonkey/tampermonkey/issues/1099