#63077 closed defect (bug) (fixed)
JSHint config still requires esversion 6 which blocks use of async functions
| Reported by: | westonruter | Owned by: | westonruter |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.9 |
| Component: | Build/Test Tools | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | javascript |
Description
In a PR which includes an async function, there is a JS coding standards check failure:
34 | const setTemporaryViewTransitionNames = async ( entries, vtPromise ) => {
^ 'async functions' is only available in ES8 (use 'esversion: 8').
Back in #58472 I had previously tried to use async functions but ultimately at that time I refactored to use promises to unblock it it.
I think it's time to revisit the JSHint configuration to bump the esversion to 8 or higher in core. ES8 includes async functions which caniuse reports as being supported by 97% of users, where only IE11 doesn't support them. Async functions are also being used in Gutenberg packages which are not transpiled to ES5 to use Promises (example).
Change History (6)
This ticket was mentioned in PR #8472 on WordPress/wordpress-develop by @westonruter.
18 months ago
#2
- Keywords has-patch added
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/63077
This bumps the
esversionconfig in.jshintrcto version 10. This includes support for the following features:Note that for ES10 the notable addition is optional catch bindings. According to caniuse, this is supported by >95% of users globally. The feature was implemented in Chrome 66, Safari 11.1, and Firefox 58--all of which were released in 2018.