[wp-trac] [WordPress Trac] #64661: Code Editor: Linting runs twice at initialization

WordPress Trac noreply at wordpress.org
Tue Feb 17 21:31:31 UTC 2026


#64661: Code Editor: Linting runs twice at initialization
--------------------------+-----------------------
 Reporter:  westonruter   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  7.0
Component:  General       |    Version:  4.9
 Severity:  normal        |   Keywords:  has-patch
  Focuses:                |
--------------------------+-----------------------
 As [https://github.com/WordPress/wordpress-
 develop/pull/10806#discussion_r2787837736 reported] by @jonsurrell:

 > I added some logging here (`console.log( 'Parsing with: %o',
 getEspreeOptions( options ) )`) to understand the options and I noticed
 something (note this is with https://github.com/westonruter/wordpress-
 develop/pull/5 so adds `module` config).
 >
 > The plugin linting seems to be triggered twice, once with what appear to
 be defaults and again with the expected config. This creates a race, where
 sometimes on load this is printed:
 >
 > {{{
 > Parsing with: {ecmaVersion: 'latest', sourceType: 'script',
 ecmaFeatures: {…}}
 > Parsing with: {ecmaVersion: 11, sourceType: 'module', ecmaFeatures: {…}}
 > }}}
 >
 > And the lint is performed as expected. However, sometimes this is the
 order and the default linting is applied:
 >
 > {{{
 > Parsing with: {ecmaVersion: 11, sourceType: 'module', ecmaFeatures: {…}}
 > Parsing with: {ecmaVersion: 'latest', sourceType: 'script',
 ecmaFeatures: {…}}
 > }}}
 >
 > This does seem to be happening before this PR, but it seems very
 consistent. I'm always seeing it run lint with the desired options second.

 This is a follow-up to the work to upgrade CodeMirror to the latest v5
 (#48456) and to using Espree instead of Espree for JS linting (#64558).

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


More information about the wp-trac mailing list