Add MJS and sourceType: module support#5
Conversation
Summary of ChangesHello @sirreal, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive support for JavaScript module files (.mjs) across WordPress's file handling and code editing functionalities. By recognizing .mjs as an editable extension, configuring JSHint for module grammar, and correctly assigning its MIME type, the changes align WordPress with modern JavaScript module standards, improving developer experience when working with modular JavaScript. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for .mjs files, allowing them to be recognized as editable files and correctly handled as JavaScript modules by the code editor's linter. The changes are generally good, but I've found a couple of areas for improvement. There's an inconsistency where .mjs support is added for plugins but not for themes. Additionally, there's a minor code simplification that can be made in one of the new conditions.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for .mjs (JavaScript module) files within the WordPress file editor. The changes correctly add the .mjs extension to the list of editable file types for both plugins and themes. Additionally, it configures the code editor to handle .mjs files appropriately by setting the JSHint module option to true for these files and assigning the correct text/javascript MIME type for CodeMirror syntax highlighting. The implementation is clean, targeted, and effectively achieves the goal of adding .mjs support. The changes look good.
Builds on WordPress#10806 to add
.mjsmodule support.Checking the extension for module grammar aligns with IANA media type definition:
This can be merged into the existing PR or considered on its own.