Board Thread:General Coding Help/@comment-29826282-20161230193523/@comment-11733175-20161231125512

ES6 is largely designed to be backwards compatible. While the end result will be invalid when running in older browsers, IE6 for example, the syntax itself is considered valid by the validator used by MediaWiki.

I don't know the ins and out of the validator, which I think is tied into the minification process to some extent, but I would suspect there is simply no rule that says const is invalid, while there is a rule that says let is. As it's there to catch things incompatible with ES3, the designer of the validator was most likely pre-occupied with making sure features in ES5 were backwards compatible with ES3 and largely didn't bother making sure ES6 was the same.

It's worth noting that pretty much all ES3 browsers are no longer supported, in terms of JavaScript, in MediaWiki core. However, that only resulted in shims and hacks for IE being removed rather than improving the JS validator afaik.

For now, I would make your code ES5 compliant and largely ignore ES6 for MediaWiki. It's not ideal, but unless someone can put pressure on Wikia to improve and it's in their interests to do so, chances are nothing will help.