Skip to content

Commit

Permalink
Merge pull request #1215 from strongloop/upgrade-eslint
Browse files Browse the repository at this point in the history
Upgrade eslint-config to 7.x
  • Loading branch information
bajtos committed Jan 6, 2017
2 parents 66c54a9 + 454bf93 commit 1e05640
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 94 deletions.
4 changes: 2 additions & 2 deletions lib/dao.js
Expand Up @@ -2581,7 +2581,7 @@ DataAccessObject.updateAll = function(where, data, options, cb) {
}

function updateCallback(err, info) {
if (err) return cb (err);
if (err) return cb(err);

var context = {
Model: Model,
Expand All @@ -2603,7 +2603,7 @@ DataAccessObject.updateAll = function(where, data, options, cb) {
options: options,
};
Model.notifyObserversOf('persist', context, function(err, ctx) {
if (err) return cb (err);
if (err) return cb(err);

if (connector.update.length === 5) {
connector.update(Model.modelName, where, data, options, updateCallback);
Expand Down
106 changes: 53 additions & 53 deletions lib/include.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions lib/relation-definition.js
Expand Up @@ -898,9 +898,9 @@ var throughKeys = function(definition) {
} else if (definition.modelFrom === definition.modelTo) {
return findBelongsTo(modelThrough, definition.modelTo, pk2).
sort(function(fk1, fk2) {
//Fix for bug - https://github.com/strongloop/loopback-datasource-juggler/issues/571
//Make sure that first key is mapped to modelFrom
//& second key to modelTo. Order matters
// Fix for bug - https://github.com/strongloop/loopback-datasource-juggler/issues/571
// Make sure that first key is mapped to modelFrom
// & second key to modelTo. Order matters
return (definition.keyTo === fk1) ? -1 : 1;
});
} else {
Expand Down Expand Up @@ -1812,7 +1812,7 @@ HasMany.prototype.create = function(targetModelData, options, cb) {

modelTo.create(targetModelData, options, function(err, targetModel) {
if (!err) {
//Refresh the cache
// Refresh the cache
apply(targetModel, self.addToCache.bind(self));
cb && cb(err, targetModel);
} else {
Expand Down
12 changes: 6 additions & 6 deletions lib/utils.js
Expand Up @@ -120,7 +120,7 @@ function convertToArray(include) {
obj[include] = true;
return [obj];
} else if (isPlainObject(include)) {
//if include is of the form - {relation:'',scope:''}
// if include is of the form - {relation:'',scope:''}
if (include.rel || include.relation) {
return [include];
}
Expand Down Expand Up @@ -178,15 +178,15 @@ function mergeQuery(base, update, spec) {
base.include = update.include;
} else {
if (spec.nestedInclude === true) {
//specify nestedInclude=true to force nesting of inclusions on scoped
//queries. e.g. In physician.patients.getAsync({include: 'address'}),
//inclusion should be on patient model, not on physician model.
// specify nestedInclude=true to force nesting of inclusions on scoped
// queries. e.g. In physician.patients.getAsync({include: 'address'}),
// inclusion should be on patient model, not on physician model.
var saved = base.include;
base.include = {};
base.include[update.include] = saved;
} else {
//default behaviour of inclusion merge - merge inclusions at the same
//level. - https://github.com/strongloop/loopback-datasource-juggler/pull/569#issuecomment-95310874
// default behaviour of inclusion merge - merge inclusions at the same
// level. - https://github.com/strongloop/loopback-datasource-juggler/pull/569#issuecomment-95310874
base.include = mergeIncludes(base.include, update.include);
}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -32,8 +32,8 @@
},
"devDependencies": {
"async-iterators": "^0.2.2",
"eslint": "^3.11.1",
"eslint-config-loopback": "^6.0.0",
"eslint": "^3.12.2",
"eslint-config-loopback": "^7.0.1",
"mocha": "^2.1.0",
"should": "^8.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion test/common_test.js
Expand Up @@ -478,7 +478,7 @@ function testOrm(dataSource) {

/* eslint-disable max-len */
it('hasMany should be cached', function(test) {
//User.create(function (e, u) {
// User.create(function (e, u) {
// u.posts.create({}, function (e, p) {
// find all posts for a user.
// Finding one post with an existing author associated
Expand Down
6 changes: 3 additions & 3 deletions test/geo.test.js
Expand Up @@ -3,8 +3,8 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

/*global describe,it*/
/*jshint expr:true */
/* global describe,it */
/* jshint expr:true */

'use strict';

Expand Down Expand Up @@ -44,7 +44,7 @@ describe('GeoPoint', function() {
});

it('should reject invalid parameters', function() {
/*jshint -W024 */
/* jshint -W024 */
var fn = function() {
new GeoPoint('150,-34');
};
Expand Down
6 changes: 3 additions & 3 deletions test/include.test.js
Expand Up @@ -841,11 +841,11 @@ describe('include', function() {
result.forEach(function(r) {
assemblies[r.name] = r;
});
//sedan
// sedan
assemblies.sedan.parts().should.have.length(3);
//hatchback
// hatchback
assemblies.hatchback.parts().should.have.length(2);
//SUV
// SUV
assemblies.SUV.parts().should.have.length(0);
self.called.should.eql(3);
done();
Expand Down
14 changes: 7 additions & 7 deletions test/manipulation.test.js
Expand Up @@ -95,11 +95,11 @@ describe('manipulation', function() {

it('should create instance (promise variant)', function(done) {
Person.create({name: 'Anatoliy'})
.then (function(p) {
.then(function(p) {
p.name.should.equal('Anatoliy');
should.exist(p);
return Person.findById(p.id)
.then (function(person) {
.then(function(person) {
person.id.should.eql(p.id);
person.name.should.equal('Anatoliy');
done();
Expand All @@ -125,7 +125,7 @@ describe('manipulation', function() {
p.name.should.equal('Anatoliy');
p.isNewRecord().should.be.true;
p.save()
.then (function(inst) {
.then(function(inst) {
inst.isNewRecord().should.be.false;
inst.should.equal(p);
done();
Expand Down Expand Up @@ -156,7 +156,7 @@ describe('manipulation', function() {

it('should not allow user-defined value for the id of object - create (promise variant)', function(done) {
Person.create({id: 123456})
.then (function(p) {
.then(function(p) {
done(new Error('Person.create should have failed.'));
}, function(err) {
err.should.be.instanceof(ValidationError);
Expand Down Expand Up @@ -184,7 +184,7 @@ describe('manipulation', function() {
var p = new Person({id: 123456});
p.isNewRecord().should.be.true;
p.save()
.then (function(inst) {
.then(function(inst) {
done(new Error('save should have failed.'));
}, function(err) {
err.should.be.instanceof(ValidationError);
Expand Down Expand Up @@ -223,11 +223,11 @@ describe('manipulation', function() {

it('should create instance with blank data (promise variant)', function(done) {
Person.create()
.then (function(p) {
.then(function(p) {
should.exist(p);
should.not.exists(p.name);
return Person.findById(p.id)
.then (function(person) {
.then(function(person) {
person.id.should.eql(p.id);
should.not.exists(person.name);
done();
Expand Down
4 changes: 2 additions & 2 deletions test/operation-hooks.suite/embeds-many-create.suite.js
Expand Up @@ -65,12 +65,12 @@ module.exports = function(dataSource, should, connectorCapabilities) {
return callCreate().then(function(result) {
hookMonitor.names.should.eql([
'Embedded:before save',
//TODO 'Embedded:persist',
// TODO 'Embedded:persist',
'Owner:before save',
'Owner:persist',
'Owner:loaded',
'Owner:after save',
//TODO 'Embedded:loaded',
// TODO 'Embedded:loaded',
'Embedded:after save',
]);
});
Expand Down
4 changes: 2 additions & 2 deletions test/operation-hooks.suite/embeds-many-update-by-id.suite.js
Expand Up @@ -82,12 +82,12 @@ module.exports = function(dataSource, should, connectorCapabilities) {
return callUpdate().then(function(result) {
hookMonitor.names.should.eql([
'Embedded:before save',
//TODO 'Embedded:persist',
// TODO 'Embedded:persist',
'Owner:before save',
'Owner:persist',
'Owner:loaded',
'Owner:after save',
//TODO 'Embedded:loaded',
// TODO 'Embedded:loaded',
'Embedded:after save',
]);
});
Expand Down
4 changes: 2 additions & 2 deletions test/operation-hooks.suite/embeds-one-create.suite.js
Expand Up @@ -65,12 +65,12 @@ module.exports = function(dataSource, should, connectorCapabilities) {
return callCreate().then(function(result) {
hookMonitor.names.should.eql([
'Embedded:before save',
//TODO 'Embedded:persist',
// TODO 'Embedded:persist',
'Owner:before save',
'Owner:persist',
'Owner:loaded',
'Owner:after save',
//TODO 'Embedded:loaded',
// TODO 'Embedded:loaded',
'Embedded:after save',
]);
});
Expand Down
4 changes: 2 additions & 2 deletions test/operation-hooks.suite/embeds-one-update.suite.js
Expand Up @@ -72,12 +72,12 @@ module.exports = function(dataSource, should, connectorCapabilities) {
return callUpdate().then(function(result) {
hookMonitor.names.should.eql([
'Embedded:before save',
//TODO 'Embedded:persist',
// TODO 'Embedded:persist',
'Owner:before save',
'Owner:persist',
'Owner:loaded',
'Owner:after save',
//TODO 'Embedded:loaded',
// TODO 'Embedded:loaded',
'Embedded:after save',
]);
});
Expand Down
4 changes: 2 additions & 2 deletions test/relations.test.js
Expand Up @@ -92,9 +92,9 @@ describe('relations', function() {

it('should create record on scope with promises', function(done) {
Book.create()
.then (function(book) {
.then(function(book) {
return book.chapters.create()
.then (function(c) {
.then(function(c) {
should.exist(c);
c.bookId.should.eql(book.id);
done();
Expand Down
6 changes: 3 additions & 3 deletions test/util.test.js
Expand Up @@ -338,7 +338,7 @@ describe('util.mergeIncludes', function() {

it('Merge includes with and without relation syntax properly',
function() {
//w & w/o relation syntax - no collision
// w & w/o relation syntax - no collision
var baseInclude = ['relation2'];
var updateInclude = {
relation: 'relation1',
Expand All @@ -350,14 +350,14 @@ describe('util.mergeIncludes', function() {
}, {relation2: true}];
checkInputOutput(baseInclude, updateInclude, expectedInclude);

//w & w/o relation syntax - collision
// w & w/o relation syntax - collision
baseInclude = ['relation1'];
updateInclude = {relation: 'relation1', scope: {include: 'relation2'}};
expectedInclude =
[{relation: 'relation1', scope: {include: 'relation2'}}];
checkInputOutput(baseInclude, updateInclude, expectedInclude);

//w & w/o relation syntax - collision
// w & w/o relation syntax - collision
baseInclude = {relation: 'relation1', scope: {include: 'relation2'}};
updateInclude = ['relation1'];
expectedInclude = [{relation1: true}];
Expand Down

0 comments on commit 1e05640

Please sign in to comment.