T381537: Raise Grade A JavaScript requirement from ES2016 (ES7) to ES2017 (ES8) | T419142: Raise Grade A JavaScript requirement from ES2017 to ES2019 (ECMAScript 10)
What
This ticket is to raise the Grade A requirement for the Modern JS layer from ES2017 to the next milestone ES2018 (ECMAScript 9).
Why
This will allow MediaWiki JavaScript code to use the following syntax, internal functions, and other features, improving the developer experience:
- ES2018
- asynchronous iteration for await () {}
- async generator functions and methods like async function * makeApiRequestsAndFollowContinuation()
Promise.finally()already required by our ES6 feature test (but make sure to only use it on native promises, as jQuery deferrerds don’t support it)- spread operator for objects {... }
- RegEx /s flag (aka "dotAll")
- RegEx lookbehind (?<= ) (?<! )
- RegEx named capture groups
- RegEx Unicode property escapes \p{...}
Blockers
- Peast validator: already supports any ES version upto ES2024
- JavaScriptMinifier support for ES2018 syntax: T386530: Add native support for ES2018-ES2020 to the minifier
- 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 T381537 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 ES2018. 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 ES2018
- update Peast calls in Module::validateScriptFile(), maintenance/benchmarks/benchmarkJsValidate.php, and bump USERJSPARSE_CACHE_VERSION
- CodeMirror: update JavaScriptValidator to allow ES2018
- Documentation:
- Update https://www.mediawiki.org/wiki/Compatibility
- Draft an entry for Tech News https://meta.wikimedia.org/wiki/Tech/News/2026/33


