Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit a07ae41

Browse files
author
Nick Litwin
committed
Enforce linting
1 parent 7bfd86f commit a07ae41

File tree

87 files changed

+989
-1120
lines changed

Some content is hidden

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

87 files changed

+989
-1120
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/*
2+
assets/*
3+
report/*

.eslintrc.json

+2-14
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,12 @@
66
"quotes": [2, "single"],
77
"semi": [2, "never"]
88
},
9-
"globals": {
10-
"expect": true,
11-
"bard": true,
12-
"$rootScope": true,
13-
"$controller": true,
14-
"$compile": true,
15-
"$timeout": true,
16-
"$httpBackend": true,
17-
"$state": true,
18-
"sinon": true,
19-
"$q": true,
20-
"$": true
21-
},
229
"env": {
2310
"es6": true,
2411
"browser": true,
2512
"node": true,
26-
"mocha": true
13+
"mocha": true,
14+
"jquery": true
2715
},
2816
"extends": "eslint:recommended",
2917
"ecmaFeatures": {

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_js:
44
install:
55
- npm install
66
script:
7+
- npm run lint
78
- npm test
89
- npm run build
910
sudo: false

app/account/login/login.controller.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,15 @@ import angular from 'angular'
115115
return Helpers.redirectPostLogin($stateParams.next)
116116
})
117117
.catch(function(resp) {
118+
/*eslint no-fallthrough:0*/
118119
switch (resp.status) {
119-
case "ACCOUNT_INACTIVE":
120-
window.location.href = "https://www." + CONSTANTS.domain + "/account-inactive/"
121-
case "USER_NOT_REGISTERED":
122-
default:
123-
vm.socialLoginError = 401
124-
vm.loginErrors.SOCIAL_LOGIN_ERROR = true
125-
break
120+
case 'ACCOUNT_INACTIVE':
121+
window.location.href = 'https://www.' + CONSTANTS.domain + '/account-inactive/'
122+
case 'USER_NOT_REGISTERED':
123+
default:
124+
vm.socialLoginError = 401
125+
vm.loginErrors.SOCIAL_LOGIN_ERROR = true
126+
break
126127
}
127128
})
128129
}

app/account/login/login.spec.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*eslint no-undef:0*/
12
describe('Login Controller', function() {
23
var controller
34
var scope

app/account/logout/logout.controller.spec.js renamed to app/account/logout/logout.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
/*eslint no-undef:0*/
12
import angular from 'angular'
23

3-
/* jshint -W117, -W030 */
44
describe('Logout Controller', function() {
55
var controller
66
var fakeWindow = {

app/account/register/register.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* jshint -W117, -W030 */
1+
/*eslint no-undef:0*/
22
describe('Register Controller', function() {
33
var controller
44

app/account/reset-password/reset-password.spec.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/* jshint -W117, -W030 */
1+
/*eslint no-undef:0*/
22
describe('Reset Password Controller', function() {
33
var controller
4-
var apiUrl = 'https://api.topcoder-dev.com/v3'
54

65
beforeEach(function() {
76
bard.appModule('topcoder')
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import angular from 'angular'
2+
13
// Include in index.html so that app level exceptions are handled.
24
// Exclude from testRunner.html which should run exactly what it wants to run
35
(function () {
4-
'use strict';
6+
'use strict'
57

68
angular
79
.module('blocks.exception')
810
.provider('exceptionHandler', exceptionHandlerProvider)
9-
.config(config);
11+
.config(config)
1012

1113
/**
1214
* Must configure the exception handling
@@ -16,18 +18,18 @@
1618
/* jshint validthis:true */
1719
this.config = {
1820
appErrorPrefix: undefined
19-
};
21+
}
2022

2123
this.configure = function (appErrorPrefix) {
22-
this.config.appErrorPrefix = appErrorPrefix;
23-
};
24+
this.config.appErrorPrefix = appErrorPrefix
25+
}
2426

2527
this.$get = function () {
26-
return {config: this.config};
27-
};
28+
return {config: this.config}
29+
}
2830
}
2931

30-
config.$inject = ['$provide'];
32+
config.$inject = ['$provide']
3133

3234
/**
3335
* Configure by setting an optional string value for appErrorPrefix.
@@ -37,10 +39,10 @@
3739
* @ngInject
3840
*/
3941
function config($provide) {
40-
$provide.decorator('$exceptionHandler', extendExceptionHandler);
42+
$provide.decorator('$exceptionHandler', extendExceptionHandler)
4143
}
4244

43-
extendExceptionHandler.$inject = ['$delegate', 'exceptionHandler', 'logger'];
45+
extendExceptionHandler.$inject = ['$delegate', 'exceptionHandler', 'logger']
4446

4547
/**
4648
* Extend the $exceptionHandler service to also display a toast.
@@ -51,20 +53,20 @@
5153
*/
5254
function extendExceptionHandler($delegate, exceptionHandler, logger) {
5355
return function (exception, cause) {
54-
var appErrorPrefix = exceptionHandler.config.appErrorPrefix || '';
55-
var errorData = {exception: exception, cause: cause};
56-
exception.message = appErrorPrefix + exception.message;
57-
$delegate(exception, cause);
56+
var appErrorPrefix = exceptionHandler.config.appErrorPrefix || ''
57+
var errorData = {exception: exception, cause: cause}
58+
exception.message = appErrorPrefix + exception.message
59+
$delegate(exception, cause)
5860
/**
5961
* Could add the error to a service's collection,
6062
* add errors to $rootScope, log errors to remote web server,
6163
* or log locally. Or throw hard. It is entirely up to you.
62-
* throw exception;
64+
* throw exception
6365
*
6466
* @example
65-
* throw { message: 'error message we added' };
67+
* throw { message: 'error message we added' }
6668
*/
67-
logger.error(exception.message, errorData);
68-
};
69+
logger.error(exception.message, errorData)
70+
}
6971
}
70-
})();
72+
})()

app/blocks/exception/exception-handler.provider.spec.js

-67
This file was deleted.

app/blocks/exception/exception.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1+
import angular from 'angular'
2+
13
(function () {
2-
'use strict';
4+
'use strict'
35

4-
angular
5-
.module('blocks.exception')
6-
.factory('exception', exception);
6+
angular.module('blocks.exception').factory('exception', exception)
77

8-
exception.$inject = ['logger'];
8+
exception.$inject = ['logger']
99

10-
/* @ngInject */
1110
function exception(logger) {
1211
var service = {
1312
catcher: catcher
14-
};
15-
return service;
13+
}
14+
return service
1615

1716
function catcher(message) {
1817
return function (reason) {
19-
logger.error(message, reason);
20-
};
18+
logger.error(message, reason)
19+
}
2120
}
2221
}
23-
})();
22+
})()
+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import angular from 'angular'
2+
13
(function () {
2-
'use strict';
4+
'use strict'
35

4-
angular.module('blocks.exception', ['blocks.logger']);
5-
})();
6+
angular.module('blocks.exception', ['blocks.logger'])
7+
})()

0 commit comments

Comments
 (0)