Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run lint as part of test #3829

Merged
merged 4 commits into from
Feb 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ rules:
- 2
- SwitchCase: 1
VariableDeclarator: 2
key-spacing: 1
keyword-spacing: 2
no-console: 0
no-multi-spaces: 1
no-multi-spaces: 2
no-spaced-func: 2
no-trailing-spaces: 2
quotes:
- 2
- single
semi: 2
space-after-keywords: 2
space-before-blocks: 2
space-before-function-paren:
- 2
- never
space-before-keywords: 2
space-infix-ops: 2
space-return-throw-case: 2
space-unary-ops: 1
space-unary-ops: 2
16 changes: 8 additions & 8 deletions benchmarks/benchjs/casting.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,44 +92,44 @@ var commentData = {
BlogPost = mongoose.model('BlogPost', BlogPost);

suite.add('Casting - Embedded Docs - 0 Docs', {
fn: function () {
fn: function() {
var BlogPost = mongoose.model('BlogPost');
var bp = new BlogPost();
bp.init(blogData);
}
}).add('Casting - Embedded Docs - 10 Docs', {
fn: function () {
fn: function() {
var BlogPost = mongoose.model('BlogPost');
var bp = new BlogPost();
bp.init(blogData10);
}
}).add('Casting - Embedded Docs - 100 Docs', {
fn: function () {
fn: function() {
var BlogPost = mongoose.model('BlogPost');
var bp = new BlogPost();
bp.init(blogData100);
}
}).add('Casting - Embedded Docs - 1000 Docs', {
fn: function () {
fn: function() {
var BlogPost = mongoose.model('BlogPost');
var bp = new BlogPost();
bp.init(blogData1000);
}
}).add('Casting - Embedded Docs - 10000 Docs', {
fn: function () {
fn: function() {
var BlogPost = mongoose.model('BlogPost');
var bp = new BlogPost();
bp.init(blogData10000);
}
})
.on('cycle', function (evt) {
.on('cycle', function(evt) {
if (process.env.MONGOOSE_DEV || process.env.PULL_REQUEST) {
console.log(String(evt.target));
}
}).on('complete', function () {
}).on('complete', function() {
if (!process.env.MONGOOSE_DEV && !process.env.PULL_REQUEST) {
var outObj = {};
this.forEach(function (item) {
this.forEach(function(item) {
var out = {};
out.stats = item.stats;
delete out.stats.sample;
Expand Down
26 changes: 13 additions & 13 deletions benchmarks/benchjs/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ var mongo = require('mongodb');
*/


mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {
mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
if (err) {
throw err;
}
mongo.connect('mongodb://localhost/mongoose-bench', function (err, db) {
mongo.connect('mongodb://localhost/mongoose-bench', function(err, db) {
if (err) {
throw err;
}
Expand All @@ -48,7 +48,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {
// insert all of the data here
var count = 1000;
for (var i = 0; i < 500; i++) {
User.create(data, function (err, u) {
User.create(data, function(err, u) {
if (err) {
throw err;
}
Expand All @@ -60,20 +60,20 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {
nData.age = data.age;
nData.likes = data.likes;
nData.address = data.address;
user.insert(nData, function (err, res) {
user.insert(nData, function(err, res) {
dIds.push(res[0]._id);
--count || next();
});
}

function closeDB() {
User.count(function (err, res) {
User.count(function(err, res) {
if (res !== 0) {
console.log('Still mongoose entries left...');
}
mongoose.disconnect();
});
user.count({}, function (err, res) {
user.count({}, function(err, res) {
if (res !== 0) {
console.log('Still driver entries left...');
}
Expand All @@ -86,8 +86,8 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {

suite.add('Delete - Mongoose', {
defer: true,
fn: function (deferred) {
User.remove({_id: mIds.pop()}, function (err) {
fn: function(deferred) {
User.remove({_id: mIds.pop()}, function(err) {
if (err) {
throw err;
}
Expand All @@ -96,24 +96,24 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {
}
}).add('Delete - Driver', {
defer: true,
fn: function (deferred) {
user.remove({_id: dIds.pop()}, function (err) {
fn: function(deferred) {
user.remove({_id: dIds.pop()}, function(err) {
if (err) {
throw err;
}
deferred.resolve();
});
}
})
.on('cycle', function (evt) {
.on('cycle', function(evt) {
if (process.env.MONGOOSE_DEV || process.env.PULL_REQUEST) {
console.log(String(evt.target));
}
}).on('complete', function () {
}).on('complete', function() {
closeDB();
if (!process.env.MONGOOSE_DEV && !process.env.PULL_REQUEST) {
var outObj = {};
this.forEach(function (item) {
this.forEach(function(item) {
var out = {};
out.stats = item.stats;
delete out.stats.sample;
Expand Down
28 changes: 14 additions & 14 deletions benchmarks/benchjs/insert.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ var ObjectId = Schema.Types.ObjectId;
*/


mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {
mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
if (err) {
throw err;
}
mongo.connect('mongodb://localhost/mongoose-bench', function (err, db) {
mongo.connect('mongodb://localhost/mongoose-bench', function(err, db) {
if (err) {
throw err;
}
Expand Down Expand Up @@ -103,17 +103,17 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {
var blogpost = db.collection('blogpost');

function closeDB() {
mongoose.connection.db.dropDatabase(function () {
mongoose.connection.db.dropDatabase(function() {
mongoose.disconnect();
process.exit();
});
}

suite.add('Insert - Mongoose - Basic', {
defer: true,
fn: function (deferred) {
fn: function(deferred) {
var nData = utils.clone(data);
User.create(nData, function (err) {
User.create(nData, function(err) {
if (err) {
throw err;
}
Expand All @@ -122,9 +122,9 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {
}
}).add('Insert - Driver - Basic', {
defer: true,
fn: function (deferred) {
fn: function(deferred) {
var nData = utils.clone(data);
user.insert(nData, function (err) {
user.insert(nData, function(err) {
if (err) {
throw err;
}
Expand All @@ -133,9 +133,9 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {
}
}).add('Insert - Mongoose - Embedded Docs', {
defer: true,
fn: function (deferred) {
fn: function(deferred) {
var bp = utils.clone(blogData);
BlogPost.create(bp, function (err) {
BlogPost.create(bp, function(err) {
if (err) {
throw err;
}
Expand All @@ -144,25 +144,25 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {
}
}).add('Insert - Driver - Embedded Docs', {
defer: true,
fn: function (deferred) {
fn: function(deferred) {
var bp = utils.clone(blogData);
blogpost.insert(bp, function (err) {
blogpost.insert(bp, function(err) {
if (err) {
throw err;
}
deferred.resolve();
});
}
})
.on('cycle', function (evt) {
.on('cycle', function(evt) {
if (process.env.MONGOOSE_DEV || process.env.PULL_REQUEST) {
console.log(String(evt.target));
}
}).on('complete', function () {
}).on('complete', function() {
closeDB();
if (!process.env.MONGOOSE_DEV && !process.env.PULL_REQUEST) {
var outObj = {};
this.forEach(function (item) {
this.forEach(function(item) {
var out = {};
out.stats = item.stats;
delete out.stats.sample;
Expand Down
Loading