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

Commit 31ec9f1

Browse files
hzoopetebacondarwin
authored andcommitted
style(*): add validateParameterSeparator rule to jscs
Closes #9685
1 parent 8b92161 commit 31ec9f1

File tree

8 files changed

+28
-27
lines changed

8 files changed

+28
-27
lines changed

.jscs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"disallowSpaceBeforeBinaryOperators": [","],
99
"disallowTrailingComma": true,
1010
"disallowTrailingWhitespace": true,
11-
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"]
11+
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
12+
"validateParameterSeparator": ", "
1213
}

src/ng/compile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
18701870
if (parentGet.literal) {
18711871
compare = equals;
18721872
} else {
1873-
compare = function(a,b) { return a === b || (a !== a && b !== b); };
1873+
compare = function(a, b) { return a === b || (a !== a && b !== b); };
18741874
}
18751875
parentSet = parentGet.assign || function() {
18761876
// reset the change, or we will throw this exception on every $digest

src/ng/filter/orderBy.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,19 @@ function orderByFilter($parse){
130130
}
131131
if ( predicate === '' ) {
132132
// Effectively no predicate was passed so we compare identity
133-
return reverseComparator(function(a,b) {
133+
return reverseComparator(function(a, b) {
134134
return compare(a, b);
135135
}, descending);
136136
}
137137
get = $parse(predicate);
138138
if (get.constant) {
139139
var key = get();
140-
return reverseComparator(function(a,b) {
140+
return reverseComparator(function(a, b) {
141141
return compare(a[key], b[key]);
142142
}, descending);
143143
}
144144
}
145-
return reverseComparator(function(a,b){
145+
return reverseComparator(function(a, b){
146146
return compare(get(a),get(b));
147147
}, descending);
148148
});
@@ -159,7 +159,7 @@ function orderByFilter($parse){
159159
}
160160
function reverseComparator(comp, descending) {
161161
return descending
162-
? function(a,b){return comp(b,a);}
162+
? function(a, b){return comp(b,a);}
163163
: comp;
164164
}
165165
function compare(v1, v2){

src/ng/parse.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ CONSTANTS['this'].sharedGetter = true;
9999

100100
//Operators - will be wrapped by binaryFn/unaryFn/assignment/filter
101101
var OPERATORS = extend(createMap(), {
102-
'+':function(self, locals, a,b){
102+
'+':function(self, locals, a, b){
103103
a=a(self, locals); b=b(self, locals);
104104
if (isDefined(a)) {
105105
if (isDefined(b)) {
@@ -108,23 +108,23 @@ var OPERATORS = extend(createMap(), {
108108
return a;
109109
}
110110
return isDefined(b)?b:undefined;},
111-
'-':function(self, locals, a,b){
111+
'-':function(self, locals, a, b){
112112
a=a(self, locals); b=b(self, locals);
113113
return (isDefined(a)?a:0)-(isDefined(b)?b:0);
114114
},
115-
'*':function(self, locals, a,b){return a(self, locals)*b(self, locals);},
116-
'/':function(self, locals, a,b){return a(self, locals)/b(self, locals);},
117-
'%':function(self, locals, a,b){return a(self, locals)%b(self, locals);},
115+
'*':function(self, locals, a, b){return a(self, locals)*b(self, locals);},
116+
'/':function(self, locals, a, b){return a(self, locals)/b(self, locals);},
117+
'%':function(self, locals, a, b){return a(self, locals)%b(self, locals);},
118118
'===':function(self, locals, a, b){return a(self, locals)===b(self, locals);},
119119
'!==':function(self, locals, a, b){return a(self, locals)!==b(self, locals);},
120-
'==':function(self, locals, a,b){return a(self, locals)==b(self, locals);},
121-
'!=':function(self, locals, a,b){return a(self, locals)!=b(self, locals);},
122-
'<':function(self, locals, a,b){return a(self, locals)<b(self, locals);},
123-
'>':function(self, locals, a,b){return a(self, locals)>b(self, locals);},
124-
'<=':function(self, locals, a,b){return a(self, locals)<=b(self, locals);},
125-
'>=':function(self, locals, a,b){return a(self, locals)>=b(self, locals);},
126-
'&&':function(self, locals, a,b){return a(self, locals)&&b(self, locals);},
127-
'||':function(self, locals, a,b){return a(self, locals)||b(self, locals);},
120+
'==':function(self, locals, a, b){return a(self, locals)==b(self, locals);},
121+
'!=':function(self, locals, a, b){return a(self, locals)!=b(self, locals);},
122+
'<':function(self, locals, a, b){return a(self, locals)<b(self, locals);},
123+
'>':function(self, locals, a, b){return a(self, locals)>b(self, locals);},
124+
'<=':function(self, locals, a, b){return a(self, locals)<=b(self, locals);},
125+
'>=':function(self, locals, a, b){return a(self, locals)>=b(self, locals);},
126+
'&&':function(self, locals, a, b){return a(self, locals)&&b(self, locals);},
127+
'||':function(self, locals, a, b){return a(self, locals)||b(self, locals);},
128128
'!':function(self, locals, a){return !a(self, locals);},
129129

130130
//Tokenized as operators but parsed as assignment/filters

src/ngMock/angular-mocks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ angular.mock.$Browser = function() {
6767
self.defer = function(fn, delay) {
6868
delay = delay || 0;
6969
self.deferredFns.push({time:(self.defer.now + delay), fn:fn, id: self.deferredNextId});
70-
self.deferredFns.sort(function(a,b){ return a.time - b.time;});
70+
self.deferredFns.sort(function(a, b){ return a.time - b.time;});
7171
return self.deferredNextId++;
7272
};
7373

@@ -497,7 +497,7 @@ angular.mock.$IntervalProvider = function() {
497497
id: nextRepeatId,
498498
deferred: deferred
499499
});
500-
repeatFns.sort(function(a,b){ return a.nextTime - b.nextTime;});
500+
repeatFns.sort(function(a, b){ return a.nextTime - b.nextTime;});
501501

502502
nextRepeatId++;
503503
return promise;
@@ -546,7 +546,7 @@ angular.mock.$IntervalProvider = function() {
546546
var task = repeatFns[0];
547547
task.fn();
548548
task.nextTime += task.delay;
549-
repeatFns.sort(function(a,b){ return a.nextTime - b.nextTime;});
549+
repeatFns.sort(function(a, b){ return a.nextTime - b.nextTime;});
550550
}
551551
return millis;
552552
};

test/ng/filter/filterSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe('Filter: filter', function() {
160160
{key: 1, nonkey:14}
161161
];
162162
var expr = {key: 10};
163-
var comparator = function (obj,value) {
163+
var comparator = function (obj, value) {
164164
return obj > value;
165165
};
166166
expect(filter(items, expr, comparator)).toEqual([items[2]]);

test/ng/intervalSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('$interval', function() {
1717
fn: fn,
1818
id: nextRepeatId
1919
});
20-
repeatFns.sort(function(a,b){ return a.nextTime - b.nextTime;});
20+
repeatFns.sort(function(a, b){ return a.nextTime - b.nextTime;});
2121

2222
return nextRepeatId++;
2323
},
@@ -43,7 +43,7 @@ describe('$interval', function() {
4343
var task = repeatFns[0];
4444
task.fn();
4545
task.nextTime += task.delay;
46-
repeatFns.sort(function(a,b){ return a.nextTime - b.nextTime;});
46+
repeatFns.sort(function(a, b){ return a.nextTime - b.nextTime;});
4747
}
4848
return millis;
4949
}

test/ng/parseSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,12 @@ describe('parser', function() {
463463
});
464464

465465
it('should evaluate function call without arguments', function() {
466-
scope['const'] = function(a,b){return 123;};
466+
scope['const'] = function(a, b){return 123;};
467467
expect(scope.$eval("const()")).toEqual(123);
468468
});
469469

470470
it('should evaluate function call with arguments', function() {
471-
scope.add = function(a,b) {
471+
scope.add = function(a, b) {
472472
return a+b;
473473
};
474474
expect(scope.$eval("add(1,2)")).toEqual(3);

0 commit comments

Comments
 (0)