Add a `grunt jshint:plugins` task.

Props MattyRob.
Fixes #28464.


git-svn-id: https://develop.svn.wordpress.org/trunk@28798 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-06-21 20:02:47 +00:00
parent 5c48c4f8a8
commit 72a61e941d
1 changed files with 30 additions and 0 deletions

View File

@ -271,6 +271,36 @@ module.exports = function(grunt) {
return true;
}
return false;
}
},
plugins: {
expand: true,
cwd: SOURCE_DIR + 'wp-content/plugins',
src: [
'**/*.js',
'!**/*.min.js'
],
// Limit JSHint's run to a single specified plugin folder:
//
// grunt jshint:plugins --folder=foldername
//
filter: function( folderpath ) {
var index, folder = grunt.option( 'folder' );
// Don't filter when no target folder is specified
if ( ! folder ) {
return true;
}
folderpath = folderpath.replace( /\\/g, '/' );
index = folderpath.lastIndexOf( '/' + folder );
// Match only the folder name passed from cli
if ( -1 !== index ) {
return true;
}
return false;
}
}