Skip to content

Commit a788b00

Browse files
author
Nishanth Vijayan
committed
Add linting using jshint
1 parent 6963636 commit a788b00

10 files changed

+20
-13
lines changed

.jshintrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"esversion":6
3+
}

aggregate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var aggregate = function(){
3939
return {
4040
"ongoing": ongoing_contests,
4141
"upcoming": upcoming_contests
42-
}
42+
};
4343
});
4444
};
4545

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"main": "index.js",
66
"scripts": {
77
"start": "SET NODE_ENV=dev && node server.js",
8-
"test": "mocha --timeout 30000"
8+
"test": "mocha --timeout 30000",
9+
"lint": "jshint --exclude ./node_modules ."
910
},
1011
"repository": {
1112
"type": "git",
@@ -25,6 +26,7 @@
2526
"devDependencies": {
2627
"chai": "^4.0.2",
2728
"chai-http": "^3.0.0",
29+
"jshint": "^2.9.5",
2830
"mocha": "^3.4.2"
2931
}
3032
}

parsers/atcoder.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var contest_url = function(name){
99
return "http://abc" + name.slice(-3) + ".contest.atcoder.jp/";
1010
}
1111
return "https://atcoder.jp/contest";
12-
}
12+
};
1313

1414
var atcoder = function(){
1515
return axios.get("https://clients6.google.com/calendar/v3/calendars/atcoder.jp_evjr135c62bddnpd26lotmdicg@group.calendar.google.com/events?calendarId=atcoder.jp_evjr135c62bddnpd26lotmdicg%40group.calendar.google.com&timeMin=2017-06-25T00%3A00%3A00%2B09%3A00&key=AIzaSyBNlYH01_9Hc5S1J9vuFmu2nUqBZJNAXxs", {timeout: 15000})
@@ -28,7 +28,7 @@ var atcoder = function(){
2828
// so assume duration 2hrs as they tend to be in Atcoder
2929
"end_time": start_time + (2 * 60* 60),
3030
"duration": (2 * 60* 60),
31-
}
31+
};
3232
});
3333

3434
return contests;

parsers/codechef.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ function parseContestDetails($, contest_row){
1212
"start_time": start_time,
1313
"end_time": end_time,
1414
"duration": (end_time - start_time),
15-
}
15+
};
1616
}
1717

1818
var codechef = function(){
1919
return axios.get("http://www.codechef.com/contests", {timeout: 30000})
2020
.then(function(response){
2121
var $ = cheerio.load(response.data);
22-
var statusdiv = $("table .dataTable")
23-
var headings = $("h3")
24-
var contest_tables = {"Future Contests": [], "Present Contests": []}
22+
var statusdiv = $("table .dataTable");
23+
var headings = $("h3");
24+
var contest_tables = {"Future Contests": [], "Present Contests": []};
2525
for (var i = 0; i < headings.length; i++) {
2626
if(headings.eq(i).text() != "Past Contests"){
2727
contest_tables[headings.eq(i).text()] = statusdiv.eq(i).find("tr").slice(1);

parsers/codeforces.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var codeforces = function(){
55
.then(function(response){
66
contests = response.data.result
77
.filter(function(contest){
8-
return contest.phase.trim() != 'FINISHED'
8+
return contest.phase.trim() != 'FINISHED';
99
}).map(function(contest){
1010
return {
1111
"name": contest.name,
@@ -14,7 +14,7 @@ var codeforces = function(){
1414
"start_time": contest.startTimeSeconds,
1515
"end_time": (contest.startTimeSeconds + contest.durationSeconds),
1616
"duration": contest.durationSeconds,
17-
}
17+
};
1818
});
1919
return contests;
2020
})

parsers/hackerearth.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var hackerearth = function(){
1414
"start_time": start_time,
1515
"end_time": end_time,
1616
"duration": (end_time - start_time),
17-
}
17+
};
1818
});
1919

2020
return contests;

parsers/hackerrank.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var hackerrank = function(type){
1717
"start_time": start_time,
1818
"end_time": end_time,
1919
"duration": (end_time - start_time),
20-
}
20+
};
2121
});
2222

2323
return contests;

parsers/topcoder.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var topcoder = function(){
2020
"start_time": start_time,
2121
"end_time": end_time,
2222
"duration": (end_time - start_time),
23-
}
23+
};
2424
});
2525

2626
return contests;

test/filter.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/*jshint expr: true*/
2+
13
process.env.NODE_ENV = 'test';
24
var chai = require('chai');
35
var chaiHttp = require('chai-http');

0 commit comments

Comments
 (0)