Steps to reproduce:
- Open your Special:MyPage/common.js for editing, add the code
var val, a = ['a', 'b']; for (val of a) { console.log(val); }
- Preview your change. The console should show "a" and "b" (given your browser support that much of ES6, but most browsers should, by now).
- Save the page.
Expected result: Same as step 2.
Actual result: The code from common.js is replaced with code that just throws an error:
Error: JavaScript parse error: Parse error: Unexpected token; token ; expected in file 'Benutzer:Schnark/common.js' on line 5
While for the site wide MediaWiki:Common.js etc. this is a good feature (to make sure nobody accidentally puts in some ES6 features only available in their browser but not in other users' browser), for personal JS a user should not be prevented from using features supported by their browser.
Status
"[As of April 2021] the JS syntax checker blocks use of ES6 in (i) gadgets, (ii) sitewide JS pages and (iii) user common.js page. "
Workaround
See T75714#4674421. Gist: deactivating the js validators is possible but has risks.