style(*): disallow space after object keys, other rules

add `disallowSpaceAfterObjectKeys` and associated changes.
add `disallowMixedSpacesAndTabs` (no files changed)
add `disallowMultipleLineStrings` (no files changed)

Closes #9679
This commit is contained in:
Henry Zhu
2014-10-18 19:48:33 -04:00
committed by Peter Bacon Darwin
parent b64b9ea02c
commit ed3f799b5c
33 changed files with 359 additions and 355 deletions

View File

@@ -236,7 +236,7 @@ function publishExternalAPI(angular){
$timeout: $TimeoutProvider,
$window: $WindowProvider,
$$rAF: $$RAFProvider,
$$asyncCallback : $$AsyncCallbackProvider
$$asyncCallback: $$AsyncCallbackProvider
});
}
]);

View File

@@ -122,7 +122,7 @@ function jqNextId() { return ++jqId; }
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
var MOUSE_EVENT_MAP= { mouseleave : "mouseout", mouseenter : "mouseover"};
var MOUSE_EVENT_MAP= { mouseleave: "mouseout", mouseenter: "mouseover"};
var jqLiteMinErr = minErr('jqLite');
/**
@@ -521,11 +521,11 @@ forEach('input,select,option,textarea,button,form,details'.split(','), function(
BOOLEAN_ELEMENTS[value] = true;
});
var ALIASED_ATTR = {
'ngMinlength' : 'minlength',
'ngMaxlength' : 'maxlength',
'ngMin' : 'min',
'ngMax' : 'max',
'ngPattern' : 'pattern'
'ngMinlength': 'minlength',
'ngMaxlength': 'maxlength',
'ngMin': 'min',
'ngMax': 'max',
'ngPattern': 'pattern'
};
function getBooleanAttrName(element, name) {

View File

@@ -170,7 +170,7 @@ var $AnimateProvider = ['$provide', function($provide) {
* page}.
*/
return {
animate : function(element, from, to) {
animate: function(element, from, to) {
applyStyles(element, { from: from, to: to });
return asyncPromise();
},
@@ -191,7 +191,7 @@ var $AnimateProvider = ['$provide', function($provide) {
* @param {object=} options an optional collection of styles that will be applied to the element.
* @return {Promise} the animation callback promise
*/
enter : function(element, parent, after, options) {
enter: function(element, parent, after, options) {
applyStyles(element, options);
after ? after.after(element)
: parent.prepend(element);
@@ -209,7 +209,7 @@ var $AnimateProvider = ['$provide', function($provide) {
* @param {object=} options an optional collection of options that will be applied to the element.
* @return {Promise} the animation callback promise
*/
leave : function(element, options) {
leave: function(element, options) {
element.remove();
return asyncPromise();
},
@@ -232,7 +232,7 @@ var $AnimateProvider = ['$provide', function($provide) {
* @param {object=} options an optional collection of options that will be applied to the element.
* @return {Promise} the animation callback promise
*/
move : function(element, parent, after, options) {
move: function(element, parent, after, options) {
// Do not remove element before insert. Removing will cause data associated with the
// element to be dropped. Insert will implicitly do the remove.
return this.enter(element, parent, after, options);
@@ -251,11 +251,11 @@ var $AnimateProvider = ['$provide', function($provide) {
* @param {object=} options an optional collection of options that will be applied to the element.
* @return {Promise} the animation callback promise
*/
addClass : function(element, className, options) {
addClass: function(element, className, options) {
return this.setClass(element, className, [], options);
},
$$addClassImmediately : function(element, className, options) {
$$addClassImmediately: function(element, className, options) {
element = jqLite(element);
className = !isString(className)
? (isArray(className) ? className.join(' ') : '')
@@ -280,11 +280,11 @@ var $AnimateProvider = ['$provide', function($provide) {
* @param {object=} options an optional collection of options that will be applied to the element.
* @return {Promise} the animation callback promise
*/
removeClass : function(element, className, options) {
removeClass: function(element, className, options) {
return this.setClass(element, [], className, options);
},
$$removeClassImmediately : function(element, className, options) {
$$removeClassImmediately: function(element, className, options) {
element = jqLite(element);
className = !isString(className)
? (isArray(className) ? className.join(' ') : '')
@@ -310,7 +310,7 @@ var $AnimateProvider = ['$provide', function($provide) {
* @param {object=} options an optional collection of options that will be applied to the element.
* @return {Promise} the animation callback promise
*/
setClass : function(element, add, remove, options) {
setClass: function(element, add, remove, options) {
var self = this;
var STORAGE_KEY = '$$animateClasses';
var createdCache = false;
@@ -320,7 +320,7 @@ var $AnimateProvider = ['$provide', function($provide) {
if (!cache) {
cache = {
classes: {},
options : options
options: options
};
createdCache = true;
} else if (options && cache.options) {
@@ -357,15 +357,15 @@ var $AnimateProvider = ['$provide', function($provide) {
return cache.promise;
},
$$setClassImmediately : function(element, add, remove, options) {
$$setClassImmediately: function(element, add, remove, options) {
add && this.$$addClassImmediately(element, add);
remove && this.$$removeClassImmediately(element, remove);
applyStyles(element, options);
return asyncPromise();
},
enabled : noop,
cancel : noop
enabled: noop,
cancel: noop
};
}];
}];

View File

@@ -898,7 +898,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
*
* @param {string} classVal The className value that will be added to the element
*/
$addClass : function(classVal) {
$addClass: function(classVal) {
if (classVal && classVal.length > 0) {
$animate.addClass(this.$$element, classVal);
}
@@ -915,7 +915,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
*
* @param {string} classVal The className value that will be removed from the element
*/
$removeClass : function(classVal) {
$removeClass: function(classVal) {
if (classVal && classVal.length > 0) {
$animate.removeClass(this.$$element, classVal);
}
@@ -933,7 +933,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
* @param {string} newClasses The current CSS className value
* @param {string} oldClasses The former CSS className value
*/
$updateClass : function(newClasses, oldClasses) {
$updateClass: function(newClasses, oldClasses) {
var toAdd = tokenDifference(newClasses, oldClasses);
if (toAdd && toAdd.length) {
$animate.addClass(this.$$element, toAdd);

View File

@@ -168,7 +168,7 @@ var ngShowDirective = ['$animate', function($animate) {
// to have a global/greedy CSS selector that breaks when other animations are run.
// Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845
$animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {
tempClasses : NG_HIDE_IN_PROGRESS_CLASS
tempClasses: NG_HIDE_IN_PROGRESS_CLASS
});
});
}
@@ -327,7 +327,7 @@ var ngHideDirective = ['$animate', function($animate) {
// The comment inside of the ngShowDirective explains why we add and
// remove a temporary class for the show/hide animation
$animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {
tempClasses : NG_HIDE_IN_PROGRESS_CLASS
tempClasses: NG_HIDE_IN_PROGRESS_CLASS
});
});
}

View File

@@ -1062,7 +1062,7 @@ function $HttpProvider() {
status: status,
headers: headersGetter(headers),
config: config,
statusText : statusText
statusText: statusText
});
}

View File

@@ -966,7 +966,7 @@ function $RootScopeProvider(){
asyncQueue.push({scope: this, expression: expr});
},
$$postDigest : function(fn) {
$$postDigest: function(fn) {
postDigestQueue.push(fn);
},

View File

@@ -78,8 +78,8 @@ function $SnifferProvider() {
},
csp: csp(),
vendorPrefix: vendorPrefix,
transitions : transitions,
animations : animations,
transitions: transitions,
animations: animations,
android: android
};
}];

View File

@@ -665,10 +665,10 @@ angular.module('ngAnimate', ['ng'])
afterFn = null;
}
after.push({
event : event, fn : afterFn
event: event, fn: afterFn
});
before.push({
event : event, fn : beforeFn
event: event, fn: beforeFn
});
return true;
}
@@ -722,31 +722,31 @@ angular.module('ngAnimate', ['ng'])
}
return {
node : node,
event : animationEvent,
className : className,
isClassBased : isClassBased,
isSetClassOperation : isSetClassOperation,
applyStyles : function() {
node: node,
event: animationEvent,
className: className,
isClassBased: isClassBased,
isSetClassOperation: isSetClassOperation,
applyStyles: function() {
if (options) {
element.css(angular.extend(options.from || {}, options.to || {}));
}
},
before : function(allCompleteFn) {
before: function(allCompleteFn) {
beforeComplete = allCompleteFn;
run(before, beforeCancel, function() {
beforeComplete = noop;
allCompleteFn();
});
},
after : function(allCompleteFn) {
after: function(allCompleteFn) {
afterComplete = allCompleteFn;
run(after, afterCancel, function() {
afterComplete = noop;
allCompleteFn();
});
},
cancel : function() {
cancel: function() {
if (beforeCancel) {
forEach(beforeCancel, function(cancelFn) {
(cancelFn || noop)(true);
@@ -871,7 +871,7 @@ angular.module('ngAnimate', ['ng'])
* @param {object=} options an optional collection of options that will be picked up by the CSS transition/animation
* @return {Promise} the animation callback promise
*/
animate : function(element, from, to, className, options) {
animate: function(element, from, to, className, options) {
className = className || 'ng-inline-animate';
options = parseAnimateOptions(options) || {};
options.from = to ? from : null;
@@ -915,7 +915,7 @@ angular.module('ngAnimate', ['ng'])
* @param {object=} options an optional collection of options that will be picked up by the CSS transition/animation
* @return {Promise} the animation callback promise
*/
enter : function(element, parentElement, afterElement, options) {
enter: function(element, parentElement, afterElement, options) {
options = parseAnimateOptions(options);
element = angular.element(element);
parentElement = prepareElement(parentElement);
@@ -959,7 +959,7 @@ angular.module('ngAnimate', ['ng'])
* @param {object=} options an optional collection of styles that will be picked up by the CSS transition/animation
* @return {Promise} the animation callback promise
*/
leave : function(element, options) {
leave: function(element, options) {
options = parseAnimateOptions(options);
element = angular.element(element);
@@ -1006,7 +1006,7 @@ angular.module('ngAnimate', ['ng'])
* @param {object=} options an optional collection of styles that will be picked up by the CSS transition/animation
* @return {Promise} the animation callback promise
*/
move : function(element, parentElement, afterElement, options) {
move: function(element, parentElement, afterElement, options) {
options = parseAnimateOptions(options);
element = angular.element(element);
parentElement = prepareElement(parentElement);
@@ -1050,7 +1050,7 @@ angular.module('ngAnimate', ['ng'])
* @param {object=} options an optional collection of styles that will be picked up by the CSS transition/animation
* @return {Promise} the animation callback promise
*/
addClass : function(element, className, options) {
addClass: function(element, className, options) {
return this.setClass(element, className, [], options);
},
@@ -1084,7 +1084,7 @@ angular.module('ngAnimate', ['ng'])
* @param {object=} options an optional collection of styles that will be picked up by the CSS transition/animation
* @return {Promise} the animation callback promise
*/
removeClass : function(element, className, options) {
removeClass: function(element, className, options) {
return this.setClass(element, [], className, options);
},
@@ -1116,7 +1116,7 @@ angular.module('ngAnimate', ['ng'])
* @param {object=} options an optional collection of styles that will be picked up by the CSS transition/animation
* @return {Promise} the animation callback promise
*/
setClass : function(element, add, remove, options) {
setClass: function(element, add, remove, options) {
options = parseAnimateOptions(options);
var STORAGE_KEY = '$$animateClasses';
@@ -1160,8 +1160,8 @@ angular.module('ngAnimate', ['ng'])
return cache.promise;
} else {
element.data(STORAGE_KEY, cache = {
classes : classes,
options : options
classes: classes,
options: options
});
}
@@ -1199,7 +1199,7 @@ angular.module('ngAnimate', ['ng'])
* @description
* Cancels the provided animation.
*/
cancel : function(promise) {
cancel: function(promise) {
promise.$$cancelFn();
},
@@ -1216,7 +1216,7 @@ angular.module('ngAnimate', ['ng'])
* Globally enables/disables animations.
*
*/
enabled : function(value, element) {
enabled: function(value, element) {
switch (arguments.length) {
case 2:
if (value) {
@@ -1368,10 +1368,10 @@ angular.module('ngAnimate', ['ng'])
runningAnimations[className] = runner;
element.data(NG_ANIMATE_STATE, {
last : runner,
active : runningAnimations,
index : localAnimationCount,
totalActive : totalActiveAnimations
last: runner,
active: runningAnimations,
index: localAnimationCount,
totalActive: totalActiveAnimations
});
//first we run the before animations and when all of those are complete
@@ -1399,8 +1399,8 @@ angular.module('ngAnimate', ['ng'])
if (elementEvents && elementEvents[eventName] && elementEvents[eventName].length > 0) {
$$asyncCallback(function() {
element.triggerHandler(eventName, {
event : animationEvent,
className : className
event: animationEvent,
className: className
});
});
}
@@ -1693,7 +1693,7 @@ angular.module('ngAnimate', ['ng'])
}
});
data = {
total : 0,
total: 0,
transitionDelay: transitionDelay,
transitionDuration: transitionDuration,
animationDelay: animationDelay,
@@ -1766,12 +1766,12 @@ angular.module('ngAnimate', ['ng'])
var closeAnimationFns = formerData.closeAnimationFns || [];
element.data(NG_ANIMATE_CSS_DATA_KEY, {
stagger : stagger,
cacheKey : eventCacheKey,
running : formerData.running || 0,
itemIndex : itemIndex,
blockTransition : blockTransition,
closeAnimationFns : closeAnimationFns
stagger: stagger,
cacheKey: eventCacheKey,
running: formerData.running || 0,
itemIndex: itemIndex,
blockTransition: blockTransition,
closeAnimationFns: closeAnimationFns
});
var node = extractElementNode(element);
@@ -2013,29 +2013,29 @@ angular.module('ngAnimate', ['ng'])
}
return {
animate : function(element, className, from, to, animationCompleted, options) {
animate: function(element, className, from, to, animationCompleted, options) {
options = options || {};
options.from = from;
options.to = to;
return animate('animate', element, className, animationCompleted, options);
},
enter : function(element, animationCompleted, options) {
enter: function(element, animationCompleted, options) {
options = options || {};
return animate('enter', element, 'ng-enter', animationCompleted, options);
},
leave : function(element, animationCompleted, options) {
leave: function(element, animationCompleted, options) {
options = options || {};
return animate('leave', element, 'ng-leave', animationCompleted, options);
},
move : function(element, animationCompleted, options) {
move: function(element, animationCompleted, options) {
options = options || {};
return animate('move', element, 'ng-move', animationCompleted, options);
},
beforeSetClass : function(element, add, remove, animationCompleted, options) {
beforeSetClass: function(element, add, remove, animationCompleted, options) {
options = options || {};
var className = suffixClasses(remove, '-remove') + ' ' +
suffixClasses(add, '-add');
@@ -2048,7 +2048,7 @@ angular.module('ngAnimate', ['ng'])
animationCompleted();
},
beforeAddClass : function(element, className, animationCompleted, options) {
beforeAddClass: function(element, className, animationCompleted, options) {
options = options || {};
var cancellationMethod = animateBefore('addClass', element, suffixClasses(className, '-add'), options.from);
if (cancellationMethod) {
@@ -2059,7 +2059,7 @@ angular.module('ngAnimate', ['ng'])
animationCompleted();
},
beforeRemoveClass : function(element, className, animationCompleted, options) {
beforeRemoveClass: function(element, className, animationCompleted, options) {
options = options || {};
var cancellationMethod = animateBefore('removeClass', element, suffixClasses(className, '-remove'), options.from);
if (cancellationMethod) {
@@ -2070,7 +2070,7 @@ angular.module('ngAnimate', ['ng'])
animationCompleted();
},
setClass : function(element, add, remove, animationCompleted, options) {
setClass: function(element, add, remove, animationCompleted, options) {
options = options || {};
remove = suffixClasses(remove, '-remove');
add = suffixClasses(add, '-add');
@@ -2078,12 +2078,12 @@ angular.module('ngAnimate', ['ng'])
return animateAfter('setClass', element, className, animationCompleted, options.to);
},
addClass : function(element, className, animationCompleted, options) {
addClass: function(element, className, animationCompleted, options) {
options = options || {};
return animateAfter('addClass', element, suffixClasses(className, '-add'), animationCompleted, options.to);
},
removeClass : function(element, className, animationCompleted, options) {
removeClass: function(element, className, animationCompleted, options) {
options = options || {};
return animateAfter('removeClass', element, suffixClasses(className, '-remove'), animationCompleted, options.to);
}

View File

@@ -49,7 +49,7 @@ var ngAriaModule = angular.module('ngAria', ['ng']).
*/
function $AriaProvider() {
var config = {
ariaHidden : true,
ariaHidden: true,
ariaChecked: true,
ariaDisabled: true,
ariaRequired: true,

View File

@@ -371,8 +371,8 @@ angular.module('ngMessages', [])
}
ngMessages.registerMessage(index, {
type : $attrs.ngMessage || $attrs.when,
attach : function() {
type: $attrs.ngMessage || $attrs.when,
attach: function() {
if (!element) {
$transclude($scope, function(clone) {
$animate.enter(clone, null, $element);
@@ -380,7 +380,7 @@ angular.module('ngMessages', [])
});
}
},
detach : function(now) {
detach: function(now) {
if (element) {
$animate.leave(element);
element = null;

View File

@@ -781,20 +781,20 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
$provide.decorator('$animate', ['$delegate', '$$asyncCallback', '$timeout', '$browser',
function($delegate, $$asyncCallback, $timeout, $browser) {
var animate = {
queue : [],
cancel : $delegate.cancel,
enabled : $delegate.enabled,
triggerCallbackEvents : function() {
queue: [],
cancel: $delegate.cancel,
enabled: $delegate.enabled,
triggerCallbackEvents: function() {
$$asyncCallback.flush();
},
triggerCallbackPromise : function() {
triggerCallbackPromise: function() {
$timeout.flush(0);
},
triggerCallbacks : function() {
triggerCallbacks: function() {
this.triggerCallbackEvents();
this.triggerCallbackPromise();
},
triggerReflow : function() {
triggerReflow: function() {
angular.forEach(reflowQueue, function(fn) {
fn();
});
@@ -806,10 +806,10 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
['animate','enter','leave','move','addClass','removeClass','setClass'], function(method) {
animate[method] = function() {
animate.queue.push({
event : method,
element : arguments[0],
options : arguments[arguments.length-1],
args : arguments
event: method,
element: arguments[0],
options: arguments[arguments.length-1],
args: arguments
});
return $delegate[method].apply($delegate, arguments);
};