diff --git a/.eslintrc.json b/.eslintrc.json
index 317baf12907..afa494b374c 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -56,7 +56,7 @@
"init-declarations": "off",
"jsx-quotes": "error",
"key-spacing": "off",
- "keyword-spacing": "off",
+ "keyword-spacing": ["error", {"before": true, "after": true}],
"line-comment-position": "off",
"linebreak-style": "off",
"lines-around-comment": "off",
diff --git a/docs/app/js/app.js b/docs/app/js/app.js
index 74d1407c800..b68534e84b2 100644
--- a/docs/app/js/app.js
+++ b/docs/app/js/app.js
@@ -469,7 +469,7 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
if (section.children) {
// matches nested section toggles, such as API or Customization
section.children.forEach(function(childSection){
- if(childSection.pages){
+ if (childSection.pages){
childSection.pages.forEach(function(page){
matchPage(childSection, page);
});
@@ -575,7 +575,7 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
});
var parentNode = $element[0].parentNode.parentNode.parentNode;
- if(parentNode.classList.contains('parent-list-item')) {
+ if (parentNode.classList.contains('parent-list-item')) {
var heading = parentNode.querySelector('h2');
$element[0].firstChild.setAttribute('aria-describedby', heading.id);
}
@@ -689,12 +689,12 @@ function($scope, COMPONENTS, BUILDCONFIG, $mdSidenav, $timeout, $mdDialog, menu,
function isSectionSelected(section) {
var selected = false;
var openedSection = menu.openedSection;
- if(openedSection === section){
+ if (openedSection === section){
selected = true;
}
- else if(section.children) {
+ else if (section.children) {
section.children.forEach(function(childSection) {
- if(childSection === openedSection){
+ if (childSection === openedSection){
selected = true;
}
});
diff --git a/docs/app/js/codepen.js b/docs/app/js/codepen.js
index ea1bb4964b8..3f3c259caf1 100644
--- a/docs/app/js/codepen.js
+++ b/docs/app/js/codepen.js
@@ -124,7 +124,7 @@
function appendLicenseFor(content, lang) {
var commentStart = '', commentEnd = '';
- switch(lang) {
+ switch (lang) {
case 'html' : commentStart = ''; break;
case 'js' : commentStart = '/**'; commentEnd = '**/'; break;
case 'css' : commentStart = '/*'; commentEnd = '*/'; break;
diff --git a/docs/app/js/demo.js b/docs/app/js/demo.js
index 20ad945a15c..092cdd5273a 100644
--- a/docs/app/js/demo.js
+++ b/docs/app/js/demo.js
@@ -65,7 +65,7 @@ angular.module('docsApp')
};
function convertName(name) {
- switch(name) {
+ switch (name) {
case "index.html" : return "HTML";
case "script.js" : return "JS";
case "style.css" : return "CSS";
diff --git a/scripts/gulp-utils.js b/scripts/gulp-utils.js
index fb35b044936..ded2bb1d8e0 100644
--- a/scripts/gulp-utils.js
+++ b/scripts/gulp-utils.js
@@ -267,7 +267,7 @@ exports.hoistScssVariables = function() {
let closeCount = 0;
let openBlock = false;
- for(let currentLine = 0; currentLine < contents.length; ++currentLine) {
+ for (let currentLine = 0; currentLine < contents.length; ++currentLine) {
const line = contents[currentLine];
if (openBlock || /^\s*\$/.test(line) && !/^\s+/.test(line)) {
diff --git a/src/components/datepicker/js/datepickerDirective.js b/src/components/datepicker/js/datepickerDirective.js
index 23ac3241fe8..e52d0fd4402 100644
--- a/src/components/datepicker/js/datepickerDirective.js
+++ b/src/components/datepicker/js/datepickerDirective.js
@@ -179,7 +179,7 @@
if (!mdInputContainer.label) {
$mdAria.expect(element, 'aria-label', attr.mdPlaceholder);
- } else if(!mdNoAsterisk) {
+ } else if (!mdNoAsterisk) {
attr.$observe('required', function(value) {
mdInputContainer.label.toggleClass('md-required', !!value);
});
diff --git a/src/components/gridList/demoDynamicTiles/script.js b/src/components/gridList/demoDynamicTiles/script.js
index e8943f9bd8c..1cd45c72c61 100644
--- a/src/components/gridList/demoDynamicTiles/script.js
+++ b/src/components/gridList/demoDynamicTiles/script.js
@@ -19,7 +19,7 @@ angular
it.title = it.title + (j+1);
it.span = { row : 1, col : 1 };
- switch(j+1) {
+ switch (j+1) {
case 1:
it.background = "red";
it.span.row = it.span.col = 2;
diff --git a/src/components/gridList/grid-list.js b/src/components/gridList/grid-list.js
index 0067271d692..be158da9850 100644
--- a/src/components/gridList/grid-list.js
+++ b/src/components/gridList/grid-list.js
@@ -332,7 +332,7 @@ function GridListDirective($interpolate, $mdConstant, $mdGridLayout, $mdMedia) {
function getGridStyle(colCount, rowCount, gutter, rowMode, rowHeight) {
var style = {};
- switch(rowMode) {
+ switch (rowMode) {
case 'fixed':
style.height = DIMENSION({ unit: rowHeight, span: rowCount, gutter: gutter });
style.paddingBottom = '';
diff --git a/src/components/icon/icon.spec.js b/src/components/icon/icon.spec.js
index 8a445eab024..7120877ae5f 100644
--- a/src/components/icon/icon.spec.js
+++ b/src/components/icon/icon.spec.js
@@ -207,7 +207,7 @@ describe('MdIcon directive', function() {
return {
then: function(fn) {
- switch(id) {
+ switch (id) {
case 'android' : fn('');
break;
case 'cake' : fn('');
diff --git a/src/components/input/input.js b/src/components/input/input.js
index b39940ffc58..75ec657f526 100644
--- a/src/components/input/input.js
+++ b/src/components/input/input.js
@@ -868,7 +868,7 @@ function mdSelectOnFocusDirective($document, $timeout) {
// The debounce is here for Edge's sake, otherwise the selection doesn't work.
// Since focus may already have been lost on the input (and because `select()`
// will re-focus), make sure the element is still active before applying.
- if($document[0].activeElement === element[0]) {
+ if ($document[0].activeElement === element[0]) {
element[0].select();
}
diff --git a/src/components/menu/js/menuServiceProvider.js b/src/components/menu/js/menuServiceProvider.js
index 1a07cbd91b2..c74c66eb996 100644
--- a/src/components/menu/js/menuServiceProvider.js
+++ b/src/components/menu/js/menuServiceProvider.js
@@ -261,7 +261,7 @@ function MenuProvider($$interimElementProvider) {
if (!focusTarget) {
var childrenLen = opts.menuContentEl[0].children.length;
- for(var childIndex = 0; childIndex < childrenLen; childIndex++) {
+ for (var childIndex = 0; childIndex < childrenLen; childIndex++) {
var child = opts.menuContentEl[0].children[childIndex];
focusTarget = child.querySelector('.md-button:not([disabled])');
if (focusTarget) {
diff --git a/src/components/panel/demoPanelAnimations/script.js b/src/components/panel/demoPanelAnimations/script.js
index 1731a80a267..cbc0bda23a2 100644
--- a/src/components/panel/demoPanelAnimations/script.js
+++ b/src/components/panel/demoPanelAnimations/script.js
@@ -29,7 +29,7 @@ AnimationCtrl.prototype.showDialog = function() {
animation.duration(this.duration || this.separateDurations);
- switch(this.openFrom) {
+ switch (this.openFrom) {
case 'button':
animation.openFrom('.animation-target');
break;
@@ -42,7 +42,7 @@ AnimationCtrl.prototype.showDialog = function() {
left: document.documentElement.clientWidth / 2 - 250
});
}
- switch(this.closeTo) {
+ switch (this.closeTo) {
case 'button':
animation.closeTo('.animation-target');
break;
@@ -56,7 +56,7 @@ AnimationCtrl.prototype.showDialog = function() {
});
}
- switch(this.animationType) {
+ switch (this.animationType) {
case 'custom':
animation.withAnimation({
open: 'demo-dialog-custom-animation-open',
diff --git a/src/components/panel/panel.js b/src/components/panel/panel.js
index 0b52c8bc09f..f26ac3fab6f 100644
--- a/src/components/panel/panel.js
+++ b/src/components/panel/panel.js
@@ -2426,7 +2426,7 @@ MdPanelRef.prototype._callInterceptors = function(type) {
if (!response) {
try {
response = interceptor(self);
- } catch(e) {
+ } catch (e) {
response = $q.reject(e);
}
}
diff --git a/src/components/progressCircular/js/progressCircularDirective.js b/src/components/progressCircular/js/progressCircularDirective.js
index 903f4ca6961..d4eb61531ce 100644
--- a/src/components/progressCircular/js/progressCircularDirective.js
+++ b/src/components/progressCircular/js/progressCircularDirective.js
@@ -112,7 +112,7 @@ function MdProgressCircularDirective($window, $mdProgressCircular, $mdTheming,
// If the mode is indeterminate, it doesn't need to
// wait for the next digest. It can start right away.
- if(scope.mdMode === MODE_INDETERMINATE){
+ if (scope.mdMode === MODE_INDETERMINATE){
startIndeterminateAnimation();
}
diff --git a/src/components/progressLinear/progress-linear.js b/src/components/progressLinear/progress-linear.js
index 27d0ae93553..72734e420b3 100644
--- a/src/components/progressLinear/progress-linear.js
+++ b/src/components/progressLinear/progress-linear.js
@@ -127,7 +127,7 @@ function MdProgressLinearDirective($mdTheming, $mdUtil, $log) {
attr.$observe('mdMode', function(mode) {
if (lastMode) container.removeClass(lastMode);
- switch(mode) {
+ switch (mode) {
case MODE_QUERY:
case MODE_BUFFER:
case MODE_DETERMINATE:
@@ -160,7 +160,7 @@ function MdProgressLinearDirective($mdTheming, $mdUtil, $log) {
function mode() {
var value = (attr.mdMode || "").trim();
if (value) {
- switch(value) {
+ switch (value) {
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
case MODE_BUFFER:
diff --git a/src/components/radioButton/radio-button.js b/src/components/radioButton/radio-button.js
index 76e150adef8..0bfe2bd00e2 100644
--- a/src/components/radioButton/radio-button.js
+++ b/src/components/radioButton/radio-button.js
@@ -78,7 +78,7 @@ function mdRadioGroupDirective($mdUtil, $mdConstant, $mdTheming, $timeout) {
}, 100);
})
.on('focus', function() {
- if(scope.mouseActive === false) {
+ if (scope.mouseActive === false) {
rgCtrl.$element.addClass('md-focused');
}
})
diff --git a/src/components/select/select.js b/src/components/select/select.js
index 3a2758733bb..e1a29e33b5b 100755
--- a/src/components/select/select.js
+++ b/src/components/select/select.js
@@ -244,7 +244,7 @@ function SelectDirective($mdSelect, $mdUtil, $mdConstant, $mdTheming, $mdAria, $
element.empty().append(valueEl);
element.append(selectTemplate);
- if(!attr.tabindex){
+ if (!attr.tabindex){
attr.$set('tabindex', 0);
}
diff --git a/src/components/tabs/js/tabsDummyWrapperDirective.js b/src/components/tabs/js/tabsDummyWrapperDirective.js
index 8235d67f1af..3b1ddf5b759 100644
--- a/src/components/tabs/js/tabsDummyWrapperDirective.js
+++ b/src/components/tabs/js/tabsDummyWrapperDirective.js
@@ -26,7 +26,7 @@ function MdTabsDummyWrapper ($mdUtil, $window) {
ctrl.updateInkBarStyles();
};
- if('MutationObserver' in $window) {
+ if ('MutationObserver' in $window) {
var config = {
childList: true,
subtree: true,
diff --git a/src/components/virtualRepeat/demoScrollTo/script.js b/src/components/virtualRepeat/demoScrollTo/script.js
index 82b6d2f936c..58f03cbc18e 100644
--- a/src/components/virtualRepeat/demoScrollTo/script.js
+++ b/src/components/virtualRepeat/demoScrollTo/script.js
@@ -21,7 +21,7 @@
// Whenever a different year is selected, scroll to that year
$scope.$watch('ctrl.selectedYear', angular.bind(this, function(yearIndex) {
var scrollYear = Math.floor(this.topIndex / 13);
- if(scrollYear !== yearIndex) {
+ if (scrollYear !== yearIndex) {
this.topIndex = yearIndex * 13;
}
}));
diff --git a/src/components/virtualRepeat/virtual-repeater.js b/src/components/virtualRepeat/virtual-repeater.js
index 038f58a0bba..c8b6603cbab 100644
--- a/src/components/virtualRepeat/virtual-repeater.js
+++ b/src/components/virtualRepeat/virtual-repeater.js
@@ -373,7 +373,7 @@ VirtualRepeatContainerController.prototype.scrollTo = function(position) {
VirtualRepeatContainerController.prototype.scrollToIndex = function(index) {
var itemSize = this.repeater.getItemSize();
var itemsLength = this.repeater.itemsLength;
- if(index > itemsLength) {
+ if (index > itemsLength) {
index = itemsLength - 1;
}
this.scrollTo(itemSize * index);
@@ -386,7 +386,7 @@ VirtualRepeatContainerController.prototype.resetScroll = function() {
VirtualRepeatContainerController.prototype.handleScroll_ = function() {
var ltr = document.dir !== 'rtl' && document.body.dir !== 'rtl';
- if(!ltr && !this.maxSize) {
+ if (!ltr && !this.maxSize) {
this.scroller.scrollLeft = this.scrollSize;
this.maxSize = this.scroller.scrollLeft;
}
@@ -681,7 +681,7 @@ VirtualRepeatController.prototype.containerUpdated = function() {
// If itemSize is unknown, attempt to measure it.
if (!this.itemSize) {
// Make sure to clean up watchers if we can (see #8178)
- if(this.unwatchItemSize_ && this.unwatchItemSize_ !== angular.noop){
+ if (this.unwatchItemSize_ && this.unwatchItemSize_ !== angular.noop){
this.unwatchItemSize_();
}
this.unwatchItemSize_ = this.$scope.$watchCollection(
diff --git a/src/core/services/aria/aria.js b/src/core/services/aria/aria.js
index fd23b8ca4e0..a5a65196a87 100644
--- a/src/core/services/aria/aria.js
+++ b/src/core/services/aria/aria.js
@@ -216,7 +216,7 @@ function MdAriaService($$rAF, $log, $window, $interpolate) {
}
/* Perform role blacklist check */
if (parentNode.hasAttribute('role')) {
- switch(parentNode.getAttribute('role').toLowerCase()) {
+ switch (parentNode.getAttribute('role').toLowerCase()) {
case 'command':
case 'definition':
case 'directory':
@@ -237,7 +237,7 @@ function MdAriaService($$rAF, $log, $window, $interpolate) {
}
}
/* Perform tagName blacklist check */
- switch(parentNode.tagName.toLowerCase()) {
+ switch (parentNode.tagName.toLowerCase()) {
case 'abbr':
case 'acronym':
case 'address':
diff --git a/src/core/services/gesture/gesture.js b/src/core/services/gesture/gesture.js
index 4462dba74a1..afce03b352d 100644
--- a/src/core/services/gesture/gesture.js
+++ b/src/core/services/gesture/gesture.js
@@ -631,7 +631,7 @@ function attachToDocument($mdGesture, $$MdGestureHandler) {
var handler;
for (var name in HANDLERS) {
handler = HANDLERS[name];
- if(handler instanceof $$MdGestureHandler) {
+ if (handler instanceof $$MdGestureHandler) {
if (handlerEvent === 'start') {
// Run cancel to reset any handlers' state
diff --git a/src/core/services/layout/layout.js b/src/core/services/layout/layout.js
index 59b7c75a7d4..7074ce31c98 100644
--- a/src/core/services/layout/layout.js
+++ b/src/core/services/layout/layout.js
@@ -385,7 +385,7 @@
var message, usage, url;
var nodeName = element[0].nodeName.toLowerCase();
- switch(className.replace(SUFFIXES,"")) {
+ switch (className.replace(SUFFIXES,"")) {
case "flex":
if ((nodeName == "md-button") || (nodeName == "fieldset")){
// @see https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers
diff --git a/src/core/services/registry/componentRegistry.js b/src/core/services/registry/componentRegistry.js
index fe2a799e3af..21376a65be8 100644
--- a/src/core/services/registry/componentRegistry.js
+++ b/src/core/services/registry/componentRegistry.js
@@ -44,9 +44,9 @@
if (!isValidID(handle)) return null;
var i, j, instance;
- for(i = 0, j = instances.length; i < j; i++) {
+ for (i = 0, j = instances.length; i < j; i++) {
instance = instances[i];
- if(instance.$$mdHandle === handle) {
+ if (instance.$$mdHandle === handle) {
return instance;
}
}