Skip to content

Commit 06016bb

Browse files
hzoopkozlowski-opensource
authored andcommitted
style(*): add rules requireSpace(After|Before)BinaryOperators
1 parent 50e72fc commit 06016bb

46 files changed

Lines changed: 253 additions & 253 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.jscs.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
"disallowTrailingWhitespace": true,
2424
"requireCommaBeforeLineBreak": true,
2525
"requireLineFeedAtFileEnd": true,
26+
"requireSpaceAfterBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
27+
"requireSpaceBeforeBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
2628
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
2729
"requireSpaceBeforeBlockStatements": true,
2830
"requireSpacesInFunction": {

.jscs.json.todo

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
{
77
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
8-
"requireSpaceAfterBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
9-
"requireSpaceBeforeBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
108
"disallowImplicitTypeConversion": ["string"],
119
"disallowMultipleLineBreaks": true,
1210
"disallowKeywordsOnNewLine": ["else"],

src/Angular.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ function includes(array, obj) {
634634

635635
function arrayRemove(array, value) {
636636
var index = array.indexOf(value);
637-
if (index >=0)
637+
if (index >= 0)
638638
array.splice(index, 1);
639639
return value;
640640
}
@@ -835,7 +835,7 @@ function equals(o1, o2) {
835835
if (isArray(o1)) {
836836
if (!isArray(o2)) return false;
837837
if ((length = o1.length) == o2.length) {
838-
for (key=0; key<length; key++) {
838+
for (key = 0; key < length; key++) {
839839
if (!equals(o1[key], o2[key])) return false;
840840
}
841841
return true;
@@ -1121,7 +1121,7 @@ var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];
11211121
function getNgAttribute(element, ngAttr) {
11221122
var attr, i, ii = ngAttrPrefixes.length;
11231123
element = jqLite(element);
1124-
for (i=0; i<ii; ++i) {
1124+
for (i = 0; i < ii; ++i) {
11251125
attr = ngAttrPrefixes[i] + ngAttr;
11261126
if (isString(attr = element.attr(attr))) {
11271127
return attr;

src/jqLite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ forEach({
597597
}
598598
} else {
599599
return (element[name] ||
600-
(element.attributes.getNamedItem(name)|| noop).specified)
600+
(element.attributes.getNamedItem(name) || noop).specified)
601601
? lowercasedName
602602
: undefined;
603603
}

src/minErr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function minErr(module, ErrorConstructor) {
6969
message = message + '\nhttp://errors.angularjs.org/"NG_VERSION_FULL"/' +
7070
(module ? module + '/' : '') + code;
7171
for (i = 2; i < arguments.length; i++) {
72-
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
72+
message = message + (i == 2 ? '?' : '&') + 'p' + (i - 2) + '=' +
7373
encodeURIComponent(stringify(arguments[i]));
7474
}
7575
return new ErrorConstructor(message);

src/ng/browser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ function Browser(window, document, $log, $sniffer) {
370370
// - 20 cookies per unique domain
371371
// - 4096 bytes per cookie
372372
if (cookieLength > 4096) {
373-
$log.warn("Cookie '"+ name +
374-
"' possibly not set or overflowed because it was too large ("+
373+
$log.warn("Cookie '" + name +
374+
"' possibly not set or overflowed because it was too large (" +
375375
cookieLength + " > 4096 bytes)!");
376376
}
377377
}

src/ng/compile.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,16 +1029,16 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
10291029

10301030
// for each tuples
10311031
var nbrUrisWith2parts = Math.floor(rawUris.length / 2);
1032-
for (var i=0; i<nbrUrisWith2parts; i++) {
1033-
var innerIdx = i*2;
1032+
for (var i = 0; i < nbrUrisWith2parts; i++) {
1033+
var innerIdx = i * 2;
10341034
// sanitize the uri
10351035
result += $$sanitizeUri(trim(rawUris[innerIdx]), true);
10361036
// add the descriptor
1037-
result += (" " + trim(rawUris[innerIdx+1]));
1037+
result += (" " + trim(rawUris[innerIdx + 1]));
10381038
}
10391039

10401040
// split the last item into uri and descriptor
1041-
var lastTuple = trim(rawUris[i*2]).split(/\s/);
1041+
var lastTuple = trim(rawUris[i * 2]).split(/\s/);
10421042

10431043
// sanitize the last uri
10441044
result += $$sanitizeUri(trim(lastTuple[0]), true);
@@ -2045,7 +2045,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
20452045
var match = null;
20462046
if (hasDirectives.hasOwnProperty(name)) {
20472047
for (var directive, directives = $injector.get(name + Suffix),
2048-
i = 0, ii = directives.length; i<ii; i++) {
2048+
i = 0, ii = directives.length; i < ii; i++) {
20492049
try {
20502050
directive = directives[i];
20512051
if ((maxPriority === undefined || maxPriority > directive.priority) &&
@@ -2074,7 +2074,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
20742074
function directiveIsMultiElement(name) {
20752075
if (hasDirectives.hasOwnProperty(name)) {
20762076
for (var directive, directives = $injector.get(name + Suffix),
2077-
i = 0, ii = directives.length; i<ii; i++) {
2077+
i = 0, ii = directives.length; i < ii; i++) {
20782078
directive = directives[i];
20792079
if (directive.multiElement) {
20802080
return true;
@@ -2293,7 +2293,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
22932293
case 'svg':
22942294
case 'math':
22952295
var wrapper = document.createElement('div');
2296-
wrapper.innerHTML = '<'+type+'>'+template+'</'+type+'>';
2296+
wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>';
22972297
return wrapper.childNodes[0].childNodes;
22982298
default:
22992299
return template;

src/ng/directive/input.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,8 +1063,8 @@ function createDateParser(regexp, mapping) {
10631063
// When a date is JSON'ified to wraps itself inside of an extra
10641064
// set of double quotes. This makes the date parsing code unable
10651065
// to match the date string and parse it as a date.
1066-
if (iso.charAt(0) == '"' && iso.charAt(iso.length-1) == '"') {
1067-
iso = iso.substring(1, iso.length-1);
1066+
if (iso.charAt(0) == '"' && iso.charAt(iso.length - 1) == '"') {
1067+
iso = iso.substring(1, iso.length - 1);
10681068
}
10691069
if (ISO_DATE_REGEXP.test(iso)) {
10701070
return new Date(iso);

src/ng/directive/select.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
616616
lastElement = null; // start at the beginning
617617
for (index = 0, length = optionGroup.length; index < length; index++) {
618618
option = optionGroup[index];
619-
if ((existingOption = existingOptions[index+1])) {
619+
if ((existingOption = existingOptions[index + 1])) {
620620
// reuse elements
621621
lastElement = existingOption.element;
622622
if (existingOption.label !== option.label) {

src/ng/filter/filter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ function filterFilter() {
147147
}
148148
return false;
149149
}
150-
text = (''+text).toLowerCase();
151-
return (''+obj).toLowerCase().indexOf(text) > -1;
150+
text = ('' + text).toLowerCase();
151+
return ('' + obj).toLowerCase().indexOf(text) > -1;
152152
};
153153
}
154154
}

0 commit comments

Comments
 (0)