T395347: Raise Grade A JavaScript requirement from ES2017 to ES2018 (ECMAScript 9) | T429706: Raise Grade A JavaScript requirement from ES2019 to ES2020 (ECMAScript 11)
What
This ticket is to raise the Grade A requirement for the Modern JS layer from ES2018 to the next milestone ES2019 (ECMAScript 10).
Why
This will allow MediaWiki JavaScript code to use the following syntax, internal functions, and other features, improving the developer experience:
- ES2019
- string trimming: String.trimStart()/String.trimEnd()
- Object.fromEntries
- Optional catch Binding
- Array.flat() and flatMap()
Blockers
- Peast validator: already supports any ES version upto ES2024
- JavaScriptMinifier support for ES2019 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. Signoff from MediaWiki 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 ES2019. https://github.com/wikimedia/eslint-config-wikimedia/pull/664
- 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 ES2019
- update Peast calls in Module::validateScriptFile(), maintenance/benchmarks/benchmarkJsValidate.php, and bump USERJSPARSE_CACHE_VERSION
- CodeMirror: update JavaScriptValidator to allow ES2019
- Documentation:
- Update https://www.mediawiki.org/wiki/Compatibility#General_information
- Draft an entry for Tech News https://meta.wikimedia.org/wiki/Tech/News/2026/33