[wp-trac] [WordPress Trac] #63077: JSHint config still requires esversion 6 which blocks use of async functions

WordPress Trac noreply at wordpress.org
Fri Mar 7 17:43:48 UTC 2025


#63077: JSHint config still requires esversion 6 which blocks use of async
functions
------------------------------+--------------------
 Reporter:  westonruter       |      Owner:  (none)
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  6.9
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:
  Focuses:  javascript        |
------------------------------+--------------------
 In a [https://github.com/WordPress/wordpress-develop/pull/8370 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 [https://github.com/WordPress/wordpress-
 develop/pull/4562/commits/bd2a5c4233636a40abd90502eb7de321a107543e
 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 [https://caniuse.com/async-functions 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
 ([https://github.com/WordPress/WordPress/blob/294aaff4e69f894e32db3d9a684ffefcffc78bd5
 /wp-includes/js/dist/script-modules/interactivity/index.js#L2547
 example]).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63077>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list