From c7f34c3452f66303ed8ae2a9b496ea5c6818b611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Tue, 19 Apr 2016 16:11:19 +0200 Subject: [PATCH] eslint config 2.0 + remove extra empty lines Upgrade eslint-config-loopback to ^2.0.0. Remove extra empty lines to make `npm run lint` pass again. --- examples/app-noschema.js | 2 -- examples/app.js | 4 ---- lib/connectors/memory.js | 1 - lib/dao.js | 1 - lib/include.js | 2 -- lib/include_utils.js | 2 -- lib/introspection.js | 2 -- lib/relation-definition.js | 7 ------- lib/transaction.js | 2 -- package.json | 2 +- support/describe-operation-hooks.js | 1 - test/basic-querying.test.js | 1 - test/hooks.test.js | 2 -- test/include.test.js | 2 -- test/include_util.test.js | 1 - test/loopback-dl.test.js | 1 - test/manipulation.test.js | 1 - test/memory.test.js | 3 --- test/optional-validation.test.js | 1 - test/persistence-hooks.suite.js | 3 --- test/relations.test.js | 8 -------- test/scope.test.js | 2 -- 22 files changed, 1 insertion(+), 50 deletions(-) diff --git a/examples/app-noschema.js b/examples/app-noschema.js index 0da64cfc..95ce3c98 100644 --- a/examples/app-noschema.js +++ b/examples/app-noschema.js @@ -82,5 +82,3 @@ User.create(user, function(err, u1) { console.log('Found: ', u2.toObject()); }); }); - - diff --git a/examples/app.js b/examples/app.js index f4392ec7..67ecfd22 100644 --- a/examples/app.js +++ b/examples/app.js @@ -41,7 +41,3 @@ console.log(modelBuilder.definitions); User.mixin(Group); var user = new User({ name: 'Ray', group: 'Admin' }); console.log(user); - - - - diff --git a/lib/connectors/memory.js b/lib/connectors/memory.js index 5ec7e342..29fe9255 100644 --- a/lib/connectors/memory.js +++ b/lib/connectors/memory.js @@ -482,7 +482,6 @@ function applyFilter(filter) { }); } - if (test(where[key], value)) { return true; } diff --git a/lib/dao.js b/lib/dao.js index b83612c6..73a85e77 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -2998,7 +2998,6 @@ DataAccessObject.prototype.reload = function reload(cb) { return this.constructor.findById(getIdValue(this.constructor, this), cb); }; - /* * Define readonly property on object * diff --git a/lib/include.js b/lib/include.js index 1692d4d1..cefa2eb8 100644 --- a/lib/include.js +++ b/lib/include.js @@ -785,7 +785,6 @@ Inclusion.include = function(objects, include, options, cb) { } } - /** * Handle Inclusion of Polymorphic HasOne relation * @param callback @@ -921,7 +920,6 @@ Inclusion.include = function(objects, include, options, cb) { } } - /** * Handle Inclusion of EmbedsMany/EmbedsManyWithBelongsTo/EmbedsOne * Relations. Since Embedded docs are part of parents, no need to make diff --git a/lib/include_utils.js b/lib/include_utils.js index 29145fb9..2a65cacf 100644 --- a/lib/include_utils.js +++ b/lib/include_utils.js @@ -38,7 +38,6 @@ function buildOneToManyIdentityMapWithOrigKeys(objs, idName) { return kvMap; } - /** * Yeah, it joins. You need three things id -> obj1 map, id -> [obj2] map and merge function. * This functions will take each obj1, locate all data to join in map2 and call merge function. @@ -56,7 +55,6 @@ function join(oneToOneIdMap, oneToManyIdMap, mergeF) { } } - /** * Map with arbitrary keys and values. User .set() and .get() to work with values instead of [] * @returns {{set: Function, get: Function, remove: Function, exist: Function, getKeys: Function}} diff --git a/lib/introspection.js b/lib/introspection.js index fdf963db..ce1a9c82 100644 --- a/lib/introspection.js +++ b/lib/introspection.js @@ -61,5 +61,3 @@ module.exports = function getIntrospector(ModelBuilder) { ModelBuilder.introspect = introspectType; return introspectType; }; - - diff --git a/lib/relation-definition.js b/lib/relation-definition.js index 23e04b4d..5e3c9a79 100644 --- a/lib/relation-definition.js +++ b/lib/relation-definition.js @@ -818,7 +818,6 @@ HasMany.prototype.exists = function(fkId, options, cb) { var modelInstance = this.modelInstance; cb = cb || utils.createPromiseCallback(); - this.findById(fkId, function(err, inst) { if (err) { return cb(err); @@ -1054,8 +1053,6 @@ HasManyThrough.prototype.create = function create(data, options, cb) { return cb.promise; }; - - /** * Add the target model instance to the 'hasMany' relation * @param {Object|ID} acInst The actual instance or id value @@ -1191,7 +1188,6 @@ HasManyThrough.prototype.remove = function(acInst, options, cb) { return cb.promise; }; - /** * Declare "belongsTo" relation that sets up a one-to-one connection with * another model, such that each instance of the declaring model "belongs to" @@ -1513,7 +1509,6 @@ BelongsTo.prototype.related = function(condOrRefresh, options, cb) { } }; - /** * Define a Promise-based method for the belongsTo relation itself * - order.customer.get(cb): Load the target model instance asynchronously @@ -1532,7 +1527,6 @@ BelongsTo.prototype.getAsync = function(options, cb) { return cb.promise; }; - /** * A hasAndBelongsToMany relation creates a direct many-to-many connection with * another model, with no intervening model. For example, if your application @@ -2443,7 +2437,6 @@ EmbedsMany.prototype.related = function(receiver, scopeParams, condOrRefresh, op actualCond = condOrRefresh; } - var embeddedList = this.embeddedList(receiver); this.definition.applyScope(receiver, actualCond); diff --git a/lib/transaction.js b/lib/transaction.js index 8edb4845..631d15f2 100644 --- a/lib/transaction.js +++ b/lib/transaction.js @@ -182,5 +182,3 @@ if (Transaction) { } TransactionMixin.Transaction = Transaction; - - diff --git a/package.json b/package.json index a185920f..fea4ef9e 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "debug": "^2.1.1", "depd": "^1.0.0", "eslint": "^2.5.3", - "eslint-config-loopback": "^1.0.0", + "eslint-config-loopback": "^2.0.0", "inflection": "^1.6.0", "loopback-connector": "^2.1.0", "node-uuid": "^1.4.2", diff --git a/support/describe-operation-hooks.js b/support/describe-operation-hooks.js index b8c3946f..5f398d7c 100644 --- a/support/describe-operation-hooks.js +++ b/support/describe-operation-hooks.js @@ -112,7 +112,6 @@ operations.forEach(function(op) { p.then(report, function(err) { console.error(err.stack); }); - function createOptimizedDataSource() { var ds = new DataSource({ connector: Memory }); ds.name = 'Optimized'; diff --git a/test/basic-querying.test.js b/test/basic-querying.test.js index 6b0d8f51..ff8c9302 100644 --- a/test/basic-querying.test.js +++ b/test/basic-querying.test.js @@ -447,7 +447,6 @@ describe('basic-querying', function() { }); }); - it('should only include fields as specified', function(done) { var remaining = 0; diff --git a/test/hooks.test.js b/test/hooks.test.js index b059e527..7cb9b5c3 100644 --- a/test/hooks.test.js +++ b/test/hooks.test.js @@ -439,8 +439,6 @@ describe('hooks', function() { }); }); - - function addHooks(name, done) { var called = false, random = String(Math.floor(Math.random() * 1000)); User['before' + name] = function(next, data) { diff --git a/test/include.test.js b/test/include.test.js index 174d5c1c..a5115618 100644 --- a/test/include.test.js +++ b/test/include.test.js @@ -721,7 +721,6 @@ describe('include', function() { }); }); - // Not implemented correctly, see: loopback-datasource-juggler/issues/166 // fixed by DB optimization it('should support include scope on hasAndBelongsToMany', function(done) { @@ -882,7 +881,6 @@ describe('include', function() { }); }); - it('should not make n+1 db calls in relation syntax', function(done) { var self = this; diff --git a/test/include_util.test.js b/test/include_util.test.js index f8aa177c..244b9f85 100644 --- a/test/include_util.test.js +++ b/test/include_util.test.js @@ -75,7 +75,6 @@ describe('include_util', function() { }); }); - describe('KVMap', function() { it('should allow to set and get value with key string', function() { var map = new includeUtils.KVMap(); diff --git a/test/loopback-dl.test.js b/test/loopback-dl.test.js index 8de4f2c0..08789dd3 100644 --- a/test/loopback-dl.test.js +++ b/test/loopback-dl.test.js @@ -735,7 +735,6 @@ describe('Load models with base', function() { u.should.have.property('email', 'x@y.com'); }); - it('should set up base class via parent arg', function() { var ds = new ModelBuilder(); diff --git a/test/manipulation.test.js b/test/manipulation.test.js index 4277ad25..f2d21f6e 100644 --- a/test/manipulation.test.js +++ b/test/manipulation.test.js @@ -1448,7 +1448,6 @@ describe('manipulation', function() { }); }); - describe('uuidv4 defaultFn', function() { var CustomModel; diff --git a/test/memory.test.js b/test/memory.test.js index e1c3a73d..3a829f38 100644 --- a/test/memory.test.js +++ b/test/memory.test.js @@ -753,7 +753,6 @@ describe('Memory connector', function() { }); }); - describe('automigrate when NO models are attached', function() { var ds; beforeEach(function() { @@ -1011,5 +1010,3 @@ describe('Memory connector with observers', function() { }); }); }); - - diff --git a/test/optional-validation.test.js b/test/optional-validation.test.js index f970d9b5..854dd608 100644 --- a/test/optional-validation.test.js +++ b/test/optional-validation.test.js @@ -136,7 +136,6 @@ describe('optional-validation', function() { }); }); - describe('no model setting', function() { describe('method create', function() { diff --git a/test/persistence-hooks.suite.js b/test/persistence-hooks.suite.js index aa12cc73..b463ffa4 100644 --- a/test/persistence-hooks.suite.js +++ b/test/persistence-hooks.suite.js @@ -2361,8 +2361,6 @@ module.exports = function(dataSource, should, connectorCapabilities) { }, }); - - if (dataSource.connector.replaceOrCreate) { expectedContext.where = { id: 'new-id' }; } else { @@ -2980,7 +2978,6 @@ module.exports = function(dataSource, should, connectorCapabilities) { } }); - function get(propertyName) { return function(obj) { return obj[propertyName]; diff --git a/test/relations.test.js b/test/relations.test.js index 46660c9f..779f4a43 100644 --- a/test/relations.test.js +++ b/test/relations.test.js @@ -1271,7 +1271,6 @@ describe('relations', function() { db.automigrate(['User', 'Follow'], done); }); - it('should set foreignKeys of through model correctly in first relation', function(done) { var follower = new User({ id: 1 }); @@ -3194,7 +3193,6 @@ describe('relations', function() { }); }); - describe('hasMany with primaryKey different from model PK', function() { var Employee, Boss; var COMPANY_ID = 'Company1'; @@ -3252,7 +3250,6 @@ describe('relations', function() { }); }); - describe('belongsTo with primaryKey different from model PK', function() { var Employee, Boss; var COMPANY_ID = 'Company1'; @@ -3428,7 +3425,6 @@ describe('relations', function() { .catch(done); }); - it('should set targetClass on scope property', function() { should.equal(Article.prototype.tagNames._targetClass, 'TagName'); }); @@ -5109,8 +5105,6 @@ describe('relations', function() { }).catch(done); }); - - it('should not allow duplicate record on scope with promises', function(done) { Category.findOne() .then(function(cat) { @@ -5359,10 +5353,8 @@ describe('relations', function() { }) .catch(done); }); - }); - describe('custom relation/scope methods', function() { var categoryId; diff --git a/test/scope.test.js b/test/scope.test.js index d6fd5fa5..6071bcc7 100644 --- a/test/scope.test.js +++ b/test/scope.test.js @@ -329,10 +329,8 @@ describe('scope - filtered count, updateAll and destroyAll', function() { }); describe('scope - dynamic target class', function() { - var Collection, Media, Image, Video; - before(function() { db = getSchema(); Image = db.define('Image', { name: String });