Skip to content

Commit

Permalink
Merge pull request #4283 from strongloop/fix-comma-dangle
Browse files Browse the repository at this point in the history
chore: fix eslint violations
  • Loading branch information
nabdelgadir committed Nov 19, 2019
2 parents f2f0b3a + aa76a19 commit b848bd9
Show file tree
Hide file tree
Showing 36 changed files with 217 additions and 217 deletions.
2 changes: 1 addition & 1 deletion common/models/access-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ module.exports = function(AccessToken) {
try {
assert(
this.created && typeof this.created.getTime === 'function',
'token.created must be a valid Date'
'token.created must be a valid Date',
);
assert(this.ttl !== 0, 'token.ttl must be not be 0');
assert(this.ttl, 'token.ttl must exist');
Expand Down
6 changes: 3 additions & 3 deletions common/models/acl.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,12 +607,12 @@ module.exports = function(ACL) {
break;
case ACL.USER:
this.userModel.findOne(
{where: {or: [{username: id}, {email: id}, {id: id}]}}, cb
{where: {or: [{username: id}, {email: id}, {id: id}]}}, cb,
);
break;
case ACL.APP:
this.applicationModel.findOne(
{where: {or: [{name: id}, {email: id}, {id: id}]}}, cb
{where: {or: [{name: id}, {email: id}, {id: id}]}}, cb,
);
break;
default:
Expand All @@ -621,7 +621,7 @@ module.exports = function(ACL) {
if (userModel) {
userModel.findOne(
{where: {or: [{username: id}, {email: id}, {id: id}]}},
cb
cb,
);
} else {
process.nextTick(function() {
Expand Down
10 changes: 5 additions & 5 deletions common/models/change.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ module.exports = function(Change) {
function(err, checkpoint) {
if (err) return cb(err);
doRectify(checkpoint, rev);
}
},
);
}

Expand Down Expand Up @@ -502,7 +502,7 @@ module.exports = function(Change) {
async.each(
changes,
function(c, next) { c.rectify(next); },
cb
cb,
);
});
};
Expand Down Expand Up @@ -692,9 +692,9 @@ module.exports = function(Change) {
conflict.SourceModel.updateLastChange(
conflict.modelId,
{prev: targetChange.rev},
cb
cb,
);
}
},
);
};

Expand Down Expand Up @@ -727,7 +727,7 @@ module.exports = function(Change) {
}
const inst = new conflict.SourceModel(
target.toObject(),
{persisted: true}
{persisted: true},
);
inst.save(done);
});
Expand Down
2 changes: 1 addition & 1 deletion common/models/key-value-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function throwNotAttached(modelName, methodName) {
'The %s method has not been setup. ' +
'The {{KeyValueModel}} has not been correctly attached ' +
'to a {{DataSource}}!',
modelName, methodName, methodName
modelName, methodName, methodName,
));
}

Expand Down
2 changes: 1 addition & 1 deletion common/models/role.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ module.exports = function(Role) {
if (promise && typeof promise.then === 'function') {
promise.then(
function(result) { callback(null, result); },
callback
callback,
);
}
return callback.promise;
Expand Down
2 changes: 1 addition & 1 deletion common/models/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = function(Scope) {
if (callback) callback(err);
} else {
aclModel.checkPermission(
aclModel.SCOPE, scope.id, model, property, accessType, callback
aclModel.SCOPE, scope.id, model, property, accessType, callback,
);
}
});
Expand Down
22 changes: 11 additions & 11 deletions common/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,14 +766,14 @@ module.exports = function(User) {
throw new Error(
'Cannot build user verification URL, ' +
'the default confirm method is not public. ' +
'Please provide the URL in verifyOptions.verifyHref.'
'Please provide the URL in verifyOptions.verifyHref.',
);
}

const urlPath = joinUrlPath(
verifyOptions.restApiRoot,
userModel.http.path,
confirmMethod.http.path
confirmMethod.http.path,
);

verifyOptions.verifyHref =
Expand Down Expand Up @@ -1148,7 +1148,7 @@ module.exports = function(User) {
'{{(`include=user`)}}\n\n'),
},
http: {verb: 'post'},
}
},
);

UserModel.remoteMethod(
Expand All @@ -1167,7 +1167,7 @@ module.exports = function(User) {
},
],
http: {verb: 'all'},
}
},
);

UserModel.remoteMethod(
Expand All @@ -1179,7 +1179,7 @@ module.exports = function(User) {
{arg: 'options', type: 'object', http: 'optionsFromRequest'},
],
http: {verb: 'post'},
}
},
);

UserModel.remoteMethod(
Expand All @@ -1192,7 +1192,7 @@ module.exports = function(User) {
{arg: 'redirect', type: 'string'},
],
http: {verb: 'get', path: '/confirm'},
}
},
);

UserModel.remoteMethod(
Expand All @@ -1203,7 +1203,7 @@ module.exports = function(User) {
{arg: 'options', type: 'object', required: true, http: {source: 'body'}},
],
http: {verb: 'post', path: '/reset'},
}
},
);

UserModel.remoteMethod(
Expand All @@ -1217,7 +1217,7 @@ module.exports = function(User) {
{arg: 'options', type: 'object', http: 'optionsFromRequest'},
],
http: {verb: 'POST', path: '/change-password'},
}
},
);

const setPasswordScopes = UserModel.settings.restrictResetPasswordTokenScope ?
Expand All @@ -1234,7 +1234,7 @@ module.exports = function(User) {
],
accessScopes: setPasswordScopes,
http: {verb: 'POST', path: '/reset-password'},
}
},
);

function getUserIdFromRequestContext(ctx) {
Expand Down Expand Up @@ -1337,7 +1337,7 @@ module.exports = function(User) {
// This is a programmer's error, use the default status code 500
return next(new Error(
'Invalid use of "options.setPassword". Only "password" can be ' +
'changed when using this option.'
'changed when using this option.',
));
}

Expand All @@ -1350,7 +1350,7 @@ module.exports = function(User) {

const err = new Error(
'Changing user password via patch/replace API is not allowed. ' +
'Use changePassword() or setPassword() instead.'
'Use changePassword() or setPassword() instead.',
);
err.statusCode = 401;
err.code = 'PASSWORD_CHANGE_NOT_ALLOWED';
Expand Down
18 changes: 9 additions & 9 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ app.enableAuth = function(options) {
const Model = app.registry.findModel(m);
if (!Model) {
throw new Error(
g.f('Authentication requires model %s to be defined.', m)
g.f('Authentication requires model %s to be defined.', m),
);
}

Expand Down Expand Up @@ -435,7 +435,7 @@ app.enableAuth = function(options) {
e.code = messages[errStatusCode].code || messages[403].code;
next(e);
}
}
},
);
} else {
next();
Expand Down Expand Up @@ -486,7 +486,7 @@ app._verifyAuthModelRelations = function() {
'custom User subclass, but does not fix AccessToken relations ' +
'to use this new model.\n' +
'Learn more at http://ibm.biz/setup-loopback-auth',
Model.modelName, userName, userName
Model.modelName, userName, userName,
);
return;
}
Expand All @@ -495,7 +495,7 @@ app._verifyAuthModelRelations = function() {
'The model %j does not have "belongsTo User-like model" relation ' +
'configured.\n' +
'Learn more at http://ibm.biz/setup-loopback-auth',
Model.modelName
Model.modelName,
);
}

Expand All @@ -509,7 +509,7 @@ app._verifyAuthModelRelations = function() {
'The app configuration follows the multiple user models setup ' +
'as described in http://ibm.biz/setup-loopback-auth',
'The built-in role resolver $owner is not currently compatible ' +
'with this configuration and should not be used in production.'
'with this configuration and should not be used in production.',
);
}
return;
Expand All @@ -526,7 +526,7 @@ app._verifyAuthModelRelations = function() {
'AccessToken subclass, but does not fix User relations to use this ' +
'new model.\n' +
'Learn more at http://ibm.biz/setup-loopback-auth',
Model.modelName, accessTokenName, accessTokenName
Model.modelName, accessTokenName, accessTokenName,
);
return;
}
Expand All @@ -535,14 +535,14 @@ app._verifyAuthModelRelations = function() {
'The model %j does not have "hasMany AccessToken-like models" relation ' +
'configured.\n' +
'Learn more at http://ibm.biz/setup-loopback-auth',
Model.modelName
Model.modelName,
);
}
};

app.boot = function(options) {
throw new Error(
g.f('{{`app.boot`}} was removed, use the new module {{loopback-boot}} instead')
g.f('{{`app.boot`}} was removed, use the new module {{loopback-boot}} instead'),
);
};

Expand Down Expand Up @@ -584,7 +584,7 @@ function configureModel(ModelCtor, config, app) {
assert(
dataSource instanceof DataSource,
ModelCtor.modelName + ' is referencing a dataSource that does not exist: "' +
config.dataSource + '"'
config.dataSource + '"',
);
}

Expand Down
22 changes: 11 additions & 11 deletions lib/builtin-models.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,57 @@ module.exports = function(registry) {

registry.KeyValueModel = createModel(
require('../common/models/key-value-model.json'),
require('../common/models/key-value-model.js')
require('../common/models/key-value-model.js'),
);

registry.Email = createModel(
require('../common/models/email.json'),
require('../common/models/email.js')
require('../common/models/email.js'),
);

registry.Application = createModel(
require('../common/models/application.json'),
require('../common/models/application.js')
require('../common/models/application.js'),
);

registry.AccessToken = createModel(
require('../common/models/access-token.json'),
require('../common/models/access-token.js')
require('../common/models/access-token.js'),
);

registry.User = createModel(
require('../common/models/user.json'),
require('../common/models/user.js')
require('../common/models/user.js'),
);

registry.RoleMapping = createModel(
require('../common/models/role-mapping.json'),
require('../common/models/role-mapping.js')
require('../common/models/role-mapping.js'),
);

registry.Role = createModel(
require('../common/models/role.json'),
require('../common/models/role.js')
require('../common/models/role.js'),
);

registry.ACL = createModel(
require('../common/models/acl.json'),
require('../common/models/acl.js')
require('../common/models/acl.js'),
);

registry.Scope = createModel(
require('../common/models/scope.json'),
require('../common/models/scope.js')
require('../common/models/scope.js'),
);

registry.Change = createModel(
require('../common/models/change.json'),
require('../common/models/change.js')
require('../common/models/change.js'),
);

registry.Checkpoint = createModel(
require('../common/models/checkpoint.json'),
require('../common/models/checkpoint.js')
require('../common/models/checkpoint.js'),
);

function createModel(definitionJson, customizeFn) {
Expand Down
6 changes: 3 additions & 3 deletions lib/current-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ module.exports = function(loopback) {
throw new Error(g.f(
'%s was removed in version 3.0. See %s for more details.',
'loopback.getCurrentContext()',
'http://loopback.io/doc/en/lb2/Using-current-context.html'
'http://loopback.io/doc/en/lb2/Using-current-context.html',
));
};

loopback.runInContext = function(fn) {
throw new Error(g.f(
'%s was removed in version 3.0. See %s for more details.',
'loopback.runInContext()',
'http://loopback.io/doc/en/lb2/Using-current-context.html'
'http://loopback.io/doc/en/lb2/Using-current-context.html',
));
};

loopback.createContext = function(scopeName) {
throw new Error(g.f(
'%s was removed in version 3.0. See %s for more details.',
'loopback.createContext()',
'http://loopback.io/doc/en/lb2/Using-current-context.html'
'http://loopback.io/doc/en/lb2/Using-current-context.html',
));
};
};
Loading

0 comments on commit b848bd9

Please sign in to comment.