Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit ed3f799

Browse files
hzoopetebacondarwin
authored andcommitted
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
1 parent b64b9ea commit ed3f799

33 files changed

+359
-355
lines changed

.jscs.json

+4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"disallowKeywords": ["with"],
3+
"disallowMixedSpacesAndTabs": true,
4+
"disallowMultipleLineStrings": true,
5+
"disallowNewlineBeforeBlockStatements": true,
36
"disallowTrailingWhitespace": true,
47
"disallowSpaceAfterPrefixUnaryOperators": ["!"],
58
"disallowSpaceBeforeBinaryOperators": [","],
9+
"disallowSpaceAfterObjectKeys": true,
610
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"]
711
}

src/AngularPublic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function publishExternalAPI(angular){
236236
$timeout: $TimeoutProvider,
237237
$window: $WindowProvider,
238238
$$rAF: $$RAFProvider,
239-
$$asyncCallback : $$AsyncCallbackProvider
239+
$$asyncCallback: $$AsyncCallbackProvider
240240
});
241241
}
242242
]);

src/jqLite.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function jqNextId() { return ++jqId; }
122122

123123
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
124124
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
125-
var MOUSE_EVENT_MAP= { mouseleave : "mouseout", mouseenter : "mouseover"};
125+
var MOUSE_EVENT_MAP= { mouseleave: "mouseout", mouseenter: "mouseover"};
126126
var jqLiteMinErr = minErr('jqLite');
127127

128128
/**
@@ -521,11 +521,11 @@ forEach('input,select,option,textarea,button,form,details'.split(','), function(
521521
BOOLEAN_ELEMENTS[value] = true;
522522
});
523523
var ALIASED_ATTR = {
524-
'ngMinlength' : 'minlength',
525-
'ngMaxlength' : 'maxlength',
526-
'ngMin' : 'min',
527-
'ngMax' : 'max',
528-
'ngPattern' : 'pattern'
524+
'ngMinlength': 'minlength',
525+
'ngMaxlength': 'maxlength',
526+
'ngMin': 'min',
527+
'ngMax': 'max',
528+
'ngPattern': 'pattern'
529529
};
530530

531531
function getBooleanAttrName(element, name) {

src/ng/animate.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ var $AnimateProvider = ['$provide', function($provide) {
170170
* page}.
171171
*/
172172
return {
173-
animate : function(element, from, to) {
173+
animate: function(element, from, to) {
174174
applyStyles(element, { from: from, to: to });
175175
return asyncPromise();
176176
},
@@ -191,7 +191,7 @@ var $AnimateProvider = ['$provide', function($provide) {
191191
* @param {object=} options an optional collection of styles that will be applied to the element.
192192
* @return {Promise} the animation callback promise
193193
*/
194-
enter : function(element, parent, after, options) {
194+
enter: function(element, parent, after, options) {
195195
applyStyles(element, options);
196196
after ? after.after(element)
197197
: parent.prepend(element);
@@ -209,7 +209,7 @@ var $AnimateProvider = ['$provide', function($provide) {
209209
* @param {object=} options an optional collection of options that will be applied to the element.
210210
* @return {Promise} the animation callback promise
211211
*/
212-
leave : function(element, options) {
212+
leave: function(element, options) {
213213
element.remove();
214214
return asyncPromise();
215215
},
@@ -232,7 +232,7 @@ var $AnimateProvider = ['$provide', function($provide) {
232232
* @param {object=} options an optional collection of options that will be applied to the element.
233233
* @return {Promise} the animation callback promise
234234
*/
235-
move : function(element, parent, after, options) {
235+
move: function(element, parent, after, options) {
236236
// Do not remove element before insert. Removing will cause data associated with the
237237
// element to be dropped. Insert will implicitly do the remove.
238238
return this.enter(element, parent, after, options);
@@ -251,11 +251,11 @@ var $AnimateProvider = ['$provide', function($provide) {
251251
* @param {object=} options an optional collection of options that will be applied to the element.
252252
* @return {Promise} the animation callback promise
253253
*/
254-
addClass : function(element, className, options) {
254+
addClass: function(element, className, options) {
255255
return this.setClass(element, className, [], options);
256256
},
257257

258-
$$addClassImmediately : function(element, className, options) {
258+
$$addClassImmediately: function(element, className, options) {
259259
element = jqLite(element);
260260
className = !isString(className)
261261
? (isArray(className) ? className.join(' ') : '')
@@ -280,11 +280,11 @@ var $AnimateProvider = ['$provide', function($provide) {
280280
* @param {object=} options an optional collection of options that will be applied to the element.
281281
* @return {Promise} the animation callback promise
282282
*/
283-
removeClass : function(element, className, options) {
283+
removeClass: function(element, className, options) {
284284
return this.setClass(element, [], className, options);
285285
},
286286

287-
$$removeClassImmediately : function(element, className, options) {
287+
$$removeClassImmediately: function(element, className, options) {
288288
element = jqLite(element);
289289
className = !isString(className)
290290
? (isArray(className) ? className.join(' ') : '')
@@ -310,7 +310,7 @@ var $AnimateProvider = ['$provide', function($provide) {
310310
* @param {object=} options an optional collection of options that will be applied to the element.
311311
* @return {Promise} the animation callback promise
312312
*/
313-
setClass : function(element, add, remove, options) {
313+
setClass: function(element, add, remove, options) {
314314
var self = this;
315315
var STORAGE_KEY = '$$animateClasses';
316316
var createdCache = false;
@@ -320,7 +320,7 @@ var $AnimateProvider = ['$provide', function($provide) {
320320
if (!cache) {
321321
cache = {
322322
classes: {},
323-
options : options
323+
options: options
324324
};
325325
createdCache = true;
326326
} else if (options && cache.options) {
@@ -357,15 +357,15 @@ var $AnimateProvider = ['$provide', function($provide) {
357357
return cache.promise;
358358
},
359359

360-
$$setClassImmediately : function(element, add, remove, options) {
360+
$$setClassImmediately: function(element, add, remove, options) {
361361
add && this.$$addClassImmediately(element, add);
362362
remove && this.$$removeClassImmediately(element, remove);
363363
applyStyles(element, options);
364364
return asyncPromise();
365365
},
366366

367-
enabled : noop,
368-
cancel : noop
367+
enabled: noop,
368+
cancel: noop
369369
};
370370
}];
371371
}];

src/ng/compile.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
898898
*
899899
* @param {string} classVal The className value that will be added to the element
900900
*/
901-
$addClass : function(classVal) {
901+
$addClass: function(classVal) {
902902
if (classVal && classVal.length > 0) {
903903
$animate.addClass(this.$$element, classVal);
904904
}
@@ -915,7 +915,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
915915
*
916916
* @param {string} classVal The className value that will be removed from the element
917917
*/
918-
$removeClass : function(classVal) {
918+
$removeClass: function(classVal) {
919919
if (classVal && classVal.length > 0) {
920920
$animate.removeClass(this.$$element, classVal);
921921
}
@@ -933,7 +933,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
933933
* @param {string} newClasses The current CSS className value
934934
* @param {string} oldClasses The former CSS className value
935935
*/
936-
$updateClass : function(newClasses, oldClasses) {
936+
$updateClass: function(newClasses, oldClasses) {
937937
var toAdd = tokenDifference(newClasses, oldClasses);
938938
if (toAdd && toAdd.length) {
939939
$animate.addClass(this.$$element, toAdd);

src/ng/directive/ngShowHide.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ var ngShowDirective = ['$animate', function($animate) {
168168
// to have a global/greedy CSS selector that breaks when other animations are run.
169169
// Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845
170170
$animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {
171-
tempClasses : NG_HIDE_IN_PROGRESS_CLASS
171+
tempClasses: NG_HIDE_IN_PROGRESS_CLASS
172172
});
173173
});
174174
}
@@ -327,7 +327,7 @@ var ngHideDirective = ['$animate', function($animate) {
327327
// The comment inside of the ngShowDirective explains why we add and
328328
// remove a temporary class for the show/hide animation
329329
$animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {
330-
tempClasses : NG_HIDE_IN_PROGRESS_CLASS
330+
tempClasses: NG_HIDE_IN_PROGRESS_CLASS
331331
});
332332
});
333333
}

src/ng/http.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ function $HttpProvider() {
10621062
status: status,
10631063
headers: headersGetter(headers),
10641064
config: config,
1065-
statusText : statusText
1065+
statusText: statusText
10661066
});
10671067
}
10681068

src/ng/rootScope.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ function $RootScopeProvider(){
966966
asyncQueue.push({scope: this, expression: expr});
967967
},
968968

969-
$$postDigest : function(fn) {
969+
$$postDigest: function(fn) {
970970
postDigestQueue.push(fn);
971971
},
972972

src/ng/sniffer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ function $SnifferProvider() {
7878
},
7979
csp: csp(),
8080
vendorPrefix: vendorPrefix,
81-
transitions : transitions,
82-
animations : animations,
81+
transitions: transitions,
82+
animations: animations,
8383
android: android
8484
};
8585
}];

0 commit comments

Comments
 (0)