Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
fix(eslint): Inconsistent spacing before function parentheses (#1844)
Browse files Browse the repository at this point in the history
Defines `space-before-function-paren` eslint rule and changes files accordingly.
  • Loading branch information
simison authored Aug 14, 2017
1 parent 4fcf240 commit f44c9bc
Show file tree
Hide file tree
Showing 21 changed files with 214 additions and 210 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ module.exports = {
'one-var': [0, 'never'],
'one-var-declaration-per-line': [2, 'always'],
'padded-blocks': 0,
'space-before-function-paren': 0,
'space-before-function-paren': ['error', {
'anonymous': 'always',
'named': 'never',
'asyncArrow': 'always'
}],
'space-in-parens': [2, 'never'],
'spaced-comment': [2, 'always'],
strict: 0,
Expand Down
2 changes: 1 addition & 1 deletion config/lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var logger = new winston.Logger({
// Useful for integrating with stream-related mechanism like Morgan's stream
// option to log all HTTP requests to a file
logger.stream = {
write: function(msg) {
write: function (msg) {
logger.info(msg);
}
};
Expand Down
6 changes: 3 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ gulp.task('karma', function (done) {
});

// Run karma with coverage options set and write report
gulp.task('karma:coverage', function(done) {
gulp.task('karma:coverage', function (done) {
new KarmaServer({
configFile: __dirname + '/karma.conf.js',
preprocessors: {
Expand Down Expand Up @@ -427,12 +427,12 @@ gulp.task('protractor', ['webdriver_update'], function () {
.pipe(protractor({
configFile: 'protractor.conf.js'
}))
.on('end', function() {
.on('end', function () {
console.log('E2E Testing complete');
// exit with success.
process.exit(0);
})
.on('error', function(err) {
.on('error', function (err) {
console.error('E2E Tests failed:');
console.error(err);
process.exit(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function () {
(function () {
'use strict';

angular
Expand All @@ -19,7 +19,7 @@
// Remove existing Article
function remove() {
if ($window.confirm('Are you sure you want to delete?')) {
vm.article.$remove(function() {
vm.article.$remove(function () {
$state.go('admin.articles.list');
Notification.success({ message: '<i class="glyphicon glyphicon-ok"></i> Article deleted successfully!' });
});
Expand Down
2 changes: 1 addition & 1 deletion modules/core/client/app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

// Angular-ui-notification configuration
angular.module('ui-notification').config(function(NotificationProvider) {
angular.module('ui-notification').config(function (NotificationProvider) {
NotificationProvider.setOptions({
delay: 2000,
startTop: 20,
Expand Down
4 changes: 2 additions & 2 deletions modules/core/client/config/core.client.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
controller: 'ErrorController',
controllerAs: 'vm',
params: {
message: function($stateParams) {
message: function ($stateParams) {
return $stateParams.message;
}
},
Expand All @@ -53,7 +53,7 @@
controller: 'ErrorController',
controllerAs: 'vm',
params: {
message: function($stateParams) {
message: function ($stateParams) {
return $stateParams.message;
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

function link(scope, element, attrs) {
if ($window.innerWidth >= 800) {
$timeout(function() {
$timeout(function () {
var el = element[0];
el.focus();
el.selectionStart = el.selectionEnd = el.value.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
separator = ' - ',
stateTitle = applicationCoreTitle + separator;

toState.name.split('.').forEach(function(value, index) {
toState.name.split('.').forEach(function (value, index) {
stateTitle = stateTitle + value.charAt(0).toUpperCase() + value.slice(1) + separator;
});
if (toState.data && toState.data.pageTitle) {
Expand Down
20 changes: 10 additions & 10 deletions modules/core/client/services/menu.client.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.module('core')
.factory('menuService', menuService);

function menuService () {
function menuService() {
var shouldRender;
var service = {
addMenu: addMenu,
Expand All @@ -25,7 +25,7 @@
return service;

// Add new menu object by menu id
function addMenu (menuId, options) {
function addMenu(menuId, options) {
options = options || {};

// Create the new menu
Expand All @@ -40,7 +40,7 @@
}

// Add menu item object
function addMenuItem (menuId, options) {
function addMenuItem(menuId, options) {
// Validate that the menu exists
service.validateMenuExistence(menuId);

Expand Down Expand Up @@ -70,7 +70,7 @@
}

// Add submenu item object
function addSubMenuItem (menuId, parentItemState, options) {
function addSubMenuItem(menuId, parentItemState, options) {
options = options || {};

// Validate that the menu exists
Expand All @@ -95,15 +95,15 @@
}

// Get the menu object by menu id
function getMenu (menuId) {
function getMenu(menuId) {
// Validate that the menu exists
service.validateMenuExistence(menuId);

// Return the menu object
return service.menus[menuId];
}

function init () {
function init() {
// A private function for rendering decision
shouldRender = function (user) {
if (this.roles.indexOf('*') !== -1) {
Expand All @@ -128,15 +128,15 @@
}

// Remove existing menu object by menu id
function removeMenu (menuId) {
function removeMenu(menuId) {
// Validate that the menu exists
service.validateMenuExistence(menuId);

delete service.menus[menuId];
}

// Remove existing menu object by menu id
function removeMenuItem (menuId, menuItemState) {
function removeMenuItem(menuId, menuItemState) {
// Validate that the menu exists
service.validateMenuExistence(menuId);

Expand All @@ -150,7 +150,7 @@
}

// Remove existing menu object by menu id
function removeSubMenuItem (menuId, subMenuItemState) {
function removeSubMenuItem(menuId, subMenuItemState) {
// Validate that the menu exists
service.validateMenuExistence(menuId);

Expand All @@ -166,7 +166,7 @@
}

// Validate menu existence
function validateMenuExistence (menuId) {
function validateMenuExistence(menuId) {
if (!(menuId && menuId.length)) {
throw new Error('MenuId was not provided');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

(function() {
describe('authInterceptor', function() {
(function () {
describe('authInterceptor', function () {
// Initialize global variables
var authInterceptor,
$q,
Expand All @@ -13,11 +13,11 @@
beforeEach(module(ApplicationConfiguration.applicationModuleName));

// Load httpProvider
beforeEach(module(function($httpProvider) {
beforeEach(module(function ($httpProvider) {
httpProvider = $httpProvider;
}));

beforeEach(inject(function(_authInterceptor_, _$q_, _$state_, _Authentication_) {
beforeEach(inject(function (_authInterceptor_, _$q_, _$state_, _Authentication_) {
authInterceptor = _authInterceptor_;
$q = _$q_;
$state = _$state_;
Expand All @@ -26,19 +26,19 @@
spyOn($state, 'transitionTo');
}));

it('Auth Interceptor should be object', function() {
it('Auth Interceptor should be object', function () {
expect(typeof authInterceptor).toEqual('object');
});

it('Auth Interceptor should contain responseError function', function() {
it('Auth Interceptor should contain responseError function', function () {
expect(typeof authInterceptor.responseError).toEqual('function');
});

it('httpProvider Interceptor should have authInterceptor', function() {
it('httpProvider Interceptor should have authInterceptor', function () {
expect(httpProvider.interceptors).toContain('authInterceptor');
});

describe('Forbidden Interceptor', function() {
describe('Forbidden Interceptor', function () {
it('should redirect to forbidden route', function () {
var response = {
status: 403,
Expand All @@ -50,7 +50,7 @@
});
});

describe('Authorization Interceptor', function() {
describe('Authorization Interceptor', function () {
it('should redirect to signIn page for unauthorized access', function () {
var response = {
status: 401,
Expand All @@ -63,9 +63,9 @@
});
});

describe('Unresponsive Interceptor', function() {
describe('Unresponsive Interceptor', function () {
var Notification;
beforeEach(inject(function(_Notification_) {
beforeEach(inject(function (_Notification_) {
Notification = _Notification_;
spyOn(Notification, 'error');
}));
Expand Down
Loading

0 comments on commit f44c9bc

Please sign in to comment.