diff --git a/.jscs.json b/.jscs.json index af1ef2e8f769..ac8fc68f6b04 100644 --- a/.jscs.json +++ b/.jscs.json @@ -6,6 +6,9 @@ "disallowSpaceAfterObjectKeys": true, "disallowSpaceAfterPrefixUnaryOperators": ["!"], "disallowSpaceBeforeBinaryOperators": [","], + "disallowSpacesInAnonymousFunctionExpression": { + "beforeOpeningRoundBrace": true + }, "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, diff --git a/i18n/closure/currencySymbols.js b/i18n/closure/currencySymbols.js index 995b73afbcde..69b5a644bc73 100644 --- a/i18n/closure/currencySymbols.js +++ b/i18n/closure/currencySymbols.js @@ -267,7 +267,7 @@ goog.i18n.currency.adjustPrecision = function(pattern, currencyCode) { * 18: two decimals precision (2), currency sign last (16), no space (0) * 50: two decimals precision (2), currency sign last (16), space (32) * - * @type {!Object.} + * @type {!Object.>} */ goog.i18n.currency.CurrencyInfo = { 'AED': [2, 'dh', '\u062f.\u0625.', 'DH'], @@ -334,7 +334,7 @@ goog.i18n.currency.CurrencyInfo = { /** * Tier 2 currency information. - * @type {!Object.} + * @type {!Object.>} */ goog.i18n.currency.CurrencyInfoTier2 = { 'AFN': [48, 'Af.', 'AFN'], diff --git a/i18n/spec/closureI18nExtractorSpec.js b/i18n/spec/closureI18nExtractorSpec.js index f145596308d0..0b5a3faace14 100644 --- a/i18n/spec/closureI18nExtractorSpec.js +++ b/i18n/spec/closureI18nExtractorSpec.js @@ -56,7 +56,7 @@ function newTestLocaleInfo() { } -describe("findLocaleId", function () { +describe("findLocaleId", function() { it("should find the id from numbers", function() { expect(findLocaleId("NumberFormatSymbols_en_GB", "num")).toEqual("en_GB"); }); @@ -74,7 +74,7 @@ describe("findLocaleId", function () { }); }); -describe("extractNumberSymbols", function () { +describe("extractNumberSymbols", function() { it("should extract number data", function() { var CONTENT = [ "goog.provide('goog.i18n.NumberFormatSymbols_en_GB');", @@ -117,7 +117,7 @@ describe("extractNumberSymbols", function () { }) }); -describe("extractCurrencySymbols", function () { +describe("extractCurrencySymbols", function() { it("should extract currency data", function() { var CONTENT = [ "goog.i18n.currency.CurrencyInfo = {", @@ -137,7 +137,7 @@ describe("extractCurrencySymbols", function () { }); -describe("extractDateTimeSymbols", function () { +describe("extractDateTimeSymbols", function() { it("should extract date time data", function() { var CONTENT = [ "goog.i18n.DateTimeSymbols_fr_CA = {", diff --git a/i18n/src/closureI18nExtractor.js b/i18n/src/closureI18nExtractor.js index 67ea5ff76313..b8e6b7e978bb 100644 --- a/i18n/src/closureI18nExtractor.js +++ b/i18n/src/closureI18nExtractor.js @@ -87,6 +87,7 @@ function pluralExtractor(content, localeInfo) { continue; } var temp = goog.i18n.pluralRules.select.toString(). + replace(/function\s+\(/g, 'function('). replace(/goog\.i18n\.pluralRules\.Keyword/g, 'PLURAL_CATEGORY'). replace(/goog\.i18n\.pluralRules\.get_vf_/g, 'getVF'). replace(/goog\.i18n\.pluralRules\.get_wt_/g, 'getWT'). diff --git a/i18n/src/closureSlurper.js b/i18n/src/closureSlurper.js index 3dd5ce0358f6..764818373cbb 100755 --- a/i18n/src/closureSlurper.js +++ b/i18n/src/closureSlurper.js @@ -80,7 +80,7 @@ function writeLocaleFiles() { var filename = NG_LOCALE_DIR + 'angular-locale_' + correctedLocaleId + '.js' console.log('Writing ' + filename); return qfs.write(filename, content) - .then(function () { + .then(function() { console.log('Wrote ' + filename); ++num_files; }); diff --git a/src/jqLite.js b/src/jqLite.js index e7be752a694c..c3fdc7ecc68b 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -637,7 +637,7 @@ forEach({ if (isUndefined(value)) { if (element.multiple && nodeName_(element) === 'select') { var result = []; - forEach(element.options, function (option) { + forEach(element.options, function(option) { if (option.selected) { result.push(option.value || option.text); } @@ -710,7 +710,7 @@ forEach({ }); function createEventHandler(element, events) { - var eventHandler = function (event, type) { + var eventHandler = function(event, type) { // jQuery specific api event.isDefaultPrevented = function() { return event.defaultPrevented; diff --git a/src/minErr.js b/src/minErr.js index 489608582d29..c0d39a14149f 100644 --- a/src/minErr.js +++ b/src/minErr.js @@ -32,12 +32,12 @@ function minErr(module, ErrorConstructor) { ErrorConstructor = ErrorConstructor || Error; - return function () { + return function() { var code = arguments[0], prefix = '[' + (module ? module + ':' : '') + code + '] ', template = arguments[1], templateArgs = arguments, - stringify = function (obj) { + stringify = function(obj) { if (typeof obj === 'function') { return obj.toString().replace(/ \{[\s\S]*$/, ''); } else if (typeof obj === 'undefined') { @@ -49,7 +49,7 @@ function minErr(module, ErrorConstructor) { }, message, i; - message = prefix + template.replace(/\{\d+\}/g, function (match) { + message = prefix + template.replace(/\{\d+\}/g, function(match) { var index = +match.slice(1, -1), arg; if (index + 2 < templateArgs.length) { diff --git a/src/ng/animate.js b/src/ng/animate.js index 65280f764466..752ed0e15f6f 100644 --- a/src/ng/animate.js +++ b/src/ng/animate.js @@ -260,7 +260,7 @@ var $AnimateProvider = ['$provide', function($provide) { className = !isString(className) ? (isArray(className) ? className.join(' ') : '') : className; - forEach(element, function (element) { + forEach(element, function(element) { jqLiteAddClass(element, className); }); applyStyles(element, options); @@ -289,7 +289,7 @@ var $AnimateProvider = ['$provide', function($provide) { className = !isString(className) ? (isArray(className) ? className.join(' ') : '') : className; - forEach(element, function (element) { + forEach(element, function(element) { jqLiteRemoveClass(element, className); }); applyStyles(element, options); diff --git a/src/ng/directive/form.js b/src/ng/directive/form.js index 411ce6cbb503..9e4e7f1546fb 100644 --- a/src/ng/directive/form.js +++ b/src/ng/directive/form.js @@ -237,7 +237,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) { * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after * saving or resetting it. */ - form.$setPristine = function () { + form.$setPristine = function() { $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS); form.$dirty = false; form.$pristine = true; @@ -260,7 +260,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) { * Setting a form controls back to their untouched state is often useful when setting the form * back to its pristine state. */ - form.$setUntouched = function () { + form.$setUntouched = function() { forEach(controls, function(control) { control.$setUntouched(); }); @@ -273,7 +273,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) { * @description * Sets the form to its submitted state. */ - form.$setSubmitted = function () { + form.$setSubmitted = function() { $animate.addClass(element, SUBMITTED_CLASS); form.$submitted = true; parentForm.$setSubmitted(); diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index db514ec17396..9bd6dc979ab6 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -1839,7 +1839,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$ * state (ng-pristine class). A model is considered to be pristine when the model has not been changed * from when first compiled within then form. */ - this.$setPristine = function () { + this.$setPristine = function() { ctrl.$dirty = false; ctrl.$pristine = true; $animate.removeClass($element, DIRTY_CLASS); @@ -1908,13 +1908,13 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$ * angular.module('cancel-update-example', []) * * .controller('CancelUpdateController', ['$scope', function($scope) { - * $scope.resetWithCancel = function (e) { + * $scope.resetWithCancel = function(e) { * if (e.keyCode == 27) { * $scope.myForm.myInput1.$rollbackViewValue(); * $scope.myValue = ''; * } * }; - * $scope.resetWithoutCancel = function (e) { + * $scope.resetWithoutCancel = function(e) { * if (e.keyCode == 27) { * $scope.myValue = ''; * } @@ -2405,7 +2405,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$ .controller('ExampleController', ['$scope', function($scope) { var _name = 'Brian'; $scope.user = { - name: function (newName) { + name: function(newName) { if (angular.isDefined(newName)) { _name = newName; } @@ -2907,7 +2907,7 @@ var ngValueDirective = function() { .controller('ExampleController', ['$scope', function($scope) { $scope.user = { name: 'say', data: '' }; - $scope.cancel = function (e) { + $scope.cancel = function(e) { if (e.keyCode == 27) { $scope.userForm.userName.$rollbackViewValue(); } @@ -2981,7 +2981,7 @@ var ngValueDirective = function() { .controller('ExampleController', ['$scope', function($scope) { var _name = 'Brian'; $scope.user = { - name: function (newName) { + name: function(newName) { return angular.isDefined(newName) ? (_name = newName) : _name; } }; diff --git a/src/ng/directive/ngBind.js b/src/ng/directive/ngBind.js index 8385ee491658..8ddd11f1ad5b 100644 --- a/src/ng/directive/ngBind.js +++ b/src/ng/directive/ngBind.js @@ -90,7 +90,7 @@ var ngBindDirective = ['$compile', function($compile) {