From 009758053735848e72e16314f354fe5ef194a848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 3 Oct 2019 10:54:13 +0200 Subject: [PATCH] Update eslint & config to latest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- Gruntfile.js | 1 - lib/relations.js | 18 +++++++++--------- lib/remote-connector.js | 32 ++++++++++++++++---------------- package.json | 4 ++-- test/helper.js | 6 +++--- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 5f24914..4f61271 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,7 +5,6 @@ 'use strict'; -/* global module:false */ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ diff --git a/lib/relations.js b/lib/relations.js index 242c603..5caef16 100644 --- a/lib/relations.js +++ b/lib/relations.js @@ -8,8 +8,8 @@ /*! * Dependencies */ -var relation = require('loopback-datasource-juggler/lib/relation-definition'); -var RelationDefinition = relation.RelationDefinition; +const relation = require('loopback-datasource-juggler/lib/relation-definition'); +const RelationDefinition = relation.RelationDefinition; module.exports = RelationMixin; @@ -75,7 +75,7 @@ function RelationMixin() { * @property {Object} model Model object */ RelationMixin.hasMany = function hasMany(modelTo, params) { - var def = RelationDefinition.hasMany(this, modelTo, params); + const def = RelationDefinition.hasMany(this, modelTo, params); this.dataSource.adapter.resolve(this); defineRelationProperty(this, def); }; @@ -139,7 +139,7 @@ RelationMixin.hasMany = function hasMany(modelTo, params) { * */ RelationMixin.belongsTo = function(modelTo, params) { - var def = RelationDefinition.belongsTo(this, modelTo, params); + const def = RelationDefinition.belongsTo(this, modelTo, params); this.dataSource.adapter.resolve(this); defineRelationProperty(this, def); }; @@ -179,31 +179,31 @@ RelationMixin.belongsTo = function(modelTo, params) { */ RelationMixin.hasAndBelongsToMany = function hasAndBelongsToMany(modelTo, params) { - var def = RelationDefinition.hasAndBelongsToMany(this, modelTo, params); + const def = RelationDefinition.hasAndBelongsToMany(this, modelTo, params); this.dataSource.adapter.resolve(this); defineRelationProperty(this, def); }; RelationMixin.hasOne = function hasOne(modelTo, params) { - var def = RelationDefinition.hasOne(this, modelTo, params); + const def = RelationDefinition.hasOne(this, modelTo, params); this.dataSource.adapter.resolve(this); defineRelationProperty(this, def); }; RelationMixin.referencesMany = function referencesMany(modelTo, params) { - var def = RelationDefinition.referencesMany(this, modelTo, params); + const def = RelationDefinition.referencesMany(this, modelTo, params); this.dataSource.adapter.resolve(this); defineRelationProperty(this, def); }; RelationMixin.embedsOne = function embedsOne(modelTo, params) { - var def = RelationDefinition.embedsOne(this, modelTo, params); + const def = RelationDefinition.embedsOne(this, modelTo, params); this.dataSource.adapter.resolve(this); defineRelationProperty(this, def); }; RelationMixin.embedsMany = function embedsMany(modelTo, params) { - var def = RelationDefinition.embedsMany(this, modelTo, params); + const def = RelationDefinition.embedsMany(this, modelTo, params); this.dataSource.adapter.resolve(this); defineRelationProperty(this, def); }; diff --git a/lib/remote-connector.js b/lib/remote-connector.js index 0e28c04..a590183 100644 --- a/lib/remote-connector.js +++ b/lib/remote-connector.js @@ -9,14 +9,14 @@ * Dependencies. */ -var assert = require('assert'); -var remoting = require('strong-remoting'); -var utils = require('loopback-datasource-juggler/lib/utils'); -var jutil = require('loopback-datasource-juggler/lib/jutil'); -var RelationMixin = require('./relations'); -var InclusionMixin = require('loopback-datasource-juggler/lib/include'); +const assert = require('assert'); +const remoting = require('strong-remoting'); +const utils = require('loopback-datasource-juggler/lib/utils'); +const jutil = require('loopback-datasource-juggler/lib/jutil'); +const RelationMixin = require('./relations'); +const InclusionMixin = require('loopback-datasource-juggler/lib/include'); -var findMethodNames = ['findById', 'findOne']; +const findMethodNames = ['findById', 'findOne']; /** * Export the RemoteConnector class. @@ -48,7 +48,7 @@ function RemoteConnector(settings) { } // handle mixins in the define() method - var DAO = this.DataAccessObject = function() { + const DAO = this.DataAccessObject = function() { }; } @@ -57,7 +57,7 @@ RemoteConnector.prototype.connect = function() { }; RemoteConnector.initialize = function(dataSource, callback) { - var connector = dataSource.connector = + const connector = dataSource.connector = new RemoteConnector(dataSource.settings); connector.connect(); process.nextTick(callback); @@ -110,19 +110,19 @@ RemoteConnector.prototype.setupRemotingTypeFor = function(Model) { }; function createProxyMethod(Model, remotes, remoteMethod) { - var scope = remoteMethod.isStatic ? Model : Model.prototype; - var original = scope[remoteMethod.name]; + const scope = remoteMethod.isStatic ? Model : Model.prototype; + const original = scope[remoteMethod.name]; function remoteMethodProxy() { - var args = Array.prototype.slice.call(arguments); - var lastArgIsFunc = typeof args[args.length - 1] === 'function'; - var callback; + const args = Array.prototype.slice.call(arguments); + const lastArgIsFunc = typeof args[args.length - 1] === 'function'; + let callback; if (lastArgIsFunc) { callback = args.pop(); } else { callback = utils.createPromiseCallback(); } - var callbackPromise = callback.promise; + const callbackPromise = callback.promise; if (findMethodNames.includes(remoteMethod.name)) { callback = proxy404toNull(callback); @@ -131,7 +131,7 @@ function createProxyMethod(Model, remotes, remoteMethod) { if (remoteMethod.isStatic) { remotes.invoke(remoteMethod.stringName, args, callback); } else { - var ctorArgs = [this.id]; + const ctorArgs = [this.id]; remotes.invoke(remoteMethod.stringName, ctorArgs, args, callback); } diff --git a/package.json b/package.json index 2d605ce..b6cafe0 100644 --- a/package.json +++ b/package.json @@ -37,11 +37,11 @@ "devDependencies": { "assert": "^1.4.1", "bluebird": "^3.5.1", + "eslint": "^6.5.1", + "eslint-config-loopback": "^13.1.0", "grunt": "^1.0.3", "grunt-cli": "^1.2.0", "grunt-mocha-test": "^0.13.3", - "eslint": "^5.4.0", - "eslint-config-loopback": "^11.0.0", "loopback": "^3.0.0", "mocha": "^5.2.0", "sinon": "^6.0.0", diff --git a/test/helper.js b/test/helper.js index 39fd204..634dee9 100644 --- a/test/helper.js +++ b/test/helper.js @@ -5,9 +5,9 @@ 'use strict'; -var extend = require('util')._extend; -var loopback = require('loopback'); -var remoteConnector = require('..'); +const extend = require('util')._extend; +const loopback = require('loopback'); +const remoteConnector = require('..'); exports.createMemoryDataSource = createMemoryDataSource; exports.createRemoteDataSource = createRemoteDataSource;