diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 610125b252ec0..09d080da2dd6e 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', @@ -261,6 +262,7 @@ function wp_get_theme_file_editable_extensions( $theme ) { '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..7afab9f8c059d 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' ), // 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':