Skip to content

Commit

Permalink
fix lint, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Jun 13, 2019
1 parent 7b15218 commit 121438a
Show file tree
Hide file tree
Showing 16 changed files with 1,727 additions and 1,570 deletions.
27 changes: 27 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
"env": {
"node": true
},
"extends": "airbnb-base",
"rules" : {
"new-cap": [2 , { "capIsNewExceptions": ["Q", "ObjectId"] }],
"no-underscore-dangle": [2, { "allow": ["_id"] }]
},
overrides: [{
files: [
'test/**/*.js',
],
env: {
mocha: true
},
globals: {
rootRequire: true
},
rules: {
"prefer-destructuring": 0,
"prefer-arrow-callback": 0,
"func-names": 0,
'no-unused-expressions': 0,
}
}]
}
10 changes: 0 additions & 10 deletions .eslintrc.json

This file was deleted.

2 changes: 0 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const common = require('@authmaker/common');

const mongoAuditCount = require('./lib/mongo/auditCount');
Expand Down
3 changes: 1 addition & 2 deletions lib/mongo/auditCount.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const moment = require('moment');
const common = require('@authmaker/common');


const checkAccessToken = require('../common/checkAccessToken');

module.exports = function mongoVerify(accessToken, tag, since) {
Expand All @@ -16,6 +15,6 @@ module.exports = function mongoVerify(accessToken, tag, since) {
$gt: moment(since).toDate(),
};
}
return common.models.auditTrail.find(query).count().exec();
return common.models.auditTrail.find(query).countDocuments().exec();
});
};
2 changes: 1 addition & 1 deletion lib/mongo/rateLimited.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function mongoRateLimited(accessToken, tag, defaultScope) {
date: {
$gt: moment().subtract(1, period).toDate(),
},
}).count().exec().then((count) => {
}).countDocuments().exec().then((count) => {
if (count >= limit) {
throw new Error(`Too Many Requests: Rate limit exceeded for ${scope}`);
}
Expand Down
Loading

0 comments on commit 121438a

Please sign in to comment.