-
Notifications
You must be signed in to change notification settings - Fork 0
CodeMirror: Esprima to Espree for JavaScript validation #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CodeMirror: Esprima to Espree for JavaScript validation #4
Conversation
This reverts commit f108a38. Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request successfully migrates the JavaScript validation from Esprima to Espree, which is a significant improvement for supporting modern JavaScript (ES6+). The changes are well-structured, including updates to package.json, a complete rewrite of fakejshint.js to use Espree's API, and necessary adjustments to Webpack configuration and script loading. The introduction of JSDoc comments and the use of modern JavaScript practices in fakejshint.js enhance code readability and maintainability. The updated JSHint options in general-template.php correctly reflect the new Espree capabilities and include essential global variables for modern environments.
|
80574f1 to
79e3ac0
Compare
|
/gemini summary |
Summary of ChangesThis pull request significantly upgrades the JavaScript validation capabilities within the CodeMirror editor by transitioning from the legacy Highlights
Changelog
Activity
|
9455469 to
fa9fa8c
Compare
|
Closing in favor of WordPress#10806 |
This is a sub-PR off of:
See Gemini summary below: #4 (comment)
Squashed commits WordPress#10778
ee2b6bd Editor: Switch from Esprima to Espree for JavaScript validation.
Replaces the outdated
esprimaparser withespreeto provide support for modern JavaScript (ES6+) validation in the code editor. A newespreescript handle is registered, and thefakejshintwrapper is updated to use it while maintaining theesprimahandle for backward compatibility.espreetopackage.json.tools/vendors/espree-entry.jsand adds a new Webpack entry point to bundleespree.fakejshint.jsto utilizewindow.espree.parsewith ES6+ support.espreeinscript-loader.phpand updatesjshinthandle dependencies.espree.Co-authored-by: Gemini
744f1c3 Omit CodeMirror license banner from Espree script
Co-authored-by: Copilot
cf742fa Build Tools: Target specific usebanner tasks in build processes.
Updates
build:cssto specifically invokeusebanner:filesandbuild:codemirrorto invokeusebanner:codemirror. This prevents the genericusebannertask from attempting to process files that have not yet been generated during the general CSS build phase.Co-authored-by: Gemini, Copilot
7db8792 Fix formatting of codemirror.config.js
Co-authored-by: Copilot
3d58f09 Use core version for jshint (fakejshint.js) since not an external dependency.
Co-authored-by: Copilot
6bc559f Remove duplicate extractComments key
Unprops Copilot for 7db8792
Co-authored-by: Copilot
ee0d1ec Add line break at EOF
676b088 Remove esprima-specific tolerant error collection (which espree does not support)
d3d5a56 Modernize fakejshint
Remove extraneous new to fix JSHint: Weird construction. Is 'new' necessary? (W057)
1b15d2c Add typing and encapsulate in IIFE
a88a606 Refactor fake-JSHint to pass esversion and better support Espree options
2263035 Improve jsdoc
b48e38a Fix options handling in fakejshint.js.
Updates the
fakejshint.jsvendor shim to correctly store the provided options incurrentOptionsduring parsing. Previously,fakeJSHINT.data().optionswould always return the initial empty object, failing to reflect the actual configuration used.This commit also:
getEcmaVersion()by removing unnecessaryelseblocks.optionsparameter as optional.Co-authored-by: Gemini
90551e7 Add link to JSHint API docs
09e7731 Add use strict
fc23471 Eliminate needless enumeration of numbers in esversion
534b297 Add missing boolean return for JSHINT for whether valid
Co-authored-by: Gemini
3048f37 Ensure generic Espree error results in warning logged to console