diff --git a/examples/inclusion.js b/examples/inclusion.js index c65bc3ac..8e13914e 100644 --- a/examples/inclusion.js +++ b/examples/inclusion.js @@ -73,7 +73,7 @@ function setup(done) { function(items) { createdUsers = items; createPassports(); - } + }, ); } @@ -88,7 +88,7 @@ function setup(done) { function(items) { createdPassports = items; createPosts(); - } + }, ); } @@ -105,7 +105,7 @@ function setup(done) { function(items) { createdPosts = items; done(); - } + }, ); } }); diff --git a/examples/relations.js b/examples/relations.js index 1268e92c..626eed75 100644 --- a/examples/relations.js +++ b/examples/relations.js @@ -109,9 +109,9 @@ Physician.create({name: 'Dr John'}, function(err, physician1) { patient1.physicians.create({name: 'Dr X'}, function(err, patient4) { console.log('Physician 4: ', patient4, patient4.constructor.modelName); }); - } + }, ); - } + }, ); }); }); diff --git a/lib/connectors/kv-memory.js b/lib/connectors/kv-memory.js index cab15bd6..1751bc23 100644 --- a/lib/connectors/kv-memory.js +++ b/lib/connectors/kv-memory.js @@ -47,7 +47,7 @@ KeyValueMemoryConnector.prototype._setupRegularCleanup = function() { clearInterval(this._cleanupTimer); } }, - 1000 + 1000, ); this._cleanupTimer.unref(); }; diff --git a/lib/dao.js b/lib/dao.js index e1a28306..5bcbbdcb 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -136,7 +136,7 @@ function invokeConnectorMethod(connector, method, Model, args, options, cb) { // If the DataSource is a transaction and no transaction object is provide in // the options yet, add it to the options, see: DataSource#transaction() const opts = dataSource.isTransaction && !options.transaction ? Object.assign( - options, {transaction: dataSource.currentTransaction} + options, {transaction: dataSource.currentTransaction}, ) : options; const optionsSupported = connector[method].length >= args.length + 3; const transaction = opts.transaction; @@ -144,7 +144,7 @@ function invokeConnectorMethod(connector, method, Model, args, options, cb) { if (!optionsSupported) { return process.nextTick(function() { cb(new Error(g.f( - 'The connector does not support {{method}} within a transaction', method + 'The connector does not support {{method}} within a transaction', method, ))); }); } @@ -2593,7 +2593,7 @@ DataAccessObject.replaceById = function(id, data, options, cb) { err = new Error(g.f( 'The connector %s does not support {{replaceById}} operation. This is not a bug in LoopBack. ' + 'Please contact the authors of the connector, preferably via GitHub issues.', - connector.name + connector.name, )); return cb(err); } diff --git a/lib/datasource.js b/lib/datasource.js index 4538eeaf..2500677a 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -429,7 +429,7 @@ DataSource.prototype.setup = function(dsName, settings) { console.warn( 'A datasource is created with name %j, which is different from the name in settings (%j). ' + 'Please adjust your configuration to ensure these names match.', - dsName, settings.name + dsName, settings.name, ); } @@ -2386,7 +2386,7 @@ DataSource.prototype.transaction = function(execute, options, cb) { if (!transaction) { process.nextTick(function() { cb(new Error(g.f( - 'Transaction is not ready, wait for the returned promise to resolve' + 'Transaction is not ready, wait for the returned promise to resolve', ))); }); } @@ -2668,14 +2668,14 @@ DataSource.prototype.execute = function(command, args = [], options = {}) { if (!this.connector) { return Promise.reject(errorNotImplemented( - `DataSource "${this.name}" is missing a connector to execute the command.` + `DataSource "${this.name}" is missing a connector to execute the command.`, )); } if (!this.connector.execute) { return Promise.reject(new errorNotImplemented( `The connector "${this.connector.name}" used by dataSource "${this.name}" ` + - 'does not implement "execute()" API.' + 'does not implement "execute()" API.', )); } diff --git a/lib/include.js b/lib/include.js index 5219bc7a..cf31b522 100644 --- a/lib/include.js +++ b/lib/include.js @@ -513,7 +513,7 @@ Inclusion.include = function(objects, include, options, cb) { if (!targetId) { const err = new Error(g.f( 'LinkManyToMany received target that doesn\'t contain required "%s"', - modelToIdName + modelToIdName, )); return next(err); } diff --git a/lib/model-utils.js b/lib/model-utils.js index af18ba4e..5d97d03a 100644 --- a/lib/model-utils.js +++ b/lib/model-utils.js @@ -462,7 +462,7 @@ ModelUtils._coerce = function(where, options, modelDef) { 'The %s property has invalid clause %j: Expected precisely 2 values, received %d', p, where[p], - val.length + val.length, )); err.statusCode = 400; throw err; @@ -476,7 +476,7 @@ ModelUtils._coerce = function(where, options, modelDef) { err = new Error(g.f( 'The %s property has invalid clause %j: Expected a string or RegExp', p, - where[p] + where[p], )); err.statusCode = 400; throw err; diff --git a/lib/model.js b/lib/model.js index b54863ad..94820a2b 100644 --- a/lib/model.js +++ b/lib/model.js @@ -251,7 +251,7 @@ ModelBaseClass.prototype._initProperties = function(data, options) { throw new Error(g.f( 'Property names containing dot(s) are not supported. ' + 'Model: %s, dynamic property: %s', - this.constructor.modelName, p + this.constructor.modelName, p, )); } } else { diff --git a/lib/observer.js b/lib/observer.js index 30327909..2dbacd66 100644 --- a/lib/observer.js +++ b/lib/observer.js @@ -163,11 +163,11 @@ ObserverMixin.notifyObserversOf = function(operation, context, callback) { if (retval && typeof retval.then === 'function') { retval.then( function() { next(); return null; }, - next // error handler + next, // error handler ); } }, - function(err) { callback(err, context); } + function(err) { callback(err, context); }, ); }); return callback.promise; @@ -244,7 +244,7 @@ ObserverMixin.notifyObserversAround = function(operation, context, fn, callback) 'Calling back with the hook error only.' + '\nOriginal error: %s\nHook error: %s\n', err.stack || err, - _err.stack || _err + _err.stack || _err, ); } callback.call(null, _err || err, context); diff --git a/lib/relation-definition.js b/lib/relation-definition.js index 9d5cdc1b..2284c20a 100644 --- a/lib/relation-definition.js +++ b/lib/relation-definition.js @@ -115,7 +115,7 @@ function preventFkOverride(inst, data, fkProp) { 'Cannot override foreign key %s from %s to %s', fkProp, inst[fkProp], - data[fkProp] + data[fkProp], )); } } @@ -1825,7 +1825,7 @@ HasOne.prototype.create = function(targetModelData, options, cb) { } else { cb && cb(new Error(g.f( '{{HasOne}} relation cannot create more than one instance of %s', - modelTo.modelName + modelTo.modelName, ))); } }); @@ -2073,7 +2073,7 @@ RelationDefinition.embedsOne = function(modelFrom, modelToRef, params) { const opts = Object.assign( params.options && params.options.property ? params.options.property : {}, - {type: modelTo} + {type: modelTo}, ); if (params.default === true) { @@ -2476,7 +2476,7 @@ RelationDefinition.embedsMany = function embedsMany(modelFrom, modelToRef, param { type: [modelTo], default: function() { return []; }, - } + }, ); modelFrom.dataSource.defineProperty(modelFrom.modelName, propertyName, opts); diff --git a/lib/utils.js b/lib/utils.js index 38a13bb2..d7066ff5 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -342,7 +342,7 @@ function escapeRegExp(str) { console.warn( 'Auto-escaping invalid RegExp value %j supplied by the caller. ' + 'Please note this behavior may change in the future.', - str + str, ); return str.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, '\\$&'); } @@ -434,8 +434,8 @@ function sanitizeQuery(query, options) { console.error( g.f( 'Potential security alert: hidden/protected properties %j are used in query.', - offendingKeys - ) + offendingKeys, + ), ); } return result; @@ -679,7 +679,7 @@ function uniq(a) { } assert(Array.isArray(a), 'array argument is required'); const comparableA = a.map( - item => isBsonType(item) ? item.toString() : item + item => isBsonType(item) ? item.toString() : item, ); for (let i = 0, n = comparableA.length; i < n; i++) { if (comparableA.indexOf(comparableA[i]) === i) { diff --git a/lib/validations.js b/lib/validations.js index 697ed3f8..183f02bd 100644 --- a/lib/validations.js +++ b/lib/validations.js @@ -871,7 +871,7 @@ function ValidationError(obj) { this.message = g.f( 'The %s instance is not valid. Details: %s.', context ? '`' + context + '`' : 'model', - formatErrors(obj.errors, obj.toJSON()) || '(unknown)' + formatErrors(obj.errors, obj.toJSON()) || '(unknown)', ); this.statusCode = 422; diff --git a/package.json b/package.json index e80b0e5b..9c0acaf8 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "async-iterators": "^0.2.2", "bson": "^4.0.1", "coveralls": "^3.0.1", - "eslint": "^5.1.0", + "eslint": "^6.7.2", "eslint-config-loopback": "^13.0.0", "loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing", "mocha": "^6.1.4", diff --git a/support/describe-operation-hooks.js b/support/describe-operation-hooks.js index 3e191742..04ccc362 100644 --- a/support/describe-operation-hooks.js +++ b/support/describe-operation-hooks.js @@ -51,14 +51,14 @@ const operations = [ function findOrCreate_found(ds) { return ds.TestModel.findOrCreate( {where: {name: ds.existingInstance.name}}, - {name: ds.existingInstance.name} + {name: ds.existingInstance.name}, ); }, function findOrCreate_create(ds) { return ds.TestModel.findOrCreate( {where: {name: 'new-record'}}, - {name: 'new-record'} + {name: 'new-record'}, ); }, @@ -68,7 +68,7 @@ const operations = [ function updateOrCreate_update(ds) { return ds.TestModel.updateOrCreate( - {id: ds.existingInstance.id, name: 'new name'} + {id: ds.existingInstance.id, name: 'new name'}, ); }, @@ -78,14 +78,14 @@ const operations = [ function replaceOrCreate_update(ds) { return ds.TestModel.replaceOrCreate( - {id: ds.existingInstance.id, name: 'new name'} + {id: ds.existingInstance.id, name: 'new name'}, ); }, function replaceById(ds) { return ds.TestModel.replaceById( ds.existingInstance.id, - {name: 'new name'} + {name: 'new name'}, ); }, diff --git a/test/async-observer.test.js b/test/async-observer.test.js index 04301f81..0b726932 100644 --- a/test/async-observer.test.js +++ b/test/async-observer.test.js @@ -322,7 +322,7 @@ describe('async observer', function() { }, function(err) { err.should.eql(testError); - } + }, ); }); diff --git a/test/basic-querying.test.js b/test/basic-querying.test.js index 3e85ff96..42dd7bbd 100644 --- a/test/basic-querying.test.js +++ b/test/basic-querying.test.js @@ -127,10 +127,10 @@ describe('basic-querying', function() { return u.name; }); names.should.eql( - [createdUsers[2].name, createdUsers[1].name, createdUsers[0].name] + [createdUsers[2].name, createdUsers[1].name, createdUsers[0].name], ); done(); - } + }, ); }); diff --git a/test/crud-with-options.test.js b/test/crud-with-options.test.js index cbc5d825..413e276a 100644 --- a/test/crud-with-options.test.js +++ b/test/crud-with-options.test.js @@ -90,7 +90,7 @@ describe('crud-with-options', function() { function(done) { User.findById(undefined, {}, function(err, u) { err.should.be.eql( - new Error('Model::findById requires the id argument') + new Error('Model::findById requires the id argument'), ); done(); }); diff --git a/test/datasource.test.js b/test/datasource.test.js index 3e4427e4..74b5f71c 100644 --- a/test/datasource.test.js +++ b/test/datasource.test.js @@ -376,7 +376,7 @@ describe('DataSource', function() { const result = await ds.execute( 'command', ['arg1', 'arg2'], - {'a-flag': 'a-value'} + {'a-flag': 'a-value'}, ); result.should.be.equal('a-result'); diff --git a/test/datatype.test.js b/test/datatype.test.js index 3c88341f..b251df1f 100644 --- a/test/datatype.test.js +++ b/test/datatype.test.js @@ -295,7 +295,7 @@ describe('datatypes', function() { }, { persistUndefinedAsNull: true, - } + }, ); isStrict = TestModel.definition.settings.strict; @@ -385,13 +385,13 @@ describe('datatypes', function() { TestModel.modelName, {where: {id: created.id}}, {}, - cb + cb, ); } else { TestModel.dataSource.connector.all( TestModel.modelName, {where: {id: created.id}}, - cb + cb, ); } }); diff --git a/test/date-string.test.js b/test/date-string.test.js index ff995854..37edbb07 100644 --- a/test/date-string.test.js +++ b/test/date-string.test.js @@ -3,9 +3,6 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -/* global describe,it */ -/* jshint expr:true */ - 'use strict'; require('should'); diff --git a/test/discovery.test.js b/test/discovery.test.js index 2b2056c1..4aea820f 100644 --- a/test/discovery.test.js +++ b/test/discovery.test.js @@ -80,7 +80,7 @@ describe('Memory connector with mocked discovery', function() { const s = schemas['STRONGLOOP.INVENTORY']; s.name.should.be.eql('Inventory'); Object.keys(s.properties).should.be.eql( - ['productId', 'locationId', 'available', 'total'] + ['productId', 'locationId', 'available', 'total'], ); done(); }); @@ -98,7 +98,7 @@ describe('Memory connector with mocked discovery', function() { const s = schemas['STRONGLOOP.INVENTORY']; s.name.should.be.eql('inventory'); Object.keys(s.properties).should.be.eql( - ['product_id', 'location_id', 'available', 'total'] + ['product_id', 'location_id', 'available', 'total'], ); done(); }); @@ -112,7 +112,7 @@ describe('Memory connector with mocked discovery', function() { const s = schemas['STRONGLOOP.INVENTORY']; s.name.should.be.eql('INVENTORY'); Object.keys(s.properties).should.be.eql( - ['PRODUCT_ID', 'LOCATION_ID', 'AVAILABLE', 'TOTAL'] + ['PRODUCT_ID', 'LOCATION_ID', 'AVAILABLE', 'TOTAL'], ); done(); }); @@ -172,7 +172,7 @@ describe('Memory connector with mocked discovery', function() { s.name.should.be.eql('Inventory'); Object.keys(s.properties).should.be.eql( - ['productId', 'locationId', 'available', 'total'] + ['productId', 'locationId', 'available', 'total'], ); done(); }) @@ -312,7 +312,7 @@ describe('discoverModelDefinitions', function() { }); tableNames.should.be.eql( - ['CUSTOMER', 'INVENTORY', 'LOCATION'] + ['CUSTOMER', 'INVENTORY', 'LOCATION'], ); done(); }); @@ -327,7 +327,7 @@ describe('discoverModelDefinitions', function() { }); tableNames.should.be.eql( - ['CUSTOMER', 'INVENTORY', 'LOCATION'] + ['CUSTOMER', 'INVENTORY', 'LOCATION'], ); done(); }; @@ -343,7 +343,7 @@ describe('discoverModelDefinitions', function() { }); tableNames.should.be.eql( - ['CUSTOMER', 'INVENTORY', 'LOCATION'] + ['CUSTOMER', 'INVENTORY', 'LOCATION'], ); done(); }) diff --git a/test/geo.test.js b/test/geo.test.js index 862c4ed4..114cc87a 100644 --- a/test/geo.test.js +++ b/test/geo.test.js @@ -3,9 +3,6 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -/* global describe,it */ -/* jshint expr:true */ - 'use strict'; require('should'); diff --git a/test/hooks.test.js b/test/hooks.test.js index b6b7f813..aeb171ad 100644 --- a/test/hooks.test.js +++ b/test/hooks.test.js @@ -411,7 +411,7 @@ describe('hooks', function() { it('should describe isValid sequence', function(done) { should.not.exist( user.constructor._validations, - 'Expected user to have no validations, but she have' + 'Expected user to have no validations, but she have', ); user.isValid(function(valid) { valid.should.be.true; diff --git a/test/include.test.js b/test/include.test.js index c7d5bc37..e301a410 100644 --- a/test/include.test.js +++ b/test/include.test.js @@ -1596,7 +1596,7 @@ function setup(done) { createdUsers = items; createPassports(); createAccessTokens(); - } + }, ); } function createAccessTokens() { @@ -1606,7 +1606,7 @@ function setup(done) { {token: '1', userId: createdUsers[0].id}, {token: '2', userId: createdUsers[1].id}, ], - function(items) {} + function(items) {}, ); } @@ -1622,7 +1622,7 @@ function setup(done) { function(items) { createdPassports = items; createPosts(); - } + }, ); } @@ -1637,7 +1637,7 @@ function setup(done) { function(items) { createdProfiles = items; done(); - } + }, ); } @@ -1654,7 +1654,7 @@ function setup(done) { function(items) { createdPosts = items; createProfiles(); - } + }, ); } }); diff --git a/test/kvao/_helpers.js b/test/kvao/_helpers.js index 0a298797..00894803 100644 --- a/test/kvao/_helpers.js +++ b/test/kvao/_helpers.js @@ -31,7 +31,7 @@ function givenKeys(Model, keys, cb) { let p = Promise.all( keys.map(function(k) { return Model.set(k, 'value-' + k); - }) + }), ); if (cb) { p = p.then(function(r) { cb(null, r); }, cb); diff --git a/test/kvao/expire.suite.js b/test/kvao/expire.suite.js index 90b8826a..6f21bd22 100644 --- a/test/kvao/expire.suite.js +++ b/test/kvao/expire.suite.js @@ -53,7 +53,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) { function(err) { err.message.should.match(/expired-key/); err.should.have.property('statusCode', 404); - } + }, ); }); @@ -63,7 +63,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) { function(err) { err.message.should.match(/key-does-not-exist/); err.should.have.property('statusCode', 404); - } + }, ); }); diff --git a/test/kvao/ttl.suite.js b/test/kvao/ttl.suite.js index 70139e0d..5d1e5343 100644 --- a/test/kvao/ttl.suite.js +++ b/test/kvao/ttl.suite.js @@ -30,7 +30,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) { it('gets TTL when key with unexpired TTL exists - Promise API', function() { return Promise.resolve( - CacheItem.set('a-key', 'a-value', {ttl: INITIAL_TTL}) + CacheItem.set('a-key', 'a-value', {ttl: INITIAL_TTL}), ) .then(() => helpers.delay(SMALL_DELAY)) .then(function() { return CacheItem.ttl('a-key'); }) @@ -57,7 +57,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) { it('fails when getting TTL for a key with expired TTL', function() { return Promise.resolve( - CacheItem.set('expired-key', 'a-value', {ttl: TTL_PRECISION}) + CacheItem.set('expired-key', 'a-value', {ttl: TTL_PRECISION}), ) .then(() => helpers.delay(2 * TTL_PRECISION)) .then(function() { @@ -68,7 +68,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) { function(err) { err.message.should.match(/expired-key/); err.should.have.property('statusCode', 404); - } + }, ); }); @@ -78,7 +78,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) { function(err) { err.message.should.match(/key-does-not-exist/); err.should.have.property('statusCode', 404); - } + }, ); }); diff --git a/test/loopback-dl.test.js b/test/loopback-dl.test.js index 6426206b..3aea6b74 100644 --- a/test/loopback-dl.test.js +++ b/test/loopback-dl.test.js @@ -749,10 +749,10 @@ describe('Model loaded with a base', function() { Customer1.definition.properties.should.have.property('name'); Customer2.definition.properties.should.have.property('name'); Customer1.definition.properties.name.should.not.be.equal( - Customer2.definition.properties.name + Customer2.definition.properties.name, ); Customer1.definition.properties.name.should.eql( - Customer2.definition.properties.name + Customer2.definition.properties.name, ); }); diff --git a/test/manipulation.test.js b/test/manipulation.test.js index fe2db591..b5e37a89 100644 --- a/test/manipulation.test.js +++ b/test/manipulation.test.js @@ -364,7 +364,7 @@ describe('manipulation', function() { should.equal(result.gender, null); done(); }); - } + }, ); }); @@ -942,9 +942,9 @@ describe('manipulation', function() { should.equal(result.gender, null); done(); - } + }, ); - } + }, ); }); @@ -991,7 +991,7 @@ describe('manipulation', function() { function(err, inst) { if (err) return done(err); inst.save(done); - } + }, ); }); @@ -1654,7 +1654,7 @@ describe('manipulation', function() { p.gender.should.equal('male'); created.should.equal(false); done(); - } + }, ); }); @@ -1678,7 +1678,7 @@ describe('manipulation', function() { it('should find a record if exists (promise variant)', function(done) { Person.findOrCreate( {where: {name: 'Jed'}}, - {name: 'Jed', gender: 'male'} + {name: 'Jed', gender: 'male'}, ) .then(function(res) { res.should.be.instanceOf(Array); @@ -2489,7 +2489,7 @@ describe('manipulation', function() { should.equal(result.city, null); done(); }); - } + }, ); }); diff --git a/test/model-definition.test.js b/test/model-definition.test.js index f067b9d6..1de82430 100644 --- a/test/model-definition.test.js +++ b/test/model-definition.test.js @@ -406,7 +406,7 @@ describe('ModelDefinition class', function() { return Child.update({name: 'childA'}, {secret: 'new-secret'}, optionsFromRemoteReq).then( function(result) { result.count.should.equal(1); - } + }, ); }); diff --git a/test/normalize-undefined.test.js b/test/normalize-undefined.test.js index 96c9be8f..f8a3dc93 100644 --- a/test/normalize-undefined.test.js +++ b/test/normalize-undefined.test.js @@ -292,6 +292,6 @@ function seed(User, done) { async.each(beatles, User.create.bind(User), cb); }, ], - done + done, ); } diff --git a/test/operation-hooks.suite/embeds-many-destroy.suite.js b/test/operation-hooks.suite/embeds-many-destroy.suite.js index c7607499..c917e57a 100644 --- a/test/operation-hooks.suite/embeds-many-destroy.suite.js +++ b/test/operation-hooks.suite/embeds-many-destroy.suite.js @@ -72,7 +72,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, result) { if (err) reject(err); else resolve(result); - } + }, ); }); } diff --git a/test/operation-hooks.suite/embeds-many-update-by-id.suite.js b/test/operation-hooks.suite/embeds-many-update-by-id.suite.js index 7df82a82..4688fa7a 100644 --- a/test/operation-hooks.suite/embeds-many-update-by-id.suite.js +++ b/test/operation-hooks.suite/embeds-many-update-by-id.suite.js @@ -73,7 +73,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, result) { if (err) reject(err); else resolve(result); - } + }, ); }); } diff --git a/test/optional-validation.test.js b/test/optional-validation.test.js index 03fa56c0..40919b70 100644 --- a/test/optional-validation.test.js +++ b/test/optional-validation.test.js @@ -24,7 +24,7 @@ describe('optional-validation', function() { ModelWithForceId = db.createModel( 'ModelWithForceId', {name: String}, - {forceId: true} + {forceId: true}, ); User = db.define('User', { seq: {type: Number, index: true}, diff --git a/test/persistence-hooks.suite.js b/test/persistence-hooks.suite.js index 521187d8..fb55328f 100644 --- a/test/persistence-hooks.suite.js +++ b/test/persistence-hooks.suite.js @@ -109,7 +109,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'loaded', ]); done(); - } + }, ); }); @@ -137,7 +137,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); hookMonitor.names.should.be.empty(); done(); - } + }, ); }); @@ -243,7 +243,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); hookMonitor.names.should.be.empty(); done(); - } + }, ); }); @@ -342,7 +342,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { list[0].should.have.property('extra', 'hook data'); done(); - } + }, ); }); @@ -353,7 +353,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, list) { [err].should.eql([expectedError]); done(); - } + }, ); }); }); @@ -374,7 +374,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'after save', ]); done(); - } + }, ); }); @@ -451,7 +451,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { }), ]); done(); - } + }, ); }); @@ -480,7 +480,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { })); done(); - } + }, ); }); @@ -514,7 +514,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { }); done(); }); - } + }, ); }); @@ -537,7 +537,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { })); done(); - } + }, ); }); @@ -548,7 +548,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, instance) { [err].should.eql([expectedError]); done(); - } + }, ); }); @@ -570,7 +570,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { instance.should.have.property('extra', 'hook data'); done(); - } + }, ); }); @@ -636,7 +636,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { }), ]); done(); - } + }, ); }); @@ -666,7 +666,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { isNewInstance: true, })); done(); - } + }, ); }); }); @@ -687,7 +687,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { skip: 0, }})); done(); - } + }, ); }); @@ -710,7 +710,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { isNewInstance: true, })); done(); - } + }, ); }); } @@ -732,7 +732,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { isNewInstance: true, })); done(); - } + }, ); }); @@ -746,7 +746,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { (err || {}).should.be.instanceOf(ValidationError); (err.details.codes || {}).should.eql({name: ['presence']}); done(); - } + }, ); }); @@ -766,7 +766,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'after save', ]); done(); - } + }, ); }); @@ -793,7 +793,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ]); } done(); - } + }, ); }); @@ -806,7 +806,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, instance) { [err].should.eql([expectedError]); done(); - } + }, ); }); @@ -819,7 +819,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, instance) { [err].should.eql([expectedError]); done(); - } + }, ); }); @@ -856,7 +856,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { })); done(); - } + }, ); }); } @@ -897,7 +897,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { })); } done(); - } + }, ); }); @@ -932,7 +932,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { }); done(); - } + }, ); }); } @@ -972,7 +972,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { }); } done(); - } + }, ); }); @@ -1000,7 +1000,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { })); done(); - } + }, ); }); } @@ -1023,7 +1023,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { })); done(); - } + }, ); }); @@ -1035,7 +1035,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, instance) { [err].should.eql([expectedError]); done(); - } + }, ); }); @@ -1055,7 +1055,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { instance.should.have.property('extra', 'hook data'); done(); - } + }, ); }); } @@ -1082,7 +1082,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { instance.should.have.property('extra', 'hook data'); done(); - } + }, ); }); @@ -1103,7 +1103,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { isNewInstance: true, })); done(); - } + }, ); }); @@ -1117,7 +1117,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); ctxRecorder.records.should.eql('hook not called'); done(); - } + }, ); }); }); @@ -1163,7 +1163,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'after save', ]); done(); - } + }, ); }); @@ -1282,7 +1282,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, instance) { [err].should.eql([expectedError]); done(); - } + }, ); }); @@ -1326,7 +1326,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { // PersistedModel.create and force it to call connector.save() const instance = new TestModel( {id: 'new-id', name: 'created'}, - {persisted: true} + {persisted: true}, ); instance.save(function(err, instance) { @@ -1383,7 +1383,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'after save', ]); done(); - } + }, ); }); @@ -1544,7 +1544,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { }); done(); }); - } + }, ); }); }); @@ -1581,7 +1581,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, instance) { [err].should.eql([expectedError]); done(); - } + }, ); }); @@ -1663,7 +1663,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'after save', ]); done(); - } + }, ); }); @@ -1807,7 +1807,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { }); done(); }); - } + }, ); }); }); @@ -1836,7 +1836,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, instance) { [err].should.eql([expectedError]); done(); - } + }, ); }); @@ -1912,7 +1912,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'after save', ]); done(); - } + }, ); }); @@ -1931,7 +1931,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'after save', ]); done(); - } + }, ); }); @@ -1946,7 +1946,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { where: {id: 'not-found'}, }})); done(); - } + }, ); }); @@ -1961,7 +1961,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { where: {id: existingInstance.id}, }})); done(); - } + }, ); }); @@ -1974,7 +1974,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); ctxRecorder.records.should.equal('hook not called'); done(); - } + }, ); }); @@ -1996,7 +1996,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ]); done(); }); - } + }, ); }); @@ -2019,7 +2019,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ]); done(); }); - } + }, ); }); @@ -2037,7 +2037,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); hookMonitor.names.should.eql(['access', 'before save']); done(); - } + }, ); }); @@ -2067,7 +2067,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { })); } done(); - } + }, ); }); @@ -2097,7 +2097,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { } done(); - } + }, ); }); @@ -2114,7 +2114,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); instance.name.should.equal('hooked'); done(); - } + }, ); }); @@ -2135,7 +2135,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); instance.name.should.equal('hooked'); done(); - } + }, ); }); @@ -2150,7 +2150,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { (err || {}).should.be.instanceOf(ValidationError); (err.details.codes || {}).should.eql({name: ['presence']}); done(); - } + }, ); }); @@ -2165,7 +2165,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { (err || {}).should.be.instanceOf(ValidationError); (err.details.codes || {}).should.eql({name: ['presence']}); done(); - } + }, ); }); @@ -2202,7 +2202,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { })); } done(); - } + }, ); }); @@ -2235,7 +2235,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ctxRecorder.records.should.eql(expectedContext); done(); - } + }, ); }); @@ -2262,7 +2262,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { })); } done(); - } + }, ); }); @@ -2281,7 +2281,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { isNewInstance: isNewInstanceFlag ? false : undefined, })); done(); - } + }, ); }); @@ -2292,7 +2292,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, instance) { [err].should.eql([expectedError]); done(); - } + }, ); }); @@ -2312,7 +2312,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { isNewInstance: isNewInstanceFlag ? false : undefined, })); done(); - } + }, ); }); @@ -2343,7 +2343,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { isNewInstance: isNewInstanceFlag ? true : undefined, })); done(); - } + }, ); }); }); @@ -2367,7 +2367,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'after save', ]); done(); - } + }, ); }); @@ -2386,7 +2386,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'after save', ]); done(); - } + }, ); }); @@ -2401,7 +2401,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { where: {id: 'not-found'}, }})); done(); - } + }, ); }); @@ -2416,7 +2416,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { where: {id: existingInstance.id}, }})); done(); - } + }, ); }); @@ -2429,7 +2429,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); ctxRecorder.records.should.equal('hook not called'); done(); - } + }, ); }); @@ -2451,7 +2451,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ]); done(); }); - } + }, ); }); @@ -2474,7 +2474,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ]); done(); }); - } + }, ); }); @@ -2492,7 +2492,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); hookMonitor.names.should.eql(['access', 'before save']); done(); - } + }, ); }); @@ -2535,7 +2535,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ctxRecorder.records.should.eql(expectedContext); done(); - } + }, ); }); @@ -2561,7 +2561,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ctxRecorder.records.should.eql(expectedContext); done(); - } + }, ); }); @@ -2577,7 +2577,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); instance.name.should.equal('hooked'); done(); - } + }, ); }); @@ -2590,7 +2590,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { (err || {}).should.be.instanceOf(ValidationError); (err.details.codes || {}).should.eql({name: ['presence']}); done(); - } + }, ); }); @@ -2624,7 +2624,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { } ctxRecorder.records.should.eql(expectedContext); done(); - } + }, ); }); @@ -2657,7 +2657,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ctxRecorder.records.should.eql(expectedContext); done(); - } + }, ); }); @@ -2684,7 +2684,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { found.should.have.property('extra', 'hook data'); done(); }); - } + }, ); }); @@ -2730,7 +2730,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected)); done(); - } + }, ); }); @@ -2755,7 +2755,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected)); done(); - } + }, ); }); @@ -2766,7 +2766,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { function(err, instance) { [err].should.eql([expectedError]); done(); - } + }, ); }); @@ -2792,7 +2792,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected)); done(); - } + }, ); }); @@ -2817,7 +2817,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected)); done(); - } + }, ); }); }); @@ -2843,7 +2843,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { 'after save', ]); done(); - } + }, ); }); @@ -2884,7 +2884,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ctxRecorder.records.should.eql(expectedContext); done(); - } + }, ); }); @@ -2906,7 +2906,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { found.should.have.property('extra', 'hook data'); done(); }); - } + }, ); }); }); @@ -3105,7 +3105,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { TestModel.findById(existingInstance.id, function(err, inst) { if (err) return done(err); (inst ? inst.toObject() : 'null').should.eql( - existingInstance.toObject() + existingInstance.toObject(), ); done(); }); @@ -3204,7 +3204,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { where: {name: 'searched'}, }})); done(); - } + }, ); }); @@ -3227,7 +3227,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { ]); done(); }); - } + }, ); }); @@ -3244,7 +3244,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { data: {name: 'updated'}, })); done(); - } + }, ); }); @@ -3265,7 +3265,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { instance.should.have.property('extra', 'added'); done(); }); - } + }, ); }); @@ -3284,7 +3284,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { })); done(); - } + }, ); }); @@ -3303,7 +3303,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { instance.should.have.property('extra', 'hook data'); done(); }); - } + }, ); }); @@ -3317,7 +3317,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { if (err) return done(err); ctxRecorder.records.should.eql('hook not called'); done(); - } + }, ); }); @@ -3335,7 +3335,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { info: {count: 1}, })); done(); - } + }, ); }); @@ -3352,7 +3352,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { foo: 'bar', }); done(); - } + }, ); }); }); diff --git a/test/relations.test.js b/test/relations.test.js index d7b6e72b..4a7eac2c 100644 --- a/test/relations.test.js +++ b/test/relations.test.js @@ -2612,7 +2612,7 @@ describe('relations', function() { const actual = pics.map( function(pic) { return {imageName: pic.name, name: pic.imageable().name}; - } + }, ); actual.should.containDeep([ @@ -6228,7 +6228,7 @@ describe('relations', function() { err.name.should.equal('ValidationError'); err.details.codes.jobs.should.eql(['uniqueness']); done(); - } + }, ); }); @@ -6616,7 +6616,7 @@ describe('relations', function() { type: 'hasMany', }, }, - } + }, ); }).should.throw('Invalid relation name: trigger'); }); diff --git a/test/spec_helper.js b/test/spec_helper.js index 8977ad20..bb4c85d1 100644 --- a/test/spec_helper.js +++ b/test/spec_helper.js @@ -54,7 +54,7 @@ exports.init = function init(external_exports) { function check_external_exports() { if (!EXT_EXP) throw new Error( 'Before run this, please ensure that ' + - 'require("spec_helper").init(exports); called' + 'require("spec_helper").init(exports); called', ); } diff --git a/test/util.test.js b/test/util.test.js index 923ae4de..52acaa1d 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -88,13 +88,13 @@ describe('util.sanitizeQuery', function() { const q7 = {where: {x: 1}}; q7.where.y = q7; (function() { sanitizeQuery(q7); }).should.throw( - /The query object is circular/ + /The query object is circular/, ); const q8 = {where: {and: [{and: [{and: [{and: [{and: [{and: [{and: [{and: [{and: [{x: 1}]}]}]}]}]}]}]}]}]}}; (function() { sanitizeQuery(q8, {maxDepth: 12}); }).should.throw( - /The query object exceeds maximum depth 12/ + /The query object exceeds maximum depth 12/, ); // maxDepth is default to maximum integer @@ -102,7 +102,7 @@ describe('util.sanitizeQuery', function() { const q9 = {where: {and: [{and: [{and: [{and: [{x: 1}]}]}]}]}}; (function() { sanitizeQuery(q8, {maxDepth: 4}); }).should.throw( - /The query object exceeds maximum depth 4/ + /The query object exceeds maximum depth 4/, ); }); diff --git a/test/validations.test.js b/test/validations.test.js index 1c2045c0..89b5ef62 100644 --- a/test/validations.test.js +++ b/test/validations.test.js @@ -348,7 +348,7 @@ describe('validations', function() { if (options.testFlag !== 'someValue') { console.error( 'Unexpected validation options: %j Expected %j', - options, {testFlag: 'someValue'} + options, {testFlag: 'someValue'}, ); err(); } @@ -609,13 +609,13 @@ describe('validations', function() { function createSite1User(next) { SiteUser.create( {siteId: 1, email: EMAIL}, - next + next, ); }, function createSite2User(user1, next) { SiteUser.create( {siteId: 2, email: EMAIL}, - next + next, ); }, function validateDuplicateUser(user2, next) { @@ -1424,7 +1424,7 @@ describe('validations', function() { obj.email = 'test@example.com'; const err = givenValidationError('user', obj, 'is invalid'); getErrorDetails(err).should.equal( - '`user` is invalid (value: { email: \'test@example.com\' }).' + '`user` is invalid (value: { email: \'test@example.com\' }).', ); });