T419142: Raise Grade A JavaScript requirement from ES2017 to ES2019 (ECMAScript 10) | T434710: Raise Grade A JavaScript requirement from ES2020 to ES2021 (ECMAScript 12)
What
This task is for raising the Grade A requirement for the Modern JS layer from ES2019 to the next milestone ES2020 (ECMAScript 11).
Why
This will allow MediaWiki JavaScript code to use the following syntax, internal functions, and other features, improving the developer experience:
- ES2020
- String.prototype.matchAll()
- 123n BigInt notation
- Promise.allSettled()
- ?? nullish operator
- ?. optional chaining operator
- extended import/export syntax (not applicable within MediaWiki)
Blockers
- Peast validator: already supports any ES version up to ES2024
- JavaScriptMinifier support for ES2020 syntax: T386530: Add native support for ES2018-ES2020 to the minifier
- Figure out what browsers we would drop out of Grade A because of this
- Browser market share for older browser versions is low enough. Sign-off from MediaWiki Core Platform Team. Maybe @Krinkle or @JTweed-WMF
Todo
Once unblocked: (see old ticket T395347 for patch examples)
- browserslist-config-wikimedia: Update modern.json reflect any decided change to the Compatibility policy (skip if Grade A was unchanged)
- eslint-config-wikimedia:
- Update "client" preset to allow ES2020
- Publish release to npm
- Update mediawiki/core to use the latest eslint-config-wikimedia
- Notify LibUp which will automatically upgrade other repos.
- ResourceLoader:
- Update startup.js to raise feature tests requirement to ES2020
- Update Peast calls in Module::validateScriptFile(), maintenance/benchmarks/benchmarkJsValidate.php, and bump USERJSPARSE_CACHE_VERSION
- CodeMirror: update JavaScriptValidator to allow ES2020
- Documentation:
- Update https://www.mediawiki.org/wiki/Compatibility
- Draft an entry for Tech News


