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

Commit

Permalink
style(*): add rule disallowSpacesInFunctionDeclaration beforeOpeningR…
Browse files Browse the repository at this point in the history
…oundBrace
  • Loading branch information
hzoo committed Oct 23, 2014
1 parent 7db03b8 commit 2110069
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .jscs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": ["!"],
"disallowSpaceBeforeBinaryOperators": [","],
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
Expand Down
6 changes: 3 additions & 3 deletions src/ng/directive/ngClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function classDirective(name, selector) {
attr.$removeClass(newClasses);
}

function digestClassCounts (classes, count) {
function digestClassCounts(classes, count) {
var classCounts = element.data('$classCounts') || {};
var classesToUpdate = [];
forEach(classes, function (className) {
Expand All @@ -53,7 +53,7 @@ function classDirective(name, selector) {
return classesToUpdate.join(' ');
}

function updateClasses (oldClasses, newClasses) {
function updateClasses(oldClasses, newClasses) {
var toAdd = arrayDifference(newClasses, oldClasses);
var toRemove = arrayDifference(oldClasses, newClasses);
toAdd = digestClassCounts(toAdd, 1);
Expand Down Expand Up @@ -95,7 +95,7 @@ function classDirective(name, selector) {
return values;
}

function arrayClasses (classVal) {
function arrayClasses(classVal) {
if (isArray(classVal)) {
return classVal;
} else if (isString(classVal)) {
Expand Down
2 changes: 1 addition & 1 deletion src/ng/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function LocationHashbangUrl(appBase, hashPrefix) {
* Inside of Angular, we're always using pathnames that
* do not include drive names for routing.
*/
function removeWindowsDriveName (path, url, base) {
function removeWindowsDriveName(path, url, base) {
/*
Matches paths for file protocol on windows,
such as /C:/foo/bar, and captures only /foo/bar.
Expand Down
4 changes: 2 additions & 2 deletions src/ngAria/aria.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
}])
.directive('ngModel', ['$aria', function($aria) {

function shouldAttachAttr (attr, elem) {
function shouldAttachAttr(attr, elem) {
return $aria.config(attr) && !elem.attr(attr);
}

function getShape (attr, elem) {
function getShape(attr, elem) {
var type = attr.type,
role = attr.role;

Expand Down
2 changes: 2 additions & 0 deletions test/auto/injectorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ describe('injector', function() {

it('should create $inject', function() {
var extraParans = angular.noop;
// jscs:disable disallowSpacesInFunctionDeclaration
// keep the multi-line to make sure we can handle it
function $f_n0 /*
*/(
Expand All @@ -172,6 +173,7 @@ describe('injector', function() {
*/
_c,
/* {some type} */ d) { extraParans();}
// jscs:enable disallowSpacesInFunctionDeclaration
expect(annotate($f_n0)).toEqual(['$a', 'b_', '_c', 'd']);
expect($f_n0.$inject).toEqual(['$a', 'b_', '_c', 'd']);
});
Expand Down
2 changes: 1 addition & 1 deletion test/ng/compileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ describe('$compile', function() {
describe('delay compile / linking functions until after template is resolved', function(){
var template;
beforeEach(module(function() {
function logDirective (name, priority, options) {
function logDirective(name, priority, options) {
directive(name, function(log) {
return (extend({
priority: priority,
Expand Down
2 changes: 1 addition & 1 deletion test/ngAria/ariaSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ function expectAriaAttrOnEachElement(elem, ariaAttr, expected) {
});
}

function configAriaProvider (config) {
function configAriaProvider(config) {
return function() {
angular.module('ariaTest', ['ngAria']).config(function($ariaProvider) {
$ariaProvider.config(config);
Expand Down

0 comments on commit 2110069

Please sign in to comment.