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

Commit d3b1f50

Browse files
hzoocaitp
authored andcommitted
style(*): add rule disallowSpacesInAnonymousFunctionExpression beforeOpeningRoundBrace, including i18n generator
1 parent 94f5a28 commit d3b1f50

File tree

798 files changed

+1139
-1529
lines changed

Some content is hidden

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

798 files changed

+1139
-1529
lines changed

.jscs.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"disallowSpaceAfterObjectKeys": true,
77
"disallowSpaceAfterPrefixUnaryOperators": ["!"],
88
"disallowSpaceBeforeBinaryOperators": [","],
9+
"disallowSpacesInAnonymousFunctionExpression": {
10+
"beforeOpeningRoundBrace": true
11+
},
912
"disallowSpacesInFunctionDeclaration": {
1013
"beforeOpeningRoundBrace": true
1114
},

i18n/closure/currencySymbols.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ goog.i18n.currency.adjustPrecision = function(pattern, currencyCode) {
267267
* 18: two decimals precision (2), currency sign last (16), no space (0)
268268
* 50: two decimals precision (2), currency sign last (16), space (32)
269269
*
270-
* @type {!Object.<!Array>}
270+
* @type {!Object.<!Array.<?>>}
271271
*/
272272
goog.i18n.currency.CurrencyInfo = {
273273
'AED': [2, 'dh', '\u062f.\u0625.', 'DH'],
@@ -334,7 +334,7 @@ goog.i18n.currency.CurrencyInfo = {
334334

335335
/**
336336
* Tier 2 currency information.
337-
* @type {!Object.<!Array>}
337+
* @type {!Object.<!Array.<?>>}
338338
*/
339339
goog.i18n.currency.CurrencyInfoTier2 = {
340340
'AFN': [48, 'Af.', 'AFN'],

i18n/spec/closureI18nExtractorSpec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function newTestLocaleInfo() {
5656
}
5757

5858

59-
describe("findLocaleId", function () {
59+
describe("findLocaleId", function() {
6060
it("should find the id from numbers", function() {
6161
expect(findLocaleId("NumberFormatSymbols_en_GB", "num")).toEqual("en_GB");
6262
});
@@ -74,7 +74,7 @@ describe("findLocaleId", function () {
7474
});
7575
});
7676

77-
describe("extractNumberSymbols", function () {
77+
describe("extractNumberSymbols", function() {
7878
it("should extract number data", function() {
7979
var CONTENT = [
8080
"goog.provide('goog.i18n.NumberFormatSymbols_en_GB');",
@@ -117,7 +117,7 @@ describe("extractNumberSymbols", function () {
117117
})
118118
});
119119

120-
describe("extractCurrencySymbols", function () {
120+
describe("extractCurrencySymbols", function() {
121121
it("should extract currency data", function() {
122122
var CONTENT = [
123123
"goog.i18n.currency.CurrencyInfo = {",
@@ -137,7 +137,7 @@ describe("extractCurrencySymbols", function () {
137137
});
138138

139139

140-
describe("extractDateTimeSymbols", function () {
140+
describe("extractDateTimeSymbols", function() {
141141
it("should extract date time data", function() {
142142
var CONTENT = [
143143
"goog.i18n.DateTimeSymbols_fr_CA = {",

i18n/src/closureI18nExtractor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function pluralExtractor(content, localeInfo) {
8787
continue;
8888
}
8989
var temp = goog.i18n.pluralRules.select.toString().
90+
replace(/function\s+\(/g, 'function(').
9091
replace(/goog\.i18n\.pluralRules\.Keyword/g, 'PLURAL_CATEGORY').
9192
replace(/goog\.i18n\.pluralRules\.get_vf_/g, 'getVF').
9293
replace(/goog\.i18n\.pluralRules\.get_wt_/g, 'getWT').

i18n/src/closureSlurper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function writeLocaleFiles() {
8080
var filename = NG_LOCALE_DIR + 'angular-locale_' + correctedLocaleId + '.js'
8181
console.log('Writing ' + filename);
8282
return qfs.write(filename, content)
83-
.then(function () {
83+
.then(function() {
8484
console.log('Wrote ' + filename);
8585
++num_files;
8686
});

src/jqLite.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ forEach({
637637
if (isUndefined(value)) {
638638
if (element.multiple && nodeName_(element) === 'select') {
639639
var result = [];
640-
forEach(element.options, function (option) {
640+
forEach(element.options, function(option) {
641641
if (option.selected) {
642642
result.push(option.value || option.text);
643643
}
@@ -710,7 +710,7 @@ forEach({
710710
});
711711

712712
function createEventHandler(element, events) {
713-
var eventHandler = function (event, type) {
713+
var eventHandler = function(event, type) {
714714
// jQuery specific api
715715
event.isDefaultPrevented = function() {
716716
return event.defaultPrevented;

src/minErr.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232

3333
function minErr(module, ErrorConstructor) {
3434
ErrorConstructor = ErrorConstructor || Error;
35-
return function () {
35+
return function() {
3636
var code = arguments[0],
3737
prefix = '[' + (module ? module + ':' : '') + code + '] ',
3838
template = arguments[1],
3939
templateArgs = arguments,
40-
stringify = function (obj) {
40+
stringify = function(obj) {
4141
if (typeof obj === 'function') {
4242
return obj.toString().replace(/ \{[\s\S]*$/, '');
4343
} else if (typeof obj === 'undefined') {
@@ -49,7 +49,7 @@ function minErr(module, ErrorConstructor) {
4949
},
5050
message, i;
5151

52-
message = prefix + template.replace(/\{\d+\}/g, function (match) {
52+
message = prefix + template.replace(/\{\d+\}/g, function(match) {
5353
var index = +match.slice(1, -1), arg;
5454

5555
if (index + 2 < templateArgs.length) {

src/ng/animate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ var $AnimateProvider = ['$provide', function($provide) {
260260
className = !isString(className)
261261
? (isArray(className) ? className.join(' ') : '')
262262
: className;
263-
forEach(element, function (element) {
263+
forEach(element, function(element) {
264264
jqLiteAddClass(element, className);
265265
});
266266
applyStyles(element, options);
@@ -289,7 +289,7 @@ var $AnimateProvider = ['$provide', function($provide) {
289289
className = !isString(className)
290290
? (isArray(className) ? className.join(' ') : '')
291291
: className;
292-
forEach(element, function (element) {
292+
forEach(element, function(element) {
293293
jqLiteRemoveClass(element, className);
294294
});
295295
applyStyles(element, options);

src/ng/directive/form.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) {
237237
* Setting a form back to a pristine state is often useful when we want to 'reuse' a form after
238238
* saving or resetting it.
239239
*/
240-
form.$setPristine = function () {
240+
form.$setPristine = function() {
241241
$animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);
242242
form.$dirty = false;
243243
form.$pristine = true;
@@ -260,7 +260,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) {
260260
* Setting a form controls back to their untouched state is often useful when setting the form
261261
* back to its pristine state.
262262
*/
263-
form.$setUntouched = function () {
263+
form.$setUntouched = function() {
264264
forEach(controls, function(control) {
265265
control.$setUntouched();
266266
});
@@ -273,7 +273,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) {
273273
* @description
274274
* Sets the form to its submitted state.
275275
*/
276-
form.$setSubmitted = function () {
276+
form.$setSubmitted = function() {
277277
$animate.addClass(element, SUBMITTED_CLASS);
278278
form.$submitted = true;
279279
parentForm.$setSubmitted();

src/ng/directive/input.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,7 +1839,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
18391839
* state (ng-pristine class). A model is considered to be pristine when the model has not been changed
18401840
* from when first compiled within then form.
18411841
*/
1842-
this.$setPristine = function () {
1842+
this.$setPristine = function() {
18431843
ctrl.$dirty = false;
18441844
ctrl.$pristine = true;
18451845
$animate.removeClass($element, DIRTY_CLASS);
@@ -1908,13 +1908,13 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
19081908
* angular.module('cancel-update-example', [])
19091909
*
19101910
* .controller('CancelUpdateController', ['$scope', function($scope) {
1911-
* $scope.resetWithCancel = function (e) {
1911+
* $scope.resetWithCancel = function(e) {
19121912
* if (e.keyCode == 27) {
19131913
* $scope.myForm.myInput1.$rollbackViewValue();
19141914
* $scope.myValue = '';
19151915
* }
19161916
* };
1917-
* $scope.resetWithoutCancel = function (e) {
1917+
* $scope.resetWithoutCancel = function(e) {
19181918
* if (e.keyCode == 27) {
19191919
* $scope.myValue = '';
19201920
* }
@@ -2405,7 +2405,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
24052405
.controller('ExampleController', ['$scope', function($scope) {
24062406
var _name = 'Brian';
24072407
$scope.user = {
2408-
name: function (newName) {
2408+
name: function(newName) {
24092409
if (angular.isDefined(newName)) {
24102410
_name = newName;
24112411
}
@@ -2907,7 +2907,7 @@ var ngValueDirective = function() {
29072907
.controller('ExampleController', ['$scope', function($scope) {
29082908
$scope.user = { name: 'say', data: '' };
29092909
2910-
$scope.cancel = function (e) {
2910+
$scope.cancel = function(e) {
29112911
if (e.keyCode == 27) {
29122912
$scope.userForm.userName.$rollbackViewValue();
29132913
}
@@ -2981,7 +2981,7 @@ var ngValueDirective = function() {
29812981
.controller('ExampleController', ['$scope', function($scope) {
29822982
var _name = 'Brian';
29832983
$scope.user = {
2984-
name: function (newName) {
2984+
name: function(newName) {
29852985
return angular.isDefined(newName) ? (_name = newName) : _name;
29862986
}
29872987
};

0 commit comments

Comments
 (0)