Skip to content

Commit 69bbcb4

Browse files
committed
Fix linting
1 parent 43034bf commit 69bbcb4

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

lib/backend/api/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = function (config) {
3030
router.get('/api/user/messages/index', auth.tokenAuth, jsonResponse((request) => {
3131
return db['users.messages'].findEx({ user: request.user._id }, { sort: { date: -1 } })
3232
.then(data => {
33-
var messages = []
33+
const messages = []
3434
data.forEach(message => {
3535
if (!messages.find(i => i._id === message.respondent)) {
3636
messages.push({ _id: message.respondent, message })
@@ -44,7 +44,7 @@ module.exports = function (config) {
4444
})
4545
}))
4646
router.post('/api/user/messages/mark-read', auth.tokenAuth, jsonResponse((request) => {
47-
var _id = request.body.id; var message
47+
const _id = request.body.id; let message
4848
console.log(_id, request.user._id)
4949
return db['users.messages'].findOne({ _id, user: request.user._id, type: 'in' })
5050
.then((_message) => {

lib/common/_connect.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const EventEmitter = require('events').EventEmitter
33
const { MongoClient, ObjectId } = require('mongodb')
44
const Redis = require('redis')
55
const fs = require('fs')
6+
const path = require('fs')
67

78
const DATABASE_VERSION = 9
89

@@ -287,7 +288,7 @@ module.exports = function (config) {
287288
}
288289

289290
exports.resetAllData = () => {
290-
return exports.importDB(`${__dirname}/../../db.original.json`).then((r) => q.when(r))
291+
return exports.importDB(path.join(__dirname, '/../../db.original.json')).then((r) => q.when(r))
291292
}
292293
Object.assign(config.common.storage, exports)
293294
return mongo
@@ -327,7 +328,7 @@ exports.importDB = async function importDB (path = './db.json') {
327328
} else {
328329
if (!db[name]) {
329330
console.log(`invalid collection in db.json: ${name}`)
330-
return
331+
return Promise.resolve()
331332
}
332333
return db[name].drop().then(() => Promise.all(oldcol.data.map(row => {
333334
delete row.meta

lib/common/queue.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = {
4343
fetch (name, cb) {
4444
const defer = q.defer()
4545
try {
46-
var check = function () {
46+
const check = function () {
4747
redis.rpoplpush(queues[name].pending, queues[name].processing)
4848
.then(item => {
4949
if (!item || item === 'nil') {
@@ -99,7 +99,7 @@ module.exports = {
9999
whenAllDone (name, cb) {
100100
const defer = q.defer()
101101
try {
102-
var check = function (reset) {
102+
const check = function (reset) {
103103
q.all([
104104
redis.llen(queues[name].pending),
105105
redis.llen(queues[name].processing)

lib/common/storage.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
module.exports = function (config) {
32
const storage = config.common.storage
43
config.common.dbIndexes = {

lib/engine/driver.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = function (config) {
2121
intents.notify = _.take(intents.notify, 20)
2222
}
2323

24-
var promises = [q.when()]
24+
const promises = [q.when()]
2525

2626
intents.notify.forEach((i) => {
2727
if (i.groupInterval < 0) {
@@ -32,9 +32,9 @@ module.exports = function (config) {
3232
}
3333
i.groupInterval *= 60 * 1000
3434
i.groupInterval = Math.floor(i.groupInterval)
35-
var date = i.groupInterval ? new Date(Math.ceil(new Date().getTime() / i.groupInterval) * i.groupInterval) : new Date()
35+
const date = i.groupInterval ? new Date(Math.ceil(new Date().getTime() / i.groupInterval) * i.groupInterval) : new Date()
3636

37-
var message = ('' + i.message).substring(0, 500)
37+
const message = ('' + i.message).substring(0, 500)
3838

3939
promises.push(db['users.notifications'].update({
4040
$and: [

0 commit comments

Comments
 (0)