Permalink
Browse files

chore(): fix more jshint warnings (#9387)

Another batch of minor jshint warning fixes.

Referencing #9153.
  • Loading branch information...
1 parent 11fd03f commit f7d6d1007f608005c83fc22a4f59fd4868aca2dd @crisbeto crisbeto committed with kara Sep 8, 2016
Showing with 64 additions and 65 deletions.
  1. +2 −1 .jshintrc
  2. +1 −1 src/components/datepicker/js/dateLocaleProvider.js
  3. +1 −1 src/components/datepicker/js/dateUtil.js
  4. +1 −1 src/components/fabActions/fabActions.js
  5. +1 −1 src/components/fabSpeedDial/demoMoreOptions/script.js
  6. +2 −2 src/components/fabSpeedDial/fabSpeedDial.js
  7. +1 −1 src/components/fabToolbar/fabToolbar.js
  8. +2 −2 src/components/icon/demoLoadSvgIconsFromUrl/script.js
  9. +3 −3 src/components/input/input.js
  10. +3 −3 src/components/menu/js/menuDirective.js
  11. +2 −2 src/components/menu/js/menuServiceProvider.js
  12. +3 −3 src/components/navBar/navBar.js
  13. +7 −7 src/components/panel/demoBasicUsage/script.js
  14. +1 −1 src/components/progressLinear/demoBasicUsage/script.js
  15. +1 −1 src/components/radioButton/demoMultiColumn/script.js
  16. +1 −1 src/components/select/demoValidations/script.js
  17. +1 −1 src/components/sidenav/demoBasicUsage/script.js
  18. +1 −1 src/components/sidenav/demoCustomSidenav/script.js
  19. +2 −2 src/components/tabs/js/tabDirective.js
  20. +1 −1 src/components/tabs/js/tabScroll.js
  21. +1 −1 src/components/tabs/js/tabsController.js
  22. +1 −1 src/components/tabs/js/tabsDirective.js
  23. +1 −1 src/components/toast/demoCustomUsage/script.js
  24. +1 −1 src/components/tooltip/demoBasicUsage/script.js
  25. +3 −3 src/core/services/interimElement/interimElement.js
  26. +3 −3 src/core/services/ripple/button_ripple.js
  27. +2 −2 src/core/services/ripple/checkbox_ripple.js
  28. +2 −2 src/core/services/ripple/list_ripple.js
  29. +2 −2 src/core/services/ripple/tab_ripple.js
  30. +1 −1 src/core/services/theming/theming.js
  31. +4 −5 src/core/util/animation/animateCss.js
  32. +1 −2 src/core/util/autofocus.js
  33. +2 −2 src/core/util/color.js
  34. +1 −1 src/core/util/media.js
  35. +2 −2 src/core/util/prefixer.js
View
@@ -1,5 +1,6 @@
{
"expr": true,
"boss": true,
- "laxbreak": true
+ "laxbreak": true,
+ "predef": ["angular"]
}
@@ -175,7 +175,7 @@
// d.toLocaleString(); // == "10/7/1992, 11:00:00 PM"
var localeTime = date.toLocaleTimeString();
var formatDate = date;
- if (date.getHours() == 0 &&
+ if (date.getHours() === 0 &&
(localeTime.indexOf('11:') !== -1 || localeTime.indexOf('23:') !== -1)) {
formatDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 1, 0, 0);
}
@@ -192,7 +192,7 @@
* @return {boolean} Whether the date is a valid Date.
*/
function isValidDate(date) {
- return date != null && date.getTime && !isNaN(date.getTime());
+ return date && date.getTime && !isNaN(date.getTime());
}
/**
@@ -43,7 +43,7 @@
children.wrap('<div class="md-fab-action-item">');
}
}
- }
+ };
}
})();
@@ -47,6 +47,6 @@
templateUrl: 'dialog.html',
targetEvent: $event
});
- }
+ };
});
})();
@@ -205,7 +205,7 @@
runAnimation(element);
delayDone(done);
}
- }
+ };
}
function MdFabSpeedDialScaleAnimation($timeout) {
@@ -248,6 +248,6 @@
runAnimation(element);
delayDone(done);
}
- }
+ };
}
})();
@@ -192,6 +192,6 @@
runAnimation(element, className, done);
done();
}
- }
+ };
}
})();
@@ -5,9 +5,9 @@ angular.module('appDemoSvgIcons', ['ngMaterial'])
$scope.insertDriveIconURL = 'img/icons/ic_insert_drive_file_24px.svg';
$scope.getAndroid = function() {
return 'img/icons/android.svg';
- }
+ };
/* Returns base64 encoded SVG. */
$scope.getAndroidEncoded = function() {
return 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGcgaWQ9ImFuZHJvaWQiPjxwYXRoIGQ9Ik02IDE4YzAgLjU1LjQ1IDEgMSAxaDF2My41YzAgLjgzLjY3IDEuNSAxLjUgMS41czEuNS0uNjcgMS41LTEuNVYxOWgydjMuNWMwIC44My42NyAxLjUgMS41IDEuNXMxLjUtLjY3IDEuNS0xLjVWMTloMWMuNTUgMCAxLS40NSAxLTFWOEg2djEwek0zLjUgOEMyLjY3IDggMiA4LjY3IDIgOS41djdjMCAuODMuNjcgMS41IDEuNSAxLjVTNSAxNy4zMyA1IDE2LjV2LTdDNSA4LjY3IDQuMzMgOCAzLjUgOHptMTcgMGMtLjgzIDAtMS41LjY3LTEuNSAxLjV2N2MwIC44My42NyAxLjUgMS41IDEuNXMxLjUtLjY3IDEuNS0xLjV2LTdjMC0uODMtLjY3LTEuNS0xLjUtMS41em0tNC45Ny01Ljg0bDEuMy0xLjNjLjItLjIuMi0uNTEgMC0uNzEtLjItLjItLjUxLS4yLS43MSAwbC0xLjQ4IDEuNDhDMTMuODUgMS4yMyAxMi45NSAxIDEyIDFjLS45NiAwLTEuODYuMjMtMi42Ni42M0w3Ljg1LjE1Yy0uMi0uMi0uNTEtLjItLjcxIDAtLjIuMi0uMi41MSAwIC43MWwxLjMxIDEuMzFDNi45NyAzLjI2IDYgNS4wMSA2IDdoMTJjMC0xLjk5LS45Ny0zLjc1LTIuNDctNC44NHpNMTAgNUg5VjRoMXYxem01IDBoLTFWNGgxdjF6Ii8+PC9nPjwvc3ZnPg==';
- }
+ };
});
@@ -931,7 +931,7 @@ function ngMessagesAnimation($$AnimateRunner, $animateCss, $mdUtil) {
done();
}
}
- }
+ };
}
function ngMessageAnimation($$AnimateRunner, $animateCss, $mdUtil) {
@@ -949,7 +949,7 @@ function ngMessageAnimation($$AnimateRunner, $animateCss, $mdUtil) {
animator.start().done(done);
}
- }
+ };
}
function showInputMessages(element, done) {
@@ -1007,7 +1007,7 @@ function hideMessage(element) {
var styles = window.getComputedStyle(element[0]);
// If we are already hidden, just return an empty animation
- if (styles.opacity == 0) {
+ if (parseInt(styles.opacity) === 0) {
return $animateCss(element, {});
}
@@ -105,7 +105,7 @@
*
* ### Auto Focus
* By default, when a menu opens, `md-menu` focuses the first button in the menu content.
- *
+ *
* But sometimes you would like to focus another specific menu item instead of the first.<br/>
* This can be done by applying the `md-autofocus` directive on the given element.
*
@@ -123,7 +123,7 @@
* Sometimes you would like to be able to click on a menu item without having the menu
* close. To do this, ngMaterial exposes the `md-prevent-menu-close` attribute which
* can be added to a button inside a menu to stop the menu from automatically closing.
- * You can then close the menu programatically by injecting `$mdMenu` and calling
+ * You can then close the menu programatically by injecting `$mdMenu` and calling
* `$mdMenu.hide()`.
*
* <hljs lang="html">
@@ -211,7 +211,7 @@ function MenuDirective($mdUtil) {
function link(scope, element, attr, ctrls) {
var mdMenuCtrl = ctrls[0];
- var isInMenuBar = ctrls[1] != undefined;
+ var isInMenuBar = !!ctrls[1];
// Move everything into a md-menu-container and pass it to the controller
var menuContainer = angular.element( '<div class="_md md-open-menu-container md-whiteframe-z2"></div>');
var menuContents = element.children()[1];
@@ -190,7 +190,7 @@ function MenuProvider($$interimElementProvider) {
$window.removeEventListener('resize', repositionMenu);
$window.removeEventListener('orientationchange', repositionMenu);
- }
+ };
}
/**
@@ -299,7 +299,7 @@ function MenuProvider($$interimElementProvider) {
}
break;
}
- } while (target = target.parentNode)
+ } while (target = target.parentNode);
function close() {
scope.$apply(function() {
@@ -257,7 +257,7 @@ MdNavBarController.prototype._getTabs = function() {
var linkArray = Array.prototype.slice.call(
this._navBarEl.querySelectorAll('.md-nav-item'));
return linkArray.map(function(el) {
- return angular.element(el).controller('mdNavItem')
+ return angular.element(el).controller('mdNavItem');
});
};
@@ -280,7 +280,7 @@ MdNavBarController.prototype._getTabByName = function(name) {
*/
MdNavBarController.prototype._getSelectedTab = function() {
return this._findTab(function(tab) {
- return tab.isSelected()
+ return tab.isSelected();
});
};
@@ -290,7 +290,7 @@ MdNavBarController.prototype._getSelectedTab = function() {
*/
MdNavBarController.prototype.getFocusedTab = function() {
return this._findTab(function(tab) {
- return tab.hasFocus()
+ return tab.hasFocus();
});
};
@@ -128,20 +128,20 @@ PanelMenuCtrl.prototype.selectDessert = function(dessert) {
PanelMenuCtrl.prototype.onKeydown = function($event, dessert) {
- var handled;
+ var handled, els, index, prevIndex, nextIndex;
switch ($event.which) {
case 38: // Up Arrow.
- var els = document.querySelectorAll('.demo-menu-item');
- var index = indexOf(els, document.activeElement);
- var prevIndex = (index + els.length - 1) % els.length;
+ els = document.querySelectorAll('.demo-menu-item');
+ index = indexOf(els, document.activeElement);
+ prevIndex = (index + els.length - 1) % els.length;
els[prevIndex].focus();
handled = true;
break;
case 40: // Down Arrow.
- var els = document.querySelectorAll('.demo-menu-item');
- var index = indexOf(els, document.activeElement);
- var nextIndex = (index + 1) % els.length;
+ els = document.querySelectorAll('.demo-menu-item');
+ index = indexOf(els, document.activeElement);
+ nextIndex = (index + 1) % els.length;
els[nextIndex].focus();
handled = true;
break;
@@ -36,7 +36,7 @@ angular.module('progressLinearDemo1', ['ngMaterial'])
if ( (j < 2) && !self.showList[j] && self.activated ) {
self.showList[j] = true;
}
- if ( counter++ % 4 == 0 ) j++;
+ if ( counter++ % 4 === 0 ) j++;
// Show the indicator in the "Used within Containers" after 200ms delay
if ( j == 2 ) self.contained = "indeterminate";
@@ -27,5 +27,5 @@ angular
self.selectedId = 2;
self.selectedUser = function() {
return $filter('filter')(self.contacts, { id: self.selectedId })[0].lastName;
- }
+ };
});
@@ -3,7 +3,7 @@ angular.module('selectDemoValidation', ['ngMaterial', 'ngMessages'])
$scope.clearValue = function() {
$scope.quest = undefined;
$scope.favoriteColor = undefined;
- $scope.myForm.$setPristine();;
+ $scope.myForm.$setPristine();
};
$scope.save = function() {
if ($scope.myForm.$valid) {
@@ -48,7 +48,7 @@ angular
.then(function () {
$log.debug("toggle " + navID + " is done");
});
- }
+ };
}
})
.controller('LeftCtrl', function ($scope, $timeout, $mdSidenav, $log) {
@@ -7,6 +7,6 @@ angular
function buildToggler(componentId) {
return function() {
$mdSidenav(componentId).toggle();
- }
+ };
}
});
@@ -61,12 +61,12 @@ function MdTab () {
var label = firstChild(element, 'md-tab-label'),
body = firstChild(element, 'md-tab-body');
- if (label.length == 0) {
+ if (label.length === 0) {
label = angular.element('<md-tab-label></md-tab-label>');
if (attr.label) label.text(attr.label);
else label.append(element.contents());
- if (body.length == 0) {
+ if (body.length === 0) {
var contents = element.contents().detach();
body = angular.element('<md-tab-body></md-tab-body>');
body.append(contents);
@@ -12,5 +12,5 @@ function MdTabScroll ($parse) {
});
};
}
- }
+ };
}
@@ -663,7 +663,7 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
function adjustOffset (index) {
var elements = getElements();
- if (index == null) index = ctrl.focusIndex;
+ if (!angular.isNumber(index)) index = ctrl.focusIndex;
if (!elements.tabs[ index ]) return;
if (ctrl.shouldCenterTabs) return;
var tab = elements.tabs[ index ],
@@ -106,7 +106,7 @@ function MdTabs ($$mdSvgRegistry) {
selectedIndex: '=?mdSelected'
},
template: function (element, attr) {
- attr[ "$mdTabsTemplate" ] = element.html();
+ attr.$mdTabsTemplate = element.html();
return '' +
'<md-tabs-wrapper> ' +
'<md-tab-data></md-tab-data> ' +
@@ -41,7 +41,7 @@
)
.then(function() {
isDlgOpen = false;
- })
+ });
};
});
@@ -14,5 +14,5 @@ angular.module('tooltipDemo1', ['ngMaterial'])
if (val && val.length ) {
$scope.demo.showTooltip = true;
}
- })
+ });
});
@@ -612,14 +612,14 @@ function InterimElementProvider() {
autoHideTimer = $timeout(service.hide, options.hideDelay) ;
cancelAutoHide = function() {
$timeout.cancel(autoHideTimer);
- }
+ };
}
// Cache for subsequent use
options.cancelAutoHide = function() {
cancelAutoHide();
options.cancelAutoHide = undefined;
- }
+ };
}
/**
@@ -663,7 +663,7 @@ function InterimElementProvider() {
// Trigger callback *before* the remove operation starts
announceRemoving(element, action);
- if ( options.$destroy == true ) {
+ if ( options.$destroy ) {
// For $destroy, onRemove should be synchronous
resolve(element);
@@ -37,8 +37,8 @@
return {
isMenuItem: element.hasClass('md-menu-item'),
dimBackground: true
- }
+ };
}
- };
- };
+ }
+ }
})();
@@ -28,6 +28,6 @@
dimBackground: false,
fitRipple: true
}, options));
- };
- };
+ }
+ }
})();
@@ -29,6 +29,6 @@
outline: false,
rippleSize: 'full'
}, options));
- };
- };
+ }
+ }
})();
@@ -29,6 +29,6 @@
outline: false,
rippleSize: 'full'
}, options));
- };
- };
+ }
+ }
})();
@@ -290,7 +290,7 @@ function ThemingProvider($mdColorPalette, $$mdMetaProvider) {
return function () {
removeChrome();
removeWindows();
- }
+ };
};
/**
Oops, something went wrong.

0 comments on commit f7d6d10

Please sign in to comment.