Permalink
Browse files

Build: Enable "unused" option in jshint - Remove unused variables fro…

…m codebase. - Closes gh-788

Squashed commit of the following:

commit 7f19f92
Author: Mike Sherov <mike.sherov@gmail.com>
Date:   Tue Oct 23 10:34:28 2012 -0400

    put back in fake args for signatures that we want to keep

commit 257505a
Author: Mike Sherov <mike.sherov@gmail.com>
Date:   Tue Oct 23 08:10:20 2012 -0400

    changes per @scott_gonzalez

commit 1272548
Author: Mike Sherov <mike.sherov@gmail.com>
Date:   Mon Oct 22 22:54:05 2012 -0400

    clean up unused vars in ui directory

commit 563595e
Author: Mike Sherov <mike.sherov@gmail.com>
Date:   Mon Oct 22 22:37:42 2012 -0400

    clean up unused vars in grunt and tests
  • Loading branch information...
1 parent 7af1ec7 commit e1230997aa14dae6f35326c8ba20bfe2428507c2 @mikesherov mikesherov committed with gnarf Oct 23, 2012
Showing with 282 additions and 311 deletions.
  1. +2 −1 .jshintrc
  2. +1 −1 build/release/release.js
  3. +1 −1 build/tasks/build.js
  4. +1 −11 tests/.jshintrc
  5. +1 −2 tests/unit/autocomplete/autocomplete_core.js
  6. +3 −3 tests/unit/autocomplete/autocomplete_events.js
  7. +1 −1 tests/unit/autocomplete/autocomplete_options.js
  8. +1 −1 tests/unit/button/button_events.js
  9. +3 −15 tests/unit/datepicker/datepicker_core.js
  10. +3 −1 tests/unit/datepicker/datepicker_defaults.js
  11. +3 −3 tests/unit/datepicker/datepicker_events.js
  12. +10 −10 tests/unit/datepicker/datepicker_methods.js
  13. +7 −17 tests/unit/datepicker/datepicker_options.js
  14. +1 −1 tests/unit/datepicker/datepicker_tickets.js
  15. +20 −28 tests/unit/dialog/dialog_core.js
  16. +3 −3 tests/unit/dialog/dialog_events.js
  17. +1 −1 tests/unit/dialog/dialog_methods.js
  18. +15 −15 tests/unit/dialog/dialog_options.js
  19. +4 −4 tests/unit/dialog/dialog_tickets.js
  20. +2 −3 tests/unit/draggable/draggable_core.js
  21. +22 −22 tests/unit/draggable/draggable_options.js
  22. +6 −6 tests/unit/droppable/droppable_core.js
  23. +4 −0 tests/unit/droppable/droppable_events.js
  24. +8 −8 tests/unit/droppable/droppable_methods.js
  25. +5 −9 tests/unit/effects/effects_core.js
  26. +15 −15 tests/unit/menu/menu_events.js
  27. +1 −1 tests/unit/menu/menu_methods.js
  28. +2 −2 tests/unit/menu/menu_options.js
  29. +17 −19 tests/unit/resizable/resizable_core.js
  30. +4 −0 tests/unit/resizable/resizable_events.js
  31. +3 −0 tests/unit/resizable/resizable_methods.js
  32. +26 −26 tests/unit/resizable/resizable_options.js
  33. +1 −1 tests/unit/selectable/selectable_core.js
  34. +2 −2 tests/unit/selectable/selectable_events.js
  35. +1 −1 tests/unit/selectable/selectable_methods.js
  36. +4 −4 tests/unit/selectable/selectable_options.js
  37. +12 −12 tests/unit/slider/slider_events.js
  38. +2 −2 tests/unit/slider/slider_methods.js
  39. +4 −0 tests/unit/sortable/sortable_core.js
  40. +4 −0 tests/unit/sortable/sortable_options.js
  41. +3 −3 tests/unit/sortable/sortable_tickets.js
  42. +2 −4 tests/unit/spinner/spinner_options.js
  43. +2 −3 tests/unit/tabs/tabs_core.js
  44. +8 −8 tests/unit/tabs/tabs_deprecated.js
  45. +2 −2 tests/unit/testsuite.js
  46. +1 −1 tests/unit/tooltip/tooltip_options.js
  47. +4 −4 tests/unit/widget/widget_core.js
  48. +1 −0 ui/.jshintrc
  49. +1 −1 ui/jquery.ui.accordion.js
  50. +2 −2 ui/jquery.ui.autocomplete.js
  51. +16 −12 ui/jquery.ui.dialog.js
  52. +4 −7 ui/jquery.ui.effect.js
  53. +2 −2 ui/jquery.ui.slider.js
  54. +5 −7 ui/jquery.ui.tabs.js
  55. +2 −2 ui/jquery.ui.tooltip.js
  56. +1 −1 ui/jquery.ui.widget.js
View
@@ -7,5 +7,6 @@
"node": true,
"onevar": true,
"trailing": true,
- "undef": true
+ "undef": true,
+ "unused": true
}
View
@@ -425,7 +425,7 @@ function abort( msg ) {
function walk( methods ) {
var method = methods.shift();
- function next( error ) {
+ function next() {
if ( methods.length ) {
walk( methods );
}
View
@@ -146,7 +146,7 @@ grunt.registerMultiTask( "zip", "Create a zip file for release", function() {
opts: {
cwd: 'dist'
}
- }, function( err, result ) {
+ }, function( err ) {
if ( err ) {
grunt.log.error( err );
done();
View
@@ -11,8 +11,8 @@
"onevar": true,
"trailing": true,
"undef": true,
+ "unused": true,
"predef": [
- "addMonths",
"asyncTest",
"container",
"deepEqual",
@@ -29,24 +29,14 @@
"Globalize",
"heightAfter",
"init",
- "isNotOpen",
- "isOpen",
"modal",
"module",
"moved",
"notEqual",
"offsetAfter",
"offsetBefore",
"ok",
- "PROP_NAME",
"QUnit",
- "restoreScroll",
- "shouldBeDroppable",
- "shouldmove",
- "shouldNotBeDroppable",
- "shouldnotmove",
- "shouldnotresize",
- "shouldresize",
"start",
"strictEqual",
"stop",
@@ -109,8 +109,7 @@ test( "allow form submit on enter when menu is not active", function() {
function arrowsMoveFocus( id, isKeyUp ) {
expect( 1 );
- var didMove = false,
- element = $( id ).autocomplete({
+ var element = $( id ).autocomplete({
source: [ "a" ],
delay: 0,
minLength: 0
@@ -39,7 +39,7 @@ $.each([
], "response ui.content" );
ui.content.splice( 0, 1 );
},
- open: function( event ) {
+ open: function() {
ok( menu.is( ":visible" ), "menu open on open" );
},
focus: function( event, ui ) {
@@ -127,7 +127,7 @@ asyncTest( "cancel focus", function() {
element = $( "#autocomplete" ).autocomplete({
delay: 0,
source: data,
- focus: function( event, ui ) {
+ focus: function() {
$( this ).val( customVal );
return false;
}
@@ -146,7 +146,7 @@ asyncTest( "cancel select", function() {
element = $( "#autocomplete" ).autocomplete({
delay: 0,
source: data,
- select: function( event, ui ) {
+ select: function() {
$( this ).val( customVal );
return false;
}
@@ -33,7 +33,7 @@ function autoFocusTest( afValue, focusedLength ) {
autoFocus: afValue,
delay: 0,
source: data,
- open: function( event, ui ) {
+ open: function() {
equal( element.autocomplete( "widget" ).children( ".ui-menu-item:first" ).find( ".ui-state-focus" ).length,
focusedLength, "first item is " + (afValue ? "" : "not") + " auto focused" );
start();
@@ -1,7 +1,7 @@
/*
* button_events.js
*/
-(function($) {
+(function() {
module("button: events");
@@ -12,31 +12,19 @@ function equalsDate(d1, d2, message) {
equal(d1.toString(), d2.toString(), message);
}
-function equalsDateArray(a1, a2, message) {
- if (!a1 || !a2) {
- ok(false, message + ' - missing dates');
- return;
- }
- a1[0] = (a1[0] ? new Date(a1[0].getFullYear(), a1[0].getMonth(), a1[0].getDate()) : '');
- a1[1] = (a1[1] ? new Date(a1[1].getFullYear(), a1[1].getMonth(), a1[1].getDate()) : '');
- a2[0] = (a2[0] ? new Date(a2[0].getFullYear(), a2[0].getMonth(), a2[0].getDate()) : '');
- a2[1] = (a2[1] ? new Date(a2[1].getFullYear(), a2[1].getMonth(), a2[1].getDate()) : '');
- deepEqual(a1, a2, message);
-}
-
-function addMonths(date, offset) {
+TestHelpers.addMonths = function(date, offset) {
var maxDay = 32 - new Date(date.getFullYear(), date.getMonth() + offset, 32).getDate();
date.setDate(Math.min(date.getDate(), maxDay));
date.setMonth(date.getMonth() + offset);
return date;
-}
+};
function init(id, options) {
$.datepicker.setDefaults($.datepicker.regional['']);
return $(id).datepicker($.extend({showAnim: ''}, options || {}));
}
-var PROP_NAME = 'datepicker';
+TestHelpers.PROP_NAME = 'datepicker';
(function($) {
@@ -2,8 +2,10 @@
* datepicker_defaults.js
*/
+/*
var datepicker_defaults = {
disabled: false
};
-//TestHelpers.commonWidgetTests('datepicker', { defaults: datepicker_defaults });
+TestHelpers.commonWidgetTests('datepicker', { defaults: datepicker_defaults });
+*/
@@ -30,7 +30,7 @@ test('events', function() {
inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equal(selectedThis, inp[0], 'Callback selected this');
- equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst');
+ equal(selectedInst, $.data(inp[0], TestHelpers.PROP_NAME), 'Callback selected inst');
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
'Callback selected date');
inp.val('').datepicker('show').
@@ -59,7 +59,7 @@ test('events', function() {
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 1);
equal(selectedThis, inp[0], 'Callback change month/year this');
- equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst');
+ equal(selectedInst, $.data(inp[0], TestHelpers.PROP_NAME), 'Callback change month/year inst');
equal(selectedDate, newMonthYear(date),
'Callback change month/year date - pgup');
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
@@ -107,7 +107,7 @@ test('events', function() {
val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
equal(selectedThis, inp[0], 'Callback close this');
- equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst');
+ equal(selectedInst, $.data(inp[0], TestHelpers.PROP_NAME), 'Callback close inst');
equal(selectedDate, '', 'Callback close date - esc');
inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
@@ -10,56 +10,56 @@ test('destroy', function() {
var inl,
inp = init('#inp');
ok(inp.is('.hasDatepicker'), 'Default - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Default - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Default - instance present');
ok(inp.next().is('#alt'), 'Default - button absent');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Default - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Default - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Default - instance absent');
ok(inp.next().is('#alt'), 'Default - button absent');
// With button
inp= init('#inp', {showOn: 'both'});
ok(inp.is('.hasDatepicker'), 'Button - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Button - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Button - instance present');
ok(inp.next().text() === '...', 'Button - button added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Button - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Button - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Button - instance absent');
ok(inp.next().is('#alt'), 'Button - button removed');
// With append text
inp = init('#inp', {appendText: 'Testing'});
ok(inp.is('.hasDatepicker'), 'Append - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Append - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Append - instance present');
ok(inp.next().text() === 'Testing', 'Append - append text added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Append - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Append - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Append - instance absent');
ok(inp.next().is('#alt'), 'Append - append text removed');
// With both
inp= init('#inp', {showOn: 'both', buttonImageOnly: true,
buttonImage: 'img/calendar.gif', appendText: 'Testing'});
ok(inp.is('.hasDatepicker'), 'Both - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Both - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Both - instance present');
ok(inp.next()[0].nodeName.toLowerCase() === 'img', 'Both - button added');
ok(inp.next().next().text() === 'Testing', 'Both - append text added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Both - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Both - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Both - instance absent');
ok(inp.next().is('#alt'), 'Both - button and append text absent');
// Inline
inl = init('#inl');
ok(inl.is('.hasDatepicker'), 'Inline - marker class set');
ok(inl.html() !== '', 'Inline - datepicker present');
- ok($.data(inl[0], PROP_NAME), 'Inline - instance present');
+ ok($.data(inl[0], TestHelpers.PROP_NAME), 'Inline - instance present');
ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
inl.datepicker('destroy');
inl = $('#inl');
ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared');
ok(inl.html() === '', 'Inline - datepicker absent');
- ok(!$.data(inl[0], PROP_NAME), 'Inline - instance absent');
+ ok(!$.data(inl[0], TestHelpers.PROP_NAME), 'Inline - instance absent');
ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
});
@@ -8,7 +8,7 @@ module("datepicker: options");
test('setDefaults', function() {
expect( 3 );
- var inp = init('#inp');
+ init('#inp');
equal($.datepicker._defaults.showOn, 'focus', 'Initial showOn');
$.datepicker.setDefaults({showOn: 'button'});
equal($.datepicker._defaults.showOn, 'button', 'Change default showOn');
@@ -19,7 +19,7 @@ test('setDefaults', function() {
test('option', function() {
expect( 17 );
var inp = init('#inp'),
- inst = $.data(inp[0], PROP_NAME);
+ inst = $.data(inp[0], TestHelpers.PROP_NAME);
// Set option
equal(inst.settings.showOn, null, 'Initial setting showOn');
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
@@ -51,7 +51,7 @@ test('option', function() {
test('change', function() {
expect( 12 );
var inp = init('#inp'),
- inst = $.data(inp[0], PROP_NAME);
+ inst = $.data(inp[0], TestHelpers.PROP_NAME);
equal(inst.settings.showOn, null, 'Initial setting showOn');
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn');
@@ -215,12 +215,12 @@ test('defaultDate', function() {
inp.datepicker('option', {defaultDate: ' -1 m '}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- date = addMonths(new Date(), -1);
+ date = TestHelpers.addMonths(new Date(), -1);
equalsDate(inp.datepicker('getDate'), date, 'Default date -1 m');
inp.datepicker('option', {defaultDate: '+2M'}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- date = addMonths(new Date(), 2);
+ date = TestHelpers.addMonths(new Date(), 2);
equalsDate(inp.datepicker('getDate'), date, 'Default date +2M');
inp.datepicker('option', {defaultDate: '-2y'}).
datepicker('hide').val('').datepicker('show').
@@ -236,7 +236,7 @@ test('defaultDate', function() {
inp.datepicker('option', {defaultDate: '+1M +10d'}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- date = addMonths(new Date(), 1);
+ date = TestHelpers.addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d');
// String date values
@@ -380,7 +380,7 @@ test('minMax', function() {
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date,
'Min/max - -1w, +1 M +10 D - ctrl+pgup');
- date = addMonths(new Date(), 1);
+ date = TestHelpers.addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
inp.val('').datepicker('show');
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
@@ -665,16 +665,6 @@ function beforeDay(date) {
(date.getDate() % 3 === 0 ? 'Divisble by 3' : '')];
}
-function calcWeek(date) {
- var doy = date.getDate() + 6,
- m = date.getMonth() - 1;
- for (; m >= 0; m--) {
- doy += $.datepicker._getDaysInMonth(date.getFullYear(), m);
- }
- // Simple count from 01/01 starting at week 1
- return Math.floor(doy / 7);
-}
-
test('callbacks', function() {
expect( 13 );
// Before show
@@ -8,7 +8,7 @@ module("datepicker: tickets");
// http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
test('beforeShowDay-getDate', function() {
expect( 3 );
- var inp = init('#inp', {beforeShowDay: function(date) { inp.datepicker('getDate'); return [true, '']; }}),
+ var inp = init('#inp', {beforeShowDay: function() { inp.datepicker('getDate'); return [true, '']; }}),
dp = $('#ui-datepicker-div');
inp.val('01/01/2010').datepicker('show');
// contains non-breaking space
Oops, something went wrong.

0 comments on commit e123099

Please sign in to comment.