Skip to content

Commit

Permalink
style: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Sep 13, 2018
1 parent 8840ffd commit 6dd98c8
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 24 deletions.
6 changes: 3 additions & 3 deletions lib/model.js
Expand Up @@ -1027,12 +1027,12 @@ Model.init = function init(callback) {
* schema. This function will drop any indexes that are not defined in
* the model's schema except the `_id` index, and build any indexes that
* are in your schema but not in MongoDB.
*
*
* See the [introductory blog post](http://thecodebarbarian.com/whats-new-in-mongoose-5-2-syncindexes)
* for more information.
*
*
* ####Example:
*
*
* const schema = new Schema({ name: { type: String, unique: true } });
* const Customer = mongoose.model('Customer', schema);
* await Customer.createIndex({ age: 1 }); // Index is not in schema
Expand Down
4 changes: 2 additions & 2 deletions lib/types/array.js
Expand Up @@ -142,8 +142,8 @@ MongooseArray.mixin = {
*/

_markModified: function(elem, embeddedPath) {
let parent = this._parent,
dirtyPath;
const parent = this._parent;
let dirtyPath;

if (parent) {
dirtyPath = this._path;
Expand Down
12 changes: 6 additions & 6 deletions lib/utils.js
Expand Up @@ -296,9 +296,9 @@ function cloneArray(arr, options) {
*/

exports.options = function(defaults, options) {
let keys = Object.keys(defaults),
i = keys.length,
k;
const keys = Object.keys(defaults);
let i = keys.length;
let k;

options = options || {};

Expand Down Expand Up @@ -670,9 +670,9 @@ exports.setValue = function(path, val, obj, map, _copying) {

exports.object = {};
exports.object.vals = function vals(o) {
let keys = Object.keys(o),
i = keys.length,
ret = [];
const keys = Object.keys(o);
let i = keys.length;
const ret = [];

while (i--) {
ret.push(o[keys[i]]);
Expand Down
8 changes: 3 additions & 5 deletions test/aggregate.test.js
Expand Up @@ -4,9 +4,9 @@
* Module dependencies
*/

const assert = require('assert');
const co = require('co');
const start = require('./common');
const assert = require('power-assert');

const mongoose = start.mongoose;
const Schema = mongoose.Schema;
Expand Down Expand Up @@ -635,11 +635,10 @@ describe('aggregate: ', function() {
model(db.model('Employee')).
group({ _id: '$dept' }).
exec(function(err, docs) {
let depts;
assert.ifError(err);
assert.equal(docs.length, 2);

depts = docs.map(function(doc) {
const depts = docs.map(function(doc) {
return doc._id;
});
assert.notEqual(depts.indexOf('sales'), -1);
Expand Down Expand Up @@ -918,10 +917,9 @@ describe('aggregate: ', function() {

it('with a callback', function(done) {
const aggregate = new Aggregate();
let callback;

aggregate.model(db.model('Employee'));
callback = function(err) {
const callback = function(err) {
assert.ok(err);
assert.equal(err.message, 'Aggregate has empty pipeline');
done();
Expand Down
11 changes: 7 additions & 4 deletions test/collection.capped.test.js
Expand Up @@ -4,7 +4,12 @@

'use strict';

let start = require('./common'), mongoose = start.mongoose, assert = require('power-assert'), Schema = mongoose.Schema, random = require('../lib/utils').random;
const assert = require('assert');
const random = require('../lib/utils').random;
const start = require('./common');

const mongoose = start.mongoose;
const Schema = mongoose.Schema;

/**
* setup
Expand Down Expand Up @@ -71,8 +76,6 @@ describe('collections: capped:', function() {
}
assert.ifError(err);

let timer;

db.on('error', function(err1) {
clearTimeout(timer);
db.close();
Expand All @@ -81,7 +84,7 @@ describe('collections: capped:', function() {
});

db.model('CappedExisting', capped, conn);
timer = setTimeout(function() {
const timer = setTimeout(function() {
db.close();
throw new Error('capped test timeout');
}, 900);
Expand Down
4 changes: 2 additions & 2 deletions test/collection.test.js
Expand Up @@ -38,8 +38,8 @@ describe('collections:', function() {
});

it('methods should that throw (unimplemented)', function(done) {
let collection = new Collection('test', mongoose.connection),
thrown = false;
const collection = new Collection('test', mongoose.connection);
let thrown = false;

try {
collection.getIndexes();
Expand Down
9 changes: 8 additions & 1 deletion test/colors.js
Expand Up @@ -4,7 +4,14 @@

'use strict';

let start = require('./common'), mongoose = start.mongoose, assert = require('power-assert'), Schema = mongoose.Schema, MongooseDocumentArray = mongoose.Types.DocumentArray, EmbeddedDocument = require('../lib/types/embedded'), DocumentArray = require('../lib/types/documentarray');
const DocumentArray = require('../lib/types/documentarray');
const EmbeddedDocument = require('../lib/types/embedded');
const assert = require('assert');
const start = require('./common');

const mongoose = start.mongoose;
const Schema = mongoose.Schema;
const MongooseDocumentArray = mongoose.Types.DocumentArray;

/**
* setup
Expand Down
1 change: 0 additions & 1 deletion test/webpack.test.js
Expand Up @@ -3,7 +3,6 @@
const acorn = require('acorn');
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const utils = require('../lib/utils');
const semver = require('semver');

Expand Down

0 comments on commit 6dd98c8

Please sign in to comment.