Update eslint-config-loopback to latest
This commit is contained in:
parent
e513c0d355
commit
84322d07a9
|
@ -25,7 +25,7 @@ function KeyValueMemoryConnector(settings, dataSource) {
|
||||||
this._store = Object.create(null);
|
this._store = Object.create(null);
|
||||||
|
|
||||||
this._setupRegularCleanup();
|
this._setupRegularCleanup();
|
||||||
};
|
}
|
||||||
util.inherits(KeyValueMemoryConnector, Connector);
|
util.inherits(KeyValueMemoryConnector, Connector);
|
||||||
|
|
||||||
KeyValueMemoryConnector.prototype._setupRegularCleanup = function() {
|
KeyValueMemoryConnector.prototype._setupRegularCleanup = function() {
|
||||||
|
|
|
@ -272,7 +272,7 @@ Memory.prototype.create = function create(model, data, options, callback) {
|
||||||
return process.nextTick(function() {
|
return process.nextTick(function() {
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
self.saveToFile(id, callback);
|
self.saveToFile(id, callback);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,7 +71,7 @@ function DateString(value) {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.when = value;
|
this.when = value;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of DateString in its original form.
|
* Returns the value of DateString in its original form.
|
||||||
|
|
|
@ -38,7 +38,7 @@ exports.nearFilter = function nearFilter(where) {
|
||||||
key: clauseKey,
|
key: clauseKey,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var nearResults = [];
|
var nearResults = [];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function KeyValueAccessObject() {
|
function KeyValueAccessObject() {
|
||||||
};
|
}
|
||||||
|
|
||||||
module.exports = KeyValueAccessObject;
|
module.exports = KeyValueAccessObject;
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ function normalizeType(type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
}
|
||||||
|
|
||||||
function extendScopeMethods(definition, scopeMethods, ext) {
|
function extendScopeMethods(definition, scopeMethods, ext) {
|
||||||
var customMethods = [];
|
var customMethods = [];
|
||||||
|
@ -87,7 +87,7 @@ function extendScopeMethods(definition, scopeMethods, ext) {
|
||||||
var relation = new relationClass(definition, this);
|
var relation = new relationClass(definition, this);
|
||||||
return relationMethod.apply(relation, arguments);
|
return relationMethod.apply(relation, arguments);
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
for (var key in ext) {
|
for (var key in ext) {
|
||||||
var relationMethod = ext[key];
|
var relationMethod = ext[key];
|
||||||
var method = scopeMethods[key] = createFunc(definition, relationMethod);
|
var method = scopeMethods[key] = createFunc(definition, relationMethod);
|
||||||
|
@ -98,7 +98,7 @@ function extendScopeMethods(definition, scopeMethods, ext) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [].concat(customMethods || []);
|
return [].concat(customMethods || []);
|
||||||
};
|
}
|
||||||
|
|
||||||
function bindRelationMethods(relation, relationMethod, definition) {
|
function bindRelationMethods(relation, relationMethod, definition) {
|
||||||
var methods = definition.methods || {};
|
var methods = definition.methods || {};
|
||||||
|
@ -106,7 +106,7 @@ function bindRelationMethods(relation, relationMethod, definition) {
|
||||||
if (typeof methods[m] !== 'function') return;
|
if (typeof methods[m] !== 'function') return;
|
||||||
relationMethod[m] = methods[m].bind(relation);
|
relationMethod[m] = methods[m].bind(relation);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
function preventFkOverride(inst, data, fkProp) {
|
function preventFkOverride(inst, data, fkProp) {
|
||||||
if (!fkProp) return undefined;
|
if (!fkProp) return undefined;
|
||||||
|
@ -766,7 +766,7 @@ RelationDefinition.hasMany = function hasMany(modelFrom, modelToRef, params) {
|
||||||
if (typeof method === 'function' && method.shared === true) {
|
if (typeof method === 'function' && method.shared === true) {
|
||||||
modelFrom.prototype['__' + methodName + '__' + relationName] = method;
|
modelFrom.prototype['__' + methodName + '__' + relationName] = method;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
// Mix the property and scoped methods into the prototype class
|
// Mix the property and scoped methods into the prototype class
|
||||||
defineScope(modelFrom.prototype, params.through || modelTo, relationName, function() {
|
defineScope(modelFrom.prototype, params.through || modelTo, relationName, function() {
|
||||||
|
@ -2583,7 +2583,7 @@ RelationDefinition.embedsMany = function embedsMany(modelFrom, modelToRef, param
|
||||||
if (typeof method === 'function' && method.shared === true) {
|
if (typeof method === 'function' && method.shared === true) {
|
||||||
modelFrom.prototype['__' + methodName + '__' + relationName] = method;
|
modelFrom.prototype['__' + methodName + '__' + relationName] = method;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
// Mix the property and scoped methods into the prototype class
|
// Mix the property and scoped methods into the prototype class
|
||||||
var scopeDefinition = defineScope(modelFrom.prototype, modelTo, relationName, function() {
|
var scopeDefinition = defineScope(modelFrom.prototype, modelTo, relationName, function() {
|
||||||
|
@ -2715,7 +2715,7 @@ EmbedsMany.prototype.findById = function(fkId, options, cb) {
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
cb(null, item);
|
cb(null, item);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
return item; // sync
|
return item; // sync
|
||||||
};
|
};
|
||||||
|
@ -2897,7 +2897,7 @@ EmbedsMany.prototype.at = function(index, cb) {
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
cb(null, item);
|
cb(null, item);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
return item; // sync
|
return item; // sync
|
||||||
};
|
};
|
||||||
|
@ -3198,7 +3198,7 @@ RelationDefinition.referencesMany = function referencesMany(modelFrom, modelToRe
|
||||||
if (typeof method === 'function' && method.shared === true) {
|
if (typeof method === 'function' && method.shared === true) {
|
||||||
modelFrom.prototype['__' + methodName + '__' + relationName] = method;
|
modelFrom.prototype['__' + methodName + '__' + relationName] = method;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
// Mix the property and scoped methods into the prototype class
|
// Mix the property and scoped methods into the prototype class
|
||||||
var scopeDefinition = defineScope(modelFrom.prototype, modelTo, relationName, function() {
|
var scopeDefinition = defineScope(modelFrom.prototype, modelTo, relationName, function() {
|
||||||
|
|
|
@ -104,7 +104,7 @@ ScopeDefinition.prototype.related = function(receiver, scopeParams, condOrRefres
|
||||||
// The filter applied on relatedModel
|
// The filter applied on relatedModel
|
||||||
var queryRelated = filter.scope;
|
var queryRelated = filter.scope;
|
||||||
delete params.include.scope;
|
delete params.include.scope;
|
||||||
};
|
}
|
||||||
|
|
||||||
targetModel.find(params, options, function(err, data) {
|
targetModel.find(params, options, function(err, data) {
|
||||||
if (!err && saveOnCache) {
|
if (!err && saveOnCache) {
|
||||||
|
|
|
@ -610,7 +610,7 @@ function sortObjectsByIds(idName, ids, objects, strict) {
|
||||||
});
|
});
|
||||||
|
|
||||||
return heading.concat(tailing);
|
return heading.concat(tailing);
|
||||||
};
|
}
|
||||||
|
|
||||||
function createPromiseCallback() {
|
function createPromiseCallback() {
|
||||||
var cb;
|
var cb;
|
||||||
|
@ -725,7 +725,7 @@ function findIndexOf(arr, target, isEqual) {
|
||||||
|
|
||||||
for (var i = 0; i < arr.length; i++) {
|
for (var i = 0; i < arr.length; i++) {
|
||||||
if (isEqual(arr[i], target)) { return i; }
|
if (isEqual(arr[i], target)) { return i; }
|
||||||
};
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -741,7 +741,7 @@ function collectTargetIds(targetData, idPropertyName) {
|
||||||
for (var i = 0; i < targetData.length; i++) {
|
for (var i = 0; i < targetData.length; i++) {
|
||||||
var targetId = targetData[i][idPropertyName];
|
var targetId = targetData[i][idPropertyName];
|
||||||
targetIds.push(targetId);
|
targetIds.push(targetId);
|
||||||
};
|
}
|
||||||
var IdQuery = {
|
var IdQuery = {
|
||||||
inq: uniq(targetIds),
|
inq: uniq(targetIds),
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
"bson": "^4.0.1",
|
"bson": "^4.0.1",
|
||||||
"coveralls": "^3.0.1",
|
"coveralls": "^3.0.1",
|
||||||
"eslint": "^5.1.0",
|
"eslint": "^5.1.0",
|
||||||
"eslint-config-loopback": "^11.0.0",
|
"eslint-config-loopback": "^12.1.0",
|
||||||
"loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing",
|
"loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"nyc": "^13.1.0",
|
"nyc": "^13.1.0",
|
||||||
|
|
|
@ -119,7 +119,7 @@ describe('async observer', function() {
|
||||||
function call(ctx, next) {
|
function call(ctx, next) {
|
||||||
notifications.push('call');
|
notifications.push('call');
|
||||||
process.nextTick(next);
|
process.nextTick(next);
|
||||||
};
|
}
|
||||||
|
|
||||||
TestModel.observe('event', call);
|
TestModel.observe('event', call);
|
||||||
TestModel.removeObserver('event', call);
|
TestModel.removeObserver('event', call);
|
||||||
|
@ -137,7 +137,7 @@ describe('async observer', function() {
|
||||||
function call(ctx, next) {
|
function call(ctx, next) {
|
||||||
notifications.push('call');
|
notifications.push('call');
|
||||||
process.nextTick(next);
|
process.nextTick(next);
|
||||||
};
|
}
|
||||||
|
|
||||||
TestModel.observe('event', call);
|
TestModel.observe('event', call);
|
||||||
TestModel.observe('event', call);
|
TestModel.observe('event', call);
|
||||||
|
|
|
@ -521,7 +521,7 @@ describe('basic-querying', function() {
|
||||||
for (var ix = 0; ix < users.length; ix++) {
|
for (var ix = 0; ix < users.length; ix++) {
|
||||||
users[ix].name.should.be.oneOf(['John Lennon', 'Stuart Sutcliffe', 'Paul McCartney']);
|
users[ix].name.should.be.oneOf(['John Lennon', 'Stuart Sutcliffe', 'Paul McCartney']);
|
||||||
users[ix].vip.should.be.true();
|
users[ix].vip.should.be.true();
|
||||||
};
|
}
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -577,7 +577,7 @@ function testOrm(dataSource) {
|
||||||
|
|
||||||
function done() {
|
function done() {
|
||||||
if (--wait === 0) test.done();
|
if (--wait === 0) test.done();
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return type of property', function(test) {
|
it('should return type of property', function(test) {
|
||||||
|
|
|
@ -426,7 +426,7 @@ describe('default scope', function() {
|
||||||
exists.should.be.false;
|
exists.should.be.false;
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
db.automigrate(setupProducts.bind(null, ids, done));
|
db.automigrate(setupProducts.bind(null, ids, done));
|
||||||
|
|
|
@ -15,7 +15,7 @@ function ContextRecorder(initialValue) {
|
||||||
return new ContextRecorder(initialValue);
|
return new ContextRecorder(initialValue);
|
||||||
}
|
}
|
||||||
this.records = initialValue;
|
this.records = initialValue;
|
||||||
};
|
}
|
||||||
|
|
||||||
ContextRecorder.prototype.recordAndNext = function(transformFm) {
|
ContextRecorder.prototype.recordAndNext = function(transformFm) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
|
@ -13,7 +13,7 @@ function HookMonitor(opts) {
|
||||||
|
|
||||||
this.options = opts || {};
|
this.options = opts || {};
|
||||||
this.names = [];
|
this.names = [];
|
||||||
};
|
}
|
||||||
|
|
||||||
HookMonitor.prototype.install = function(ObservedModel, hookNames) {
|
HookMonitor.prototype.install = function(ObservedModel, hookNames) {
|
||||||
var monitor = this;
|
var monitor = this;
|
||||||
|
|
|
@ -11,7 +11,7 @@ function givenCacheItem(dataSourceFactory) {
|
||||||
value: 'Any',
|
value: 'Any',
|
||||||
};
|
};
|
||||||
return givenModel(dataSourceFactory, 'CacheItem', modelProperties);
|
return givenModel(dataSourceFactory, 'CacheItem', modelProperties);
|
||||||
};
|
}
|
||||||
|
|
||||||
function givenModel(dataSourceFactory, modelName,
|
function givenModel(dataSourceFactory, modelName,
|
||||||
modelProperties, options) {
|
modelProperties, options) {
|
||||||
|
@ -20,7 +20,7 @@ function givenModel(dataSourceFactory, modelName,
|
||||||
const p = 'deleteAll' in dataSource.connector ?
|
const p = 'deleteAll' in dataSource.connector ?
|
||||||
Model.deleteAll() : Promise.resolve();
|
Model.deleteAll() : Promise.resolve();
|
||||||
return p.then(() => Model);
|
return p.then(() => Model);
|
||||||
};
|
}
|
||||||
|
|
||||||
function givenKeys(Model, keys, cb) {
|
function givenKeys(Model, keys, cb) {
|
||||||
var p = Promise.all(
|
var p = Promise.all(
|
||||||
|
@ -32,7 +32,7 @@ function givenKeys(Model, keys, cb) {
|
||||||
p = p.then(function(r) { cb(null, r); }, cb);
|
p = p.then(function(r) { cb(null, r); }, cb);
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
};
|
}
|
||||||
|
|
||||||
function delay(ms) {
|
function delay(ms) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
|
|
@ -65,6 +65,6 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
||||||
function setupCacheItem() {
|
function setupCacheItem() {
|
||||||
return helpers.givenCacheItem(dataSourceFactory)
|
return helpers.givenCacheItem(dataSourceFactory)
|
||||||
.then(ModelCtor => CacheItem = ModelCtor);
|
.then(ModelCtor => CacheItem = ModelCtor);
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -102,6 +102,6 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
||||||
function setupCacheItem() {
|
function setupCacheItem() {
|
||||||
return helpers.givenCacheItem(dataSourceFactory)
|
return helpers.givenCacheItem(dataSourceFactory)
|
||||||
.then(ModelCtor => CacheItem = ModelCtor);
|
.then(ModelCtor => CacheItem = ModelCtor);
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,7 +47,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
||||||
function setupCacheItem() {
|
function setupCacheItem() {
|
||||||
return helpers.givenCacheItem(dataSourceFactory)
|
return helpers.givenCacheItem(dataSourceFactory)
|
||||||
.then(ModelCtor => CacheItem = ModelCtor);
|
.then(ModelCtor => CacheItem = ModelCtor);
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -946,7 +946,7 @@ describe('relations', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('find over related model with options', function() {
|
describe('find over related model with options', function() {
|
||||||
|
|
Loading…
Reference in New Issue