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'; 'use strict';
/* global module:false */
module.exports = function(grunt) { module.exports = function(grunt) {
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({

View File

@ -8,8 +8,8 @@
/*! /*!
* Dependencies * Dependencies
*/ */
var relation = require('loopback-datasource-juggler/lib/relation-definition'); const relation = require('loopback-datasource-juggler/lib/relation-definition');
var RelationDefinition = relation.RelationDefinition; const RelationDefinition = relation.RelationDefinition;
module.exports = RelationMixin; module.exports = RelationMixin;
@ -75,7 +75,7 @@ function RelationMixin() {
* @property {Object} model Model object * @property {Object} model Model object
*/ */
RelationMixin.hasMany = function hasMany(modelTo, params) { 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); this.dataSource.adapter.resolve(this);
defineRelationProperty(this, def); defineRelationProperty(this, def);
}; };
@ -139,7 +139,7 @@ RelationMixin.hasMany = function hasMany(modelTo, params) {
* *
*/ */
RelationMixin.belongsTo = function(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); this.dataSource.adapter.resolve(this);
defineRelationProperty(this, def); defineRelationProperty(this, def);
}; };
@ -179,31 +179,31 @@ RelationMixin.belongsTo = function(modelTo, params) {
*/ */
RelationMixin.hasAndBelongsToMany = RelationMixin.hasAndBelongsToMany =
function hasAndBelongsToMany(modelTo, params) { function hasAndBelongsToMany(modelTo, params) {
var def = RelationDefinition.hasAndBelongsToMany(this, modelTo, params); const def = RelationDefinition.hasAndBelongsToMany(this, modelTo, params);
this.dataSource.adapter.resolve(this); this.dataSource.adapter.resolve(this);
defineRelationProperty(this, def); defineRelationProperty(this, def);
}; };
RelationMixin.hasOne = function hasOne(modelTo, params) { 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); this.dataSource.adapter.resolve(this);
defineRelationProperty(this, def); defineRelationProperty(this, def);
}; };
RelationMixin.referencesMany = function referencesMany(modelTo, params) { 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); this.dataSource.adapter.resolve(this);
defineRelationProperty(this, def); defineRelationProperty(this, def);
}; };
RelationMixin.embedsOne = function embedsOne(modelTo, params) { 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); this.dataSource.adapter.resolve(this);
defineRelationProperty(this, def); defineRelationProperty(this, def);
}; };
RelationMixin.embedsMany = function embedsMany(modelTo, params) { 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); this.dataSource.adapter.resolve(this);
defineRelationProperty(this, def); defineRelationProperty(this, def);
}; };

View File

@ -9,14 +9,14 @@
* Dependencies. * Dependencies.
*/ */
var assert = require('assert'); const assert = require('assert');
var remoting = require('strong-remoting'); const remoting = require('strong-remoting');
var utils = require('loopback-datasource-juggler/lib/utils'); const utils = require('loopback-datasource-juggler/lib/utils');
var jutil = require('loopback-datasource-juggler/lib/jutil'); const jutil = require('loopback-datasource-juggler/lib/jutil');
var RelationMixin = require('./relations'); const RelationMixin = require('./relations');
var InclusionMixin = require('loopback-datasource-juggler/lib/include'); const InclusionMixin = require('loopback-datasource-juggler/lib/include');
var findMethodNames = ['findById', 'findOne']; const findMethodNames = ['findById', 'findOne'];
/** /**
* Export the RemoteConnector class. * Export the RemoteConnector class.
@ -48,7 +48,7 @@ function RemoteConnector(settings) {
} }
// handle mixins in the define() method // 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) { RemoteConnector.initialize = function(dataSource, callback) {
var connector = dataSource.connector = const connector = dataSource.connector =
new RemoteConnector(dataSource.settings); new RemoteConnector(dataSource.settings);
connector.connect(); connector.connect();
process.nextTick(callback); process.nextTick(callback);
@ -110,19 +110,19 @@ RemoteConnector.prototype.setupRemotingTypeFor = function(Model) {
}; };
function createProxyMethod(Model, remotes, remoteMethod) { function createProxyMethod(Model, remotes, remoteMethod) {
var scope = remoteMethod.isStatic ? Model : Model.prototype; const scope = remoteMethod.isStatic ? Model : Model.prototype;
var original = scope[remoteMethod.name]; const original = scope[remoteMethod.name];
function remoteMethodProxy() { function remoteMethodProxy() {
var args = Array.prototype.slice.call(arguments); const args = Array.prototype.slice.call(arguments);
var lastArgIsFunc = typeof args[args.length - 1] === 'function'; const lastArgIsFunc = typeof args[args.length - 1] === 'function';
var callback; let callback;
if (lastArgIsFunc) { if (lastArgIsFunc) {
callback = args.pop(); callback = args.pop();
} else { } else {
callback = utils.createPromiseCallback(); callback = utils.createPromiseCallback();
} }
var callbackPromise = callback.promise; const callbackPromise = callback.promise;
if (findMethodNames.includes(remoteMethod.name)) { if (findMethodNames.includes(remoteMethod.name)) {
callback = proxy404toNull(callback); callback = proxy404toNull(callback);
@ -131,7 +131,7 @@ function createProxyMethod(Model, remotes, remoteMethod) {
if (remoteMethod.isStatic) { if (remoteMethod.isStatic) {
remotes.invoke(remoteMethod.stringName, args, callback); remotes.invoke(remoteMethod.stringName, args, callback);
} else { } else {
var ctorArgs = [this.id]; const ctorArgs = [this.id];
remotes.invoke(remoteMethod.stringName, ctorArgs, args, callback); remotes.invoke(remoteMethod.stringName, ctorArgs, args, callback);
} }

View File

@ -37,11 +37,11 @@
"devDependencies": { "devDependencies": {
"assert": "^1.4.1", "assert": "^1.4.1",
"bluebird": "^3.5.1", "bluebird": "^3.5.1",
"eslint": "^6.5.1",
"eslint-config-loopback": "^13.1.0",
"grunt": "^1.0.3", "grunt": "^1.0.3",
"grunt-cli": "^1.2.0", "grunt-cli": "^1.2.0",
"grunt-mocha-test": "^0.13.3", "grunt-mocha-test": "^0.13.3",
"eslint": "^5.4.0",
"eslint-config-loopback": "^11.0.0",
"loopback": "^3.0.0", "loopback": "^3.0.0",
"mocha": "^5.2.0", "mocha": "^5.2.0",
"sinon": "^6.0.0", "sinon": "^6.0.0",

View File

@ -5,9 +5,9 @@
'use strict'; 'use strict';
var extend = require('util')._extend; const extend = require('util')._extend;
var loopback = require('loopback'); const loopback = require('loopback');
var remoteConnector = require('..'); const remoteConnector = require('..');
exports.createMemoryDataSource = createMemoryDataSource; exports.createMemoryDataSource = createMemoryDataSource;
exports.createRemoteDataSource = createRemoteDataSource; exports.createRemoteDataSource = createRemoteDataSource;