style(*): add disallowTrailingComma rule for objects and arrays

Closes #9685
This commit is contained in:
Henry Zhu
2014-10-19 18:24:01 -04:00
committed by Peter Bacon Darwin
parent e4ce0ddda5
commit 8b921617e9
8 changed files with 18 additions and 17 deletions

View File

@@ -6,6 +6,7 @@
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": ["!"],
"disallowSpaceBeforeBinaryOperators": [","],
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"]
}

View File

@@ -960,7 +960,7 @@ describe('strict-di injector', function() {
it('should throw if magic annotation is used by provider', function() {
module(function($provide) {
$provide.provider({
'$test': function() { this.$get = function($rootScope) { return $rootScope; }; },
'$test': function() { this.$get = function($rootScope) { return $rootScope; }; }
});
});
inject(function($injector) {
@@ -974,7 +974,7 @@ describe('strict-di injector', function() {
it('should throw if magic annotation is used by factory', function() {
module(function($provide) {
$provide.factory({
'$test': function($rootScope) { return function() {}; },
'$test': function($rootScope) { return function() {}; }
});
});
inject(function($injector) {

View File

@@ -52,7 +52,7 @@ describe('module loader', function() {
['$provide', 'value', ['k', 'v'] ],
['$filterProvider', 'register', ['f', 'ff'] ],
['$compileProvider', 'directive', ['d', 'dd'] ],
['$controllerProvider', 'register', ['ctrl', 'ccc']],
['$controllerProvider', 'register', ['ctrl', 'ccc']]
]);
expect(myModule._configBlocks).toEqual([
['$injector', 'invoke', ['config'] ],

View File

@@ -54,7 +54,7 @@ function MockWindow(options) {
replace: function(url) {
locationHref = url;
mockWindow.history.state = null;
},
}
};
this.history = {
@@ -81,7 +81,7 @@ function MockWindow(options) {
ieState = value;
},
configurable: true,
enumerable: true,
enumerable: true
});
}
}

View File

@@ -295,7 +295,7 @@ describe('$compile', function() {
directive('svgCircleUrl', valueFn({
replace: true,
templateUrl: 'template.html',
templateNamespace: 'SVG',
templateNamespace: 'SVG'
}));
});
inject(function($compile, $rootScope, $httpBackend) {
@@ -1058,7 +1058,7 @@ describe('$compile', function() {
template: '<msup><mn>{{pow}}</mn></msup>',
templateNamespace: 'MATH',
scope: {
pow: '@pow',
pow: '@pow'
},
link: function(scope, elm, attr, ctrl, transclude) {
transclude(function(node) {
@@ -1972,7 +1972,7 @@ describe('$compile', function() {
templateUrl: 'template.html',
templateNamespace: 'math',
scope: {
pow: '@pow',
pow: '@pow'
},
link: function(scope, elm, attr, ctrl, transclude) {
transclude(function(node) {
@@ -3185,7 +3185,7 @@ describe('$compile', function() {
'toString': '&',
// Spidermonkey extension, may be obsolete in the future
'watch': '=',
'watch': '='
}
}));
});

View File

@@ -1988,7 +1988,7 @@ describe('select', function() {
createSelect({
'name': 'select',
'ng-model': 'value',
'ng-options': 'item for item in [\'first\', \'second\', \'third\', \'fourth\']',
'ng-options': 'item for item in [\'first\', \'second\', \'third\', \'fourth\']'
});
scope.form.select.$parsers.push(function(value) {
@@ -2005,7 +2005,7 @@ describe('select', function() {
createSelect({
'name': 'select',
'ng-model': 'value',
'ng-options': 'item for item in [\'the first\', \'the second\', \'the third\', \'the fourth\']',
'ng-options': 'item for item in [\'the first\', \'the second\', \'the third\', \'the fourth\']'
});
scope.form.select.$formatters.push(function(value) {
@@ -2022,7 +2022,7 @@ describe('select', function() {
createSelect({
'name': 'select',
'ng-model': 'value',
'ng-options': 'item for item in [\'first\', \'second\', \'third\', \'fourth\']',
'ng-options': 'item for item in [\'first\', \'second\', \'third\', \'fourth\']'
});
scope.form.select.$validators.fail = function() {
@@ -2040,7 +2040,7 @@ describe('select', function() {
createSelect({
'name': 'select',
'ng-model': 'value',
'ng-options': 'item for item in [\'first\', \'second\', \'third\', \'fourth\']',
'ng-options': 'item for item in [\'first\', \'second\', \'third\', \'fourth\']'
});
scope.form.select.$validators.pass = function() {
@@ -2059,7 +2059,7 @@ describe('select', function() {
createSelect({
'name': 'select',
'ng-model': 'value',
'ng-options': 'item for item in [\'first\', \'second\', \'third\', \'fourth\']',
'ng-options': 'item for item in [\'first\', \'second\', \'third\', \'fourth\']'
});
scope.form.select.$asyncValidators.async = function() {
@@ -2085,7 +2085,7 @@ describe('select', function() {
createSelect({
'name': 'select',
'ng-model': 'value',
'ng-options': 'item for item in [\'first\', \'second\', \'third\', \'fourth\']',
'ng-options': 'item for item in [\'first\', \'second\', \'third\', \'fourth\']'
});
scope.form.select.$asyncValidators.async = function() {

View File

@@ -39,7 +39,7 @@ describe('$$rAF', function() {
var injector = createInjector(['ng', function($provide) {
$provide.value('$timeout', timeoutSpy);
$provide.value('$window', {
location: window.location,
location: window.location
});
}]);

View File

@@ -361,7 +361,7 @@ describe('ngMessages', function() {
$rootScope.$apply(function() {
$rootScope.data = {
'a': 1,
'b': 2,
'b': 2
};
});