Merge pull request #99 from strongloop/update-eslint

Update eslint & config to latest
This commit is contained in:
Miroslav Bajtoš 2019-10-04 10:04:32 +02:00 committed by GitHub
commit 4ff55feb24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 31 deletions

View File

@ -5,7 +5,6 @@
'use strict';
/* global module:false */
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({

View File

@ -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);
};

View File

@ -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);
}

View File

@ -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",

View File

@ -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;