[wp-trac] [WordPress Trac] #48456: Update CodeMirror to latest v5 version
WordPress Trac
noreply at wordpress.org
Tue Jan 27 07:16:38 UTC 2026
#48456: Update CodeMirror to latest v5 version
-------------------------------------------+--------------------------
Reporter: TobiasBg | Owner: westonruter
Type: enhancement | Status: accepted
Priority: normal | Milestone: 7.0
Component: External Libraries | Version: 4.9
Severity: normal | Resolution:
Keywords: early has-patch needs-testing | Focuses: javascript
-------------------------------------------+--------------------------
Comment (by westonruter):
In addition to the PR attached to this ticket, I've opened a sub-PR to
replace Esprima with Espree in the JavaScript linter:
https://github.com/westonruter/wordpress-develop/pull/4 This is important
because Esprima does not support ES6, so any scripts using `const`, `let`
and the like currently show up as syntax errors.
This deprecates the use of `fakejshint.js` while at the same time
registering `espree` as a //script module//. This then gets imported
dynamically by a new `javascript-lint.js` which replaces that module in
the CodeMirror build. Note that since classic scripts cannot explicitly
depend on script modules (#61500), this is currently implemented as a bit
of a hack. A new `wp-codemirror` script module is registered with an empty
string `src`. This module has `espree` added as a dynamic dependency. The
empty string has the effect of preventing the `wp-codemirror` script
module from being printed, while at the same time any of its dependencies
still get added to the `importmap`.
I expect to file a new ticket for this Esprima to Espree upgrade, once
CodeMirror v5 is upgraded.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48456#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list