Index: Gruntfile.js =================================================================== --- Gruntfile.js (revision 40904) +++ Gruntfile.js (working copy) @@ -1,4 +1,4 @@ -/* jshint node:true */ +/* global module, require, __dirname */ module.exports = function(grunt) { var path = require('path'), fs = require( 'fs' ), @@ -130,7 +130,7 @@ version = version.replace( /-[\d]{5}$/, '-' + grunt.template.today( 'yyyymmdd.HHMMss' ) ); /* jshint quotmark: true */ - return "$wp_version = '" + version + "';"; + return '$wp_version = \'' + version + '\';'; }); } }, @@ -292,6 +292,59 @@ src: [] } }, + eslint: { + grunt: { + options: { + configFile: 'node_modules/eslint-config-wordpress/index.js' + }, + src: ['Gruntfile.js'] + }, + jshint: { + options: { + configFile: 'node_modules/eslint-config-wordpress/index.js' + }, + cwd: SOURCE_DIR, + src: [ + 'wp-admin/js/*.js', + 'wp-includes/js/*.js', + // Built scripts. + '!wp-includes/js/media-*', + // WordPress scripts inside directories + 'wp-includes/js/jquery/jquery.table-hotkeys.js', + 'wp-includes/js/mediaelement/wp-mediaelement.js', + 'wp-includes/js/mediaelement/wp-playlist.js', + 'wp-includes/js/plupload/handlers.js', + 'wp-includes/js/plupload/wp-plupload.js', + 'wp-includes/js/tinymce/plugins/wordpress/plugin.js', + 'wp-includes/js/tinymce/plugins/wp*/plugin.js', + // Third party scripts + '!wp-admin/js/farbtastic.js', + '!wp-includes/js/backbone*.js', + '!wp-includes/js/swfobject.js', + '!wp-includes/js/underscore*.js', + '!wp-includes/js/colorpicker.js', + '!wp-includes/js/hoverIntent.js', + '!wp-includes/js/json2.js', + '!wp-includes/js/tw-sack.js', + '!wp-includes/js/twemoji.js', + '!**/*.min.js' + ] + }, + themes: { + options: { + configFile: 'node_modules/eslint-config-wordpress/index.js' + }, + expand: true, + cwd: SOURCE_DIR + 'wp-content/themes', + src: [ + 'twenty*/**/*.js', + '!twenty{eleven,twelve,thirteen}/**', + // Third party scripts + '!twenty{fourteen,fifteen,sixteen,seventeen}/**/html5.js', + '!twentyseventeen/assets/js/jquery.scrollTo.js' + ] + } + }, jshint: { options: grunt.file.readJSON('.jshintrc'), grunt: { @@ -736,7 +789,11 @@ if ( set.length ) { fs.stat( dir = set.shift(), function( error ) { - error ? find( set ) : run( path.basename( dir ).substr( 1 ) ); + if ( error ) { + find( set ) + } else { + run( path.basename( dir ).substr( 1 ) ); + } } ); } else { grunt.fatal( 'This WordPress install is not under version control.' ); Index: package.json =================================================================== --- package.json (revision 40904) +++ package.json (working copy) @@ -13,6 +13,8 @@ "license": "GPL-2.0+", "devDependencies": { "autoprefixer": "^6.5.1", + "eslint": "~3.19.0", + "eslint-config-wordpress": "~2.0.0", "grunt": "~0.4.5", "grunt-browserify": "~5.0.0", "grunt-contrib-clean": "~1.0.0", @@ -25,6 +27,7 @@ "grunt-contrib-qunit": "^1.2.0", "grunt-contrib-uglify": "~2.0.0", "grunt-contrib-watch": "~1.0.0", + "grunt-eslint": "~19.0.0", "grunt-includes": "~0.5.1", "grunt-jsvalidate": "~0.2.2", "grunt-legacy-util": "^0.2.0", Index: src/wp-content/themes/twentyfourteen/js/slider.js =================================================================== --- src/wp-content/themes/twentyfourteen/js/slider.js (revision 40904) +++ src/wp-content/themes/twentyfourteen/js/slider.js (working copy) @@ -20,7 +20,7 @@ // Make variables public. slider.vars = $.extend( {}, $.featuredslider.defaults, options ); - namespace = slider.vars.namespace, + namespace = slider.vars.namespace; // Store a reference to the slider object. $.data( el, 'featuredslider', slider ); @@ -105,14 +105,12 @@ var type = 'control-paging', j = 1, item, - slide, i; slider.controlNavScaffold = $( '