From fb9814474efa38bd5704d5b2190d6dee53035e38 Mon Sep 17 00:00:00 2001 From: "K. Adam White" Date: Mon, 17 Jul 2023 14:05:51 +0000 Subject: [PATCH] Build Tools: Remove outmoded jsvalidate task from Gruntfile. grunt-jsvalidate was added to catch situations where minification introduced parsing errors in Internet Explorer. IE is no longer supported by WordPress, and the grunt task itself has not been maintained for a decade. Removing this task simplifies the build and avoids false-positive warnings where the outdated tool flags modern JS syntax incorrectly. Props westonruter, joemcgill, jorbin, youknowriad, desrosj, swissspidy. Fixes #58645. See #26615. git-svn-id: https://develop.svn.wordpress.org/trunk@56247 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 36 ++++++------------------------------ package-lock.json | 17 ----------------- package.json | 1 - 3 files changed, 6 insertions(+), 48 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 915043bc18..9af6fa109f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1036,29 +1036,6 @@ module.exports = function(grunt) { } } }, - jsvalidate:{ - options: { - globals: {}, - esprimaOptions:{}, - verbose: false - }, - build: { - files: { - src: [ - WORKING_DIR + 'wp-{admin,includes}/**/*.js', - WORKING_DIR + 'wp-content/themes/twenty*/**/*.js', - '!' + WORKING_DIR + 'wp-content/themes/twenty*/node_modules/**/*.js', - '!' + WORKING_DIR + 'wp-includes/blocks/**/*.js', - '!' + WORKING_DIR + 'wp-includes/js/dist/**/*.js', - ] - } - }, - dynamic: { - files: { - src: [] - } - } - }, imagemin: { core: { expand: true, @@ -1191,7 +1168,7 @@ module.exports = function(grunt) { }, 'js-enqueues': { files: [SOURCE_DIR + 'js/_enqueues/**/*.js'], - tasks: ['clean:dynamic', 'copy:dynamic-js', 'uglify:dynamic', 'jsvalidate:dynamic'], + tasks: ['clean:dynamic', 'copy:dynamic-js', 'uglify:dynamic'], options: { dot: true, spawn: false @@ -1203,7 +1180,7 @@ module.exports = function(grunt) { '!' + SOURCE_DIR + 'js/_enqueues/**/*.js', 'webpack-dev.config.js' ], - tasks: ['clean:dynamic', 'webpack:dev', 'uglify:dynamic', 'jsvalidate:dynamic'], + tasks: ['clean:dynamic', 'webpack:dev', 'uglify:dynamic'], options: { dot: true, spawn: false @@ -1504,8 +1481,7 @@ module.exports = function(grunt) { 'file_append', 'uglify:all', 'concat:tinymce', - 'concat:emoji', - 'jsvalidate:build' + 'concat:emoji' ] ); grunt.registerTask( 'build:css', [ @@ -1842,7 +1818,7 @@ module.exports = function(grunt) { if ( action !== 'deleted' ) { grunt.config( [ 'copy', 'dynamic-js', 'files' ], files ); } - // For the webpack builds configure the jsvalidate task to only check those files build by webpack. + // For the webpack builds configure the task to only check those files built by webpack. } else if ( target === 'js-webpack' ) { src = [ 'wp-includes/js/media-audiovideo.js', @@ -1870,11 +1846,11 @@ module.exports = function(grunt) { // For javascript also minify and validate the changed file. if ( target === 'js-enqueues' ) { grunt.config( [ 'uglify', 'dynamic', 'src' ], src ); - grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return WORKING_DIR + dir; } ) ); + grunt.config( [ 'dynamic', 'files', 'src' ], src.map( function( dir ) { return WORKING_DIR + dir; } ) ); } // For webpack only validate the file, minification is handled by webpack itself. if ( target === 'js-webpack' ) { - grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return WORKING_DIR + dir; } ) ); + grunt.config( [ 'dynamic', 'files', 'src' ], src.map( function( dir ) { return WORKING_DIR + dir; } ) ); } // For css run the rtl task on just the changed file. if ( target === 'rtl' ) { diff --git a/package-lock.json b/package-lock.json index ddf0c7f4d2..678689909a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13903,23 +13903,6 @@ } } }, - "grunt-jsvalidate": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/grunt-jsvalidate/-/grunt-jsvalidate-0.2.2.tgz", - "integrity": "sha512-FWpPrwspDVc0oZmnraBrLm5yx81gXroTLO4sYZd0iCMXxki/9TzKKhx30iOzTpAUGtUM7Q4rym+Y00MMmijBYQ==", - "dev": true, - "requires": { - "esprima": "~1.0.0" - }, - "dependencies": { - "esprima": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", - "integrity": "sha512-rp5dMKN8zEs9dfi9g0X1ClLmV//WRyk/R15mppFNICIFRG5P92VP7Z04p8pk++gABo9W2tY+kHyu6P1mEHgmTA==", - "dev": true - } - } - }, "grunt-known-options": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-2.0.0.tgz", diff --git a/package.json b/package.json index fd359af315..281a41bc6d 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "grunt-contrib-watch": "~1.1.0", "grunt-file-append": "0.0.7", "grunt-jsdoc": "2.4.1", - "grunt-jsvalidate": "~0.2.2", "grunt-legacy-util": "^2.0.1", "grunt-patch-wordpress": "~3.0.0", "grunt-replace-lts": "~1.1.0",