eslint: manually fix remaining problems

This commit is contained in:
Miroslav Bajtoš 2018-12-07 16:22:36 +01:00
parent 481ad566d2
commit b03ee61d37
No known key found for this signature in database
GPG Key ID: 6F2304BA9361C7E3
25 changed files with 94 additions and 85 deletions

View File

@ -33,14 +33,13 @@ KeyValueMemoryConnector.prototype._setupRegularCleanup = function() {
// in order to release memory. Note that GET operation checks // in order to release memory. Note that GET operation checks
// key expiration too, the scheduled cleanup is merely a performance // key expiration too, the scheduled cleanup is merely a performance
// optimization. // optimization.
const self = this; this._cleanupTimer = setInterval(
var timer = this._cleanupTimer = setInterval( () => {
function() { if (this && this._removeExpiredItems) {
if (self && self._removeExpiredItems) { this._removeExpiredItems();
self._removeExpiredItems();
} else { } else {
// The datasource/connector was destroyed - cancel the timer // The datasource/connector was destroyed - cancel the timer
clearInterval(timer); clearInterval(this._cleanupTimer);
} }
}, },
1000 1000

View File

@ -119,7 +119,7 @@ Memory.prototype.setupFileQueue = function() {
const file = self.settings.file; const file = self.settings.file;
if (task.operation === 'write') { if (task.operation === 'write') {
// Flush out the models/ids // Flush out the models/ids
var data = JSON.stringify({ const data = JSON.stringify({
ids: self.ids, ids: self.ids,
models: self.cache, models: self.cache,
}, null, ' '); }, null, ' ');
@ -130,7 +130,7 @@ Memory.prototype.setupFileQueue = function() {
callback(err, task.data); callback(err, task.data);
}); });
} else if (task.operation === 'read') { } else if (task.operation === 'read') {
debug('Reading cache from %s: %s', file, data); debug('Reading cache from %s', file);
fs.readFile(file, { fs.readFile(file, {
encoding: 'utf8', encoding: 'utf8',
flag: 'r', flag: 'r',

View File

@ -91,8 +91,9 @@ Transient.prototype.count = function count(model, callback, where) {
Transient.prototype.create = function create(model, data, callback) { Transient.prototype.create = function create(model, data, callback) {
const props = this._models[model].properties; const props = this._models[model].properties;
const idName = this.idName(model); const idName = this.idName(model);
let id = undefined;
if (idName && props[idName]) { if (idName && props[idName]) {
var id = this.getIdValue(model, data) || this.generateId(model, data, idName); id = this.getIdValue(model, data) || this.generateId(model, data, idName);
id = (props[idName] && props[idName].type && props[idName].type(id)) || id; id = (props[idName] && props[idName].type && props[idName].type(id)) || id;
this.setIdValue(model, data, id); this.setIdValue(model, data, id);
} }

View File

@ -89,9 +89,9 @@ function convertSubsetOfPropertiesByType(inst, data) {
function applyStrictCheck(model, strict, data, inst, cb) { function applyStrictCheck(model, strict, data, inst, cb) {
const props = model.definition.properties; const props = model.definition.properties;
const keys = Object.keys(data); const keys = Object.keys(data);
let result = {}, key; const result = {};
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
key = keys[i]; const key = keys[i];
if (props[key]) { if (props[key]) {
result[key] = data[key]; result[key] = data[key];
} else if (strict && strict !== 'filter') { } else if (strict && strict !== 'filter') {
@ -1105,7 +1105,8 @@ DataAccessObject.findOrCreate = function findOrCreate(query, data, options, cb)
if (err) return cb(err); if (err) return cb(err);
data = ctx.data; data = ctx.data;
let obj, Model = self.lookupModel(data); const Model = self.lookupModel(data);
let obj;
if (data) { if (data) {
obj = new Model(data, {fields: query.fields, applySetters: false, obj = new Model(data, {fields: query.fields, applySetters: false,
@ -2594,9 +2595,10 @@ DataAccessObject.replaceById = function(id, data, options, cb) {
const pkName = idName(this); const pkName = idName(this);
if (!data[pkName]) data[pkName] = id; if (!data[pkName]) data[pkName] = id;
let Model = this;
let inst;
try { try {
var Model = this; inst = new Model(data, {persisted: true});
var inst = new Model(data, {persisted: true});
const enforced = {}; const enforced = {};
this.applyProperties(enforced, inst); this.applyProperties(enforced, inst);
@ -2808,7 +2810,7 @@ function(data, options, cb) {
for (let i = 0, n = idNames.length; i < n; i++) { for (let i = 0, n = idNames.length; i < n; i++) {
const idName = idNames[i]; const idName = idNames[i];
if (data[idName] !== undefined && !idEquals(data[idName], inst[idName])) { if (data[idName] !== undefined && !idEquals(data[idName], inst[idName])) {
var err = new Error(g.f('{{id}} cannot be updated from ' + const err = new Error(g.f('{{id}} cannot be updated from ' +
'%s to %s when {{forceId}} is set to true', '%s to %s when {{forceId}} is set to true',
inst[idName], data[idName])); inst[idName], data[idName]));
err.statusCode = 400; err.statusCode = 400;

View File

@ -2275,7 +2275,7 @@ DataSource.prototype.transaction = function(execute, options, cb) {
}); });
}); });
var done = function(err) { let done = function(err) {
if (err) { if (err) {
transaction.rollback(function(error) { transaction.rollback(function(error) {
cb(err || error); cb(err || error);

View File

@ -12,6 +12,10 @@ const assert = require('assert');
*/ */
exports.nearFilter = function nearFilter(where) { exports.nearFilter = function nearFilter(where) {
const nearResults = [];
nearSearch(where);
return (!nearResults.length ? false : nearResults);
function nearSearch(clause, parentKeys) { function nearSearch(clause, parentKeys) {
if (typeof clause !== 'object') { if (typeof clause !== 'object') {
return false; return false;
@ -41,10 +45,6 @@ exports.nearFilter = function nearFilter(where) {
} }
}); });
} }
var nearResults = [];
nearSearch(where);
return (!nearResults.length ? false : nearResults);
}; };
/*! /*!

View File

@ -505,8 +505,10 @@ Inclusion.include = function(objects, include, options, cb) {
function linkManyToMany(target, next) { function linkManyToMany(target, next) {
const targetId = target[modelToIdName]; const targetId = target[modelToIdName];
if (!targetId) { if (!targetId) {
const err = new Error(g.f('LinkManyToMany received target that doesn\'t contain required "%s"', const err = new Error(g.f(
modelToIdName)); 'LinkManyToMany received target that doesn\'t contain required "%s"',
modelToIdName
));
return next(err); return next(err);
} }
const objList = targetObjsMap[targetId.toString()]; const objList = targetObjsMap[targetId.toString()];

View File

@ -229,7 +229,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
hiddenProperty(ModelClass, '_warned', {}); hiddenProperty(ModelClass, '_warned', {});
// inherit ModelBaseClass static methods // inherit ModelBaseClass static methods
for (var i in ModelBaseClass) { for (const i in ModelBaseClass) {
// We need to skip properties that are already in the subclass, for example, the event emitter methods // We need to skip properties that are already in the subclass, for example, the event emitter methods
if (i !== '_mixins' && !(i in ModelClass)) { if (i !== '_mixins' && !(i in ModelClass)) {
ModelClass[i] = ModelBaseClass[i]; ModelClass[i] = ModelBaseClass[i];
@ -306,7 +306,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
idNames = modelDefinition.idNames(); // Reload it after rebuild idNames = modelDefinition.idNames(); // Reload it after rebuild
// Create a virtual property 'id' // Create a virtual property 'id'
if (idNames.length === 1) { if (idNames.length === 1) {
var idProp = idNames[0]; const idProp = idNames[0];
if (idProp !== 'id') { if (idProp !== 'id') {
Object.defineProperty(ModelClass.prototype, 'id', { Object.defineProperty(ModelClass.prototype, 'id', {
get: function() { get: function() {
@ -323,7 +323,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
get: function() { get: function() {
const compositeId = {}; const compositeId = {};
const idNames = ModelClass.definition.idNames(); const idNames = ModelClass.definition.idNames();
for (var i = 0, p; i < idNames.length; i++) { for (let i = 0, p; i < idNames.length; i++) {
p = idNames[i]; p = idNames[i];
compositeId[p] = this.__data[p]; compositeId[p] = this.__data[p];
} }
@ -339,7 +339,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
let forceId = ModelClass.settings.forceId; let forceId = ModelClass.settings.forceId;
if (idNames.length > 0) { if (idNames.length > 0) {
const idName = modelDefinition.idName(); const idName = modelDefinition.idName();
idProp = ModelClass.definition.rawProperties[idName]; const idProp = ModelClass.definition.rawProperties[idName];
if (idProp.generated && forceId !== false) { if (idProp.generated && forceId !== false) {
forceId = 'auto'; forceId = 'auto';
} else if (!idProp.generated && forceId === 'auto') { } else if (!idProp.generated && forceId === 'auto') {
@ -624,7 +624,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
const props = ModelClass.definition.properties; const props = ModelClass.definition.properties;
let keys = Object.keys(props); let keys = Object.keys(props);
let size = keys.length; let size = keys.length;
for (i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
const propertyName = keys[i]; const propertyName = keys[i];
ModelClass.registerProperty(propertyName); ModelClass.registerProperty(propertyName);
} }
@ -632,8 +632,8 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
const mixinSettings = settings.mixins || {}; const mixinSettings = settings.mixins || {};
keys = Object.keys(mixinSettings); keys = Object.keys(mixinSettings);
size = keys.length; size = keys.length;
for (i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
var name = keys[i]; const name = keys[i];
let mixin = mixinSettings[name]; let mixin = mixinSettings[name];
if (mixin === true) { if (mixin === true) {
mixin = {}; mixin = {};
@ -929,12 +929,9 @@ ModelBuilder.prototype.buildModels = function(schemas, createModel) {
for (let s = 0, n = schemas.length; s < n; s++) { for (let s = 0, n = schemas.length; s < n; s++) {
const name = this.getSchemaName(schemas[s].name); const name = this.getSchemaName(schemas[s].name);
schemas[s].name = name; schemas[s].name = name;
var model; const model = typeof createModel === 'function' ?
if (typeof createModel === 'function') { createModel(schemas[s].name, schemas[s].properties, schemas[s].options) :
model = createModel(schemas[s].name, schemas[s].properties, schemas[s].options); this.define(schemas[s].name, schemas[s].properties, schemas[s].options);
} else {
model = this.define(schemas[s].name, schemas[s].properties, schemas[s].options);
}
models[name] = model; models[name] = model;
relations = relations.concat(model.definition.relations); relations = relations.concat(model.definition.relations);
} }

View File

@ -187,7 +187,7 @@ ModelBaseClass.prototype._initProperties = function(data, options) {
let size = keys.length; let size = keys.length;
let p, propVal; let p, propVal;
for (var k = 0; k < size; k++) { for (let k = 0; k < size; k++) {
p = keys[k]; p = keys[k];
propVal = data[p]; propVal = data[p];
if (typeof propVal === 'function') { if (typeof propVal === 'function') {
@ -208,7 +208,7 @@ ModelBaseClass.prototype._initProperties = function(data, options) {
} else if (ctor.relations[p]) { } else if (ctor.relations[p]) {
const relationType = ctor.relations[p].type; const relationType = ctor.relations[p].type;
var modelTo; let modelTo;
if (!properties[p]) { if (!properties[p]) {
modelTo = ctor.relations[p].modelTo || ModelBaseClass; modelTo = ctor.relations[p].modelTo || ModelBaseClass;
const multiple = ctor.relations[p].multiple; const multiple = ctor.relations[p].multiple;
@ -272,7 +272,7 @@ ModelBaseClass.prototype._initProperties = function(data, options) {
size = keys.length; size = keys.length;
for (k = 0; k < size; k++) { for (let k = 0; k < size; k++) {
p = keys[k]; p = keys[k];
propVal = self.__data[p]; propVal = self.__data[p];
const type = properties[p].type; const type = properties[p].type;
@ -446,7 +446,7 @@ ModelBaseClass.prototype.toObject = function(onlySchema, removeHidden, removePro
let keys = Object.keys(props); let keys = Object.keys(props);
let propertyName, val; let propertyName, val;
for (var i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
propertyName = keys[i]; propertyName = keys[i];
val = self[propertyName]; val = self[propertyName];
@ -483,7 +483,7 @@ ModelBaseClass.prototype.toObject = function(onlySchema, removeHidden, removePro
// triggered to add it to __data // triggered to add it to __data
keys = Object.keys(self); keys = Object.keys(self);
let size = keys.length; let size = keys.length;
for (i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
propertyName = keys[i]; propertyName = keys[i];
if (props[propertyName]) { if (props[propertyName]) {
continue; continue;
@ -517,7 +517,7 @@ ModelBaseClass.prototype.toObject = function(onlySchema, removeHidden, removePro
// Now continue to check __data // Now continue to check __data
keys = Object.keys(self.__data); keys = Object.keys(self.__data);
size = keys.length; size = keys.length;
for (i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
propertyName = keys[i]; propertyName = keys[i];
if (propertyName.indexOf('__') === 0) { if (propertyName.indexOf('__') === 0) {
continue; continue;

View File

@ -110,14 +110,13 @@ function bindRelationMethods(relation, relationMethod, definition) {
function preventFkOverride(inst, data, fkProp) { function preventFkOverride(inst, data, fkProp) {
if (!fkProp) return undefined; if (!fkProp) return undefined;
if (data[fkProp] !== undefined && !idEquals(data[fkProp], inst[fkProp])) { if (data[fkProp] !== undefined && !idEquals(data[fkProp], inst[fkProp])) {
var err = new Error(g.f( return new Error(g.f(
'Cannot override foreign key %s from %s to %s', 'Cannot override foreign key %s from %s to %s',
fkProp, fkProp,
inst[fkProp], inst[fkProp],
data[fkProp] data[fkProp]
)); ));
} }
return err;
} }
/** /**

View File

@ -99,10 +99,11 @@ ScopeDefinition.prototype.related = function(receiver, scopeParams, condOrRefres
const scopeOnRelatedModel = params.collect && const scopeOnRelatedModel = params.collect &&
params.include.scope !== null && params.include.scope !== null &&
typeof params.include.scope === 'object'; typeof params.include.scope === 'object';
let filter, queryRelated;
if (scopeOnRelatedModel) { if (scopeOnRelatedModel) {
var filter = params.include; filter = params.include;
// The filter applied on relatedModel // The filter applied on relatedModel
var queryRelated = filter.scope; queryRelated = filter.scope;
delete params.include.scope; delete params.include.scope;
} }
@ -239,7 +240,7 @@ function defineScope(cls, targetClass, name, params, methods, options) {
const targetModel = definition.targetModel(this); const targetModel = definition.targetModel(this);
const self = this; const self = this;
var f = function(condOrRefresh, options, cb) { const f = function(condOrRefresh, options, cb) {
if (arguments.length === 0) { if (arguments.length === 0) {
if (typeof f.value === 'function') { if (typeof f.value === 'function') {
return f.value(self); return f.value(self);

View File

@ -513,7 +513,8 @@ function getConfigurator(name, opts) {
*/ */
Validatable.prototype.isValid = function(callback, data, options) { Validatable.prototype.isValid = function(callback, data, options) {
options = options || {}; options = options || {};
let valid = true, inst = this, wait = 0, async = false; let valid = true, wait = 0, async = false;
const inst = this;
const validations = this.constructor.validations; const validations = this.constructor.validations;
const reportDiscardedProperties = this.__strict && const reportDiscardedProperties = this.__strict &&
@ -539,8 +540,8 @@ Validatable.prototype.isValid = function(callback, data, options) {
}); });
this.trigger('validate', function(validationsDone) { this.trigger('validate', function(validationsDone) {
let inst = this, const inst = this;
asyncFail = false; let asyncFail = false;
const attrs = Object.keys(validations || {}); const attrs = Object.keys(validations || {});
@ -687,7 +688,7 @@ function skipValidation(inst, conf, kind) {
return !doValidate; return !doValidate;
} }
var defaultMessages = { const defaultMessages = {
presence: 'can\'t be blank', presence: 'can\'t be blank',
absence: 'can\'t be set', absence: 'can\'t be set',
'unknown-property': 'is not defined in the model', 'unknown-property': 'is not defined in the model',
@ -894,7 +895,7 @@ function ValidationError(obj) {
util.inherits(ValidationError, Error); util.inherits(ValidationError, Error);
var errorHasStackProperty = !!(new Error).stack; const errorHasStackProperty = !!(new Error).stack;
ValidationError.maxPropertyStringLength = 32; ValidationError.maxPropertyStringLength = 32;

View File

@ -108,7 +108,7 @@ describe('DataSource', function() {
* new DataSource(connectorInstance) * new DataSource(connectorInstance)
*/ */
it('should accept resolved connector', function() { it('should accept resolved connector', function() {
var mockConnector = { const mockConnector = {
name: 'loopback-connector-mock', name: 'loopback-connector-mock',
initialize: function(ds, cb) { initialize: function(ds, cb) {
ds.connector = mockConnector; ds.connector = mockConnector;
@ -125,7 +125,7 @@ describe('DataSource', function() {
* new DataSource(dsName, connectorInstance) * new DataSource(dsName, connectorInstance)
*/ */
it('should accept dsName and resolved connector', function() { it('should accept dsName and resolved connector', function() {
var mockConnector = { const mockConnector = {
name: 'loopback-connector-mock', name: 'loopback-connector-mock',
initialize: function(ds, cb) { initialize: function(ds, cb) {
ds.connector = mockConnector; ds.connector = mockConnector;
@ -142,7 +142,7 @@ describe('DataSource', function() {
* new DataSource(connectorInstance, settings) * new DataSource(connectorInstance, settings)
*/ */
it('should accept resolved connector and settings', function() { it('should accept resolved connector and settings', function() {
var mockConnector = { const mockConnector = {
name: 'loopback-connector-mock', name: 'loopback-connector-mock',
initialize: function(ds, cb) { initialize: function(ds, cb) {
ds.connector = mockConnector; ds.connector = mockConnector;
@ -156,7 +156,7 @@ describe('DataSource', function() {
}); });
it('should set states correctly with eager connect', function(done) { it('should set states correctly with eager connect', function(done) {
var mockConnector = { const mockConnector = {
name: 'loopback-connector-mock', name: 'loopback-connector-mock',
initialize: function(ds, cb) { initialize: function(ds, cb) {
ds.connector = mockConnector; ds.connector = mockConnector;
@ -211,7 +211,7 @@ describe('DataSource', function() {
}); });
it('should set states correctly with deferred connect', function(done) { it('should set states correctly with deferred connect', function(done) {
var mockConnector = { const mockConnector = {
name: 'loopback-connector-mock', name: 'loopback-connector-mock',
initialize: function(ds, cb) { initialize: function(ds, cb) {
ds.connector = mockConnector; ds.connector = mockConnector;
@ -267,7 +267,7 @@ describe('DataSource', function() {
}); });
it('should set states correctly with lazyConnect = true', function(done) { it('should set states correctly with lazyConnect = true', function(done) {
var mockConnector = { const mockConnector = {
name: 'loopback-connector-mock', name: 'loopback-connector-mock',
initialize: function(ds, cb) { initialize: function(ds, cb) {
ds.connector = mockConnector; ds.connector = mockConnector;

View File

@ -53,7 +53,8 @@ describe('datatypes', function() {
}); });
it('should keep types when get read data from db', function(done) { it('should keep types when get read data from db', function(done) {
let d = new Date('2015-01-01T12:00:00'), id; const d = new Date('2015-01-01T12:00:00');
let id;
Model.create({ Model.create({
str: 'hello', date: d, num: '3', bool: 1, list: ['test'], arr: [1, 'str'], str: 'hello', date: d, num: '3', bool: 1, list: ['test'], arr: [1, 'str'],
@ -101,7 +102,8 @@ describe('datatypes', function() {
}); });
it('should respect data types when updating attributes', function(done) { it('should respect data types when updating attributes', function(done) {
const d = new Date, id; const d = new Date;
let id;
Model.create({ Model.create({
str: 'hello', date: d, num: '3', bool: 1}, function(err, m) { str: 'hello', date: d, num: '3', bool: 1}, function(err, m) {

View File

@ -632,7 +632,8 @@ describe('Mock connector', function() {
}); });
describe('Default memory connector', function() { describe('Default memory connector', function() {
let ds, nonExistantError = 'Table \'NONEXISTENT\' does not exist.'; const nonExistantError = 'Table \'NONEXISTENT\' does not exist.';
let ds;
before(function() { before(function() {
ds = new DataSource({connector: 'memory'}); ds = new DataSource({connector: 'memory'});

View File

@ -9,12 +9,12 @@
/* global getSchema:false */ /* global getSchema:false */
const should = require('./init.js'); const should = require('./init.js');
let j = require('../'), const j = require('../'),
Schema = j.Schema, Schema = j.Schema,
AbstractClass = j.AbstractClass, AbstractClass = j.AbstractClass,
Hookable = j.Hookable, Hookable = j.Hookable;
db, User; let db, User;
describe('hooks', function() { describe('hooks', function() {
before(function(done) { before(function(done) {
@ -436,7 +436,8 @@ describe('hooks', function() {
}); });
function addHooks(name, done) { function addHooks(name, done) {
let called = false, random = String(Math.floor(Math.random() * 1000)); const random = String(Math.floor(Math.random() * 1000));
let called = false;
User['before' + name] = function(next, data) { User['before' + name] = function(next, data) {
called = true; called = true;
data.email = random; data.email = random;

View File

@ -1493,10 +1493,10 @@ describe('include', function() {
}); });
}); });
var createdUsers = []; let createdUsers = [];
var createdPassports = []; let createdPassports = [];
var createdProfiles = []; let createdProfiles = [];
var createdPosts = []; let createdPosts = [];
function setup(done) { function setup(done) {
db = getSchema(); db = getSchema();
City = db.define('City'); City = db.define('City');

View File

@ -615,8 +615,7 @@ describe('DataSource define model', function() {
it('updates instances with unknown properties in non-strict mode', function(done) { it('updates instances with unknown properties in non-strict mode', function(done) {
const ds = new DataSource('memory');// define models const ds = new DataSource('memory');// define models
let Post; const Post = ds.define('Post', {
Post = ds.define('Post', {
title: {type: String, length: 255, index: true}, title: {type: String, length: 255, index: true},
content: {type: String}, content: {type: String},
}); });

View File

@ -137,7 +137,7 @@ describe('manipulation', function() {
}); });
it('should not return instance of object', function(done) { it('should not return instance of object', function(done) {
var person = Person.create(function(err, p) { const person = Person.create(function(err, p) {
if (err) return done(err); if (err) return done(err);
should.exist(p.id); should.exist(p.id);
if (person) person.should.not.be.an.instanceOf(Person); if (person) person.should.not.be.an.instanceOf(Person);
@ -254,7 +254,7 @@ describe('manipulation', function() {
{name: 'Boltay'}, {name: 'Boltay'},
{}, {},
]; ];
var res = Person.create(batch, function(e, ps) { const res = Person.create(batch, function(e, ps) {
if (res) res.should.not.be.instanceOf(Array); if (res) res.should.not.be.instanceOf(Array);
should.not.exist(e); should.not.exist(e);
should.exist(ps); should.exist(ps);

View File

@ -923,7 +923,8 @@ describe('Unoptimized connector', function() {
}); });
describe('Memory connector with options', function() { describe('Memory connector with options', function() {
let ds, savedOptions = {}, Post; const savedOptions = {};
let ds, Post;
before(function() { before(function() {
ds = new DataSource({connector: 'memory'}); ds = new DataSource({connector: 'memory'});

View File

@ -143,8 +143,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
it('triggers the loaded hook multiple times when multiple instances exist when near filter is used', it('triggers the loaded hook multiple times when multiple instances exist when near filter is used',
function(done) { function(done) {
let hookMonitorGeoModel; const hookMonitorGeoModel = new HookMonitor({includeModelName: false});
hookMonitorGeoModel = new HookMonitor({includeModelName: false});
function monitorHookExecutionGeoModel(hookNames) { function monitorHookExecutionGeoModel(hookNames) {
hookMonitorGeoModel.install(GeoModel, hookNames); hookMonitorGeoModel.install(GeoModel, hookNames);

View File

@ -2784,7 +2784,8 @@ describe('relations', function() {
scope4.should.have.property('include', 'imageable'); scope4.should.have.property('include', 'imageable');
}); });
let article, employee, pictures = []; let article, employee;
const pictures = [];
it('should create polymorphic relation - article', function(done) { it('should create polymorphic relation - article', function(done) {
Article.create({name: 'Article 1'}, function(err, a) { Article.create({name: 'Article 1'}, function(err, a) {
if (err) return done(err); if (err) return done(err);

View File

@ -9,7 +9,9 @@
/* global getSchema:false */ /* global getSchema:false */
const should = require('./init.js'); const should = require('./init.js');
let db = getSchema(), slave = getSchema(), Model, SlaveModel; const db = getSchema();
const slave = getSchema();
let Model, SlaveModel;
describe('dataSource', function() { describe('dataSource', function() {
it('should define Model', function() { it('should define Model', function() {

View File

@ -284,13 +284,13 @@ describe('scope - filtered count, updateAll and destroyAll', function() {
verify(); verify();
}); });
var verify = function() { function verify() {
Station.flagged.count(function(err, count) { Station.flagged.count(function(err, count) {
if (err) return done(err); if (err) return done(err);
count.should.equal(2); count.should.equal(2);
done(); done();
}); });
}; }
}); });
it('should allow filtered updateAll', function(done) { it('should allow filtered updateAll', function(done) {
@ -300,13 +300,13 @@ describe('scope - filtered count, updateAll and destroyAll', function() {
verify(); verify();
}); });
var verify = function() { function verify() {
Station.flagged.count(function(err, count) { Station.flagged.count(function(err, count) {
if (err) return done(err); if (err) return done(err);
count.should.equal(2); count.should.equal(2);
done(); done();
}); });
}; }
}); });
it('should allow filtered destroyAll', function(done) { it('should allow filtered destroyAll', function(done) {
@ -315,7 +315,7 @@ describe('scope - filtered count, updateAll and destroyAll', function() {
verify(); verify();
}); });
var verify = function() { function verify() {
Station.ordered.count(function(err, count) { Station.ordered.count(function(err, count) {
if (err) return done(err); if (err) return done(err);
count.should.equal(2); count.should.equal(2);
@ -325,7 +325,7 @@ describe('scope - filtered count, updateAll and destroyAll', function() {
done(); done();
}); });
}); });
}; }
}); });
}); });

View File

@ -10,7 +10,8 @@
const should = require('./init.js'); const should = require('./init.js');
const async = require('async'); const async = require('async');
let j = require('../'), db, User; const j = require('../');
let db, User;
const ValidationError = j.ValidationError; const ValidationError = j.ValidationError;
function getValidAttributes() { function getValidAttributes() {
@ -1521,7 +1522,7 @@ describe('validations', function() {
}); });
}); });
var empData = [{ const empData = [{
id: 1, id: 1,
name: 'Foo', name: 'Foo',
age: 1, age: 1,