From 5cdfed0cf09556842a01733ff8e127d20ae8f5fd Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 15 Jan 2014 18:58:55 +0100 Subject: [PATCH] js: Conform with jQuery JavaScript Style Guide * Update JSHint configuration and enforce new rules (mostly quote marks and removing unused variables). * Whitespace (no space after last object/function argument, no space after "function" operator in anonymous functions). * Remove dates from @author. Ref #289 --- .jshintrc | 40 ++++---- js/addjob.js | 31 +++--- js/inject.js | 260 ++++++++++++++++++++++++------------------------ js/job.js | 119 +++++++++++----------- js/pretty.js | 26 ++--- js/result.js | 30 +++--- js/run.js | 104 +++++++++---------- js/testswarm.js | 54 +++++----- 8 files changed, 336 insertions(+), 328 deletions(-) diff --git a/.jshintrc b/.jshintrc index e30736b5..7fc1d7af 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,21 +1,27 @@ { - "predef": [ - "SWARM" - ], + "boss": true, + "curly": true, + "eqeqeq": true, + "eqnull": true, + "expr": true, + "immed": true, + "noarg": true, + "onevar": true, + "quotmark": "double", + "smarttabs": true, + "trailing": true, + "undef": true, + "unused": true, - "bitwise": true, - "curly": true, - "eqeqeq": true, - "immed": true, - "latedef": true, - "newcap": true, - "noarg": true, - "noempty": true, - "undef": true, - "trailing": true, + "bitwise": true, + "browser": true, + "es3": true, + "latedef": true, + "newcap": true, + "noempty": true, - "smarttabs": true, - - "browser": true, - "jquery": true + "predef": [ + "SWARM", + "jQuery" + ] } diff --git a/js/addjob.js b/js/addjob.js index 1331e8ae..e7e1a9d9 100644 --- a/js/addjob.js +++ b/js/addjob.js @@ -1,42 +1,41 @@ /** * JavaScript file for the "addjob" page. * - * @author Timo Tijhof, 2012 + * @author Timo Tijhof * @since 1.0.0 * @package TestSwarm */ -jQuery(function ( $ ) { - var $runsContainer, $addRunBtn, $runFieldsetClean, cnt; +jQuery(function( $ ) { + var $addRunBtn, + $runsContainer = $( "#runs-container" ), + $runFieldsetClean = $runsContainer.children( "fieldset" ).eq( 0 ).clone().detach(), + cnt = $runsContainer.children( "fieldset" ).length; - $runsContainer = $('#runs-container'); - $runFieldsetClean = $runsContainer.children('fieldset').eq(0).clone().detach(); - cnt = $runsContainer.children('fieldset').length; - - $addRunBtn = $('