From f2ee120404e8f6bf31141a9b7dc83edfa2f5b694 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Tue, 10 Feb 2026 12:30:40 +0100 Subject: [PATCH 1/3] Add MJS and sourceType: module support --- src/wp-admin/includes/file.php | 1 + src/wp-includes/general-template.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 610125b252ec0..33a9f2067bfeb 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -202,6 +202,7 @@ function wp_get_plugin_file_editable_extensions( $plugin ) { 'inc', 'include', 'js', + 'mjs', 'json', 'jsx', 'less', diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index 725f12b7c1b2b..e4596b1ede096 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -4152,6 +4152,7 @@ function wp_get_code_editor_settings( $args ) { ), 'jshint' => array( 'esversion' => 11, + 'module' => str_ends_with( $args['file'] ?? '', '.mjs' ) ? true : false, // The following JSHint *linting rule* options are copied from // . @@ -4239,6 +4240,7 @@ function wp_get_code_editor_settings( $args ) { $type = 'message/http'; break; case 'js': + case 'mjs': $type = 'text/javascript'; break; case 'json': From 5b682330b43708aad406a6d3290c31f4234645c2 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Tue, 10 Feb 2026 12:40:15 +0100 Subject: [PATCH 2/3] Use bool directly --- src/wp-includes/general-template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index e4596b1ede096..7afab9f8c059d 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -4152,7 +4152,7 @@ function wp_get_code_editor_settings( $args ) { ), 'jshint' => array( 'esversion' => 11, - 'module' => str_ends_with( $args['file'] ?? '', '.mjs' ) ? true : false, + 'module' => str_ends_with( $args['file'] ?? '', '.mjs' ), // The following JSHint *linting rule* options are copied from // . From 09a7bab49ed19b57a9cc3a9e2641075887b05d97 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Tue, 10 Feb 2026 12:41:06 +0100 Subject: [PATCH 3/3] Add to editable theme files as well. --- src/wp-admin/includes/file.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 33a9f2067bfeb..09d080da2dd6e 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -262,6 +262,7 @@ function wp_get_theme_file_editable_extensions( $theme ) { 'inc', 'include', 'js', + 'mjs', 'json', 'jsx', 'less',