Merge pull request #157 from strongloop/fix-eslint

Fix eslint violations
This commit is contained in:
Miroslav Bajtoš 2019-11-01 16:29:58 +01:00 committed by GitHub
commit 12de266e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 18 deletions

View File

@ -138,7 +138,7 @@ Connector.prototype.getPropertyDefinition = function(modelName, propName) {
const model = this.getModelDefinition(modelName);
return Connector.getNestedPropertyDefinition(
model.model.definition,
propName.split('.')
propName.split('.'),
);
};
@ -170,7 +170,7 @@ Connector.getNestedPropertyDefinition = function(definition, propPath) {
} else {
return Connector.getNestedPropertyDefinition(
nextDefinition,
propPath.slice(1)
propPath.slice(1),
);
}
};

View File

@ -66,7 +66,7 @@ exports.parse = function(composed, cb) {
debug('Invalid key - missing model-name prefix: %s', composed);
const err = new Error(g.f(
'Invalid key %j - missing model-name prefix',
composed
composed,
));
err.code = 'NO_MODEL_PREFIX';
setImmediate(function() {

View File

@ -729,7 +729,7 @@ SQLConnector.prototype.exists = function(model, id, options, cb) {
where[idName] = id;
let selectStmt = new ParameterizedSQL(
'SELECT 1 FROM ' + this.tableEscaped(model) +
' WHERE ' + this.idColumnEscaped(model)
' WHERE ' + this.idColumnEscaped(model),
);
selectStmt.merge(this.buildWhere(model, where));
selectStmt = this.applyPagination(model, selectStmt, {
@ -834,7 +834,7 @@ SQLConnector.prototype.updateAttributes = function(model, id, data, options, cb)
function errorIdNotFoundForUpdate(idValue) {
const msg = g.f(
'Could not update attributes. {{Object}} with {{id}} %s does not exist!', idValue
'Could not update attributes. {{Object}} with {{id}} %s does not exist!', idValue,
);
const error = new Error(msg);
error.statusCode = error.status = 404;
@ -1408,7 +1408,7 @@ SQLConnector.prototype.buildSelect = function(model, filter, options) {
if (filter.limit || filter.skip || filter.offset) {
selectStmt = this.applyPagination(
model, selectStmt, filter
model, selectStmt, filter,
);
}
}
@ -1467,7 +1467,7 @@ SQLConnector.prototype.all = function find(model, filter, options, cb) {
});
if (filter && filter.include) {
self.getModelDefinition(model).model.include(
objs, filter.include, options, cb
objs, filter.include, options, cb,
);
} else {
cb(null, objs);

View File

@ -47,14 +47,14 @@ describe('Connector', () => {
it('supports retrieving first level properties definitions', () => {
const propDefinition1 = connector.getPropertyDefinition(
'MyModel',
'phoneList'
'phoneList',
);
expect(propDefinition1.type).to.be.an('array');
const propDefinition2 = connector.getPropertyDefinition(
'MyModel',
'firstname'
'firstname',
);
expect(propDefinition2.type).to.be.equal(String);
@ -63,7 +63,7 @@ describe('Connector', () => {
it('supports first level nested array property definitions', () => {
const propDefinition = connector.getPropertyDefinition(
'MyModel',
'phoneList.number'
'phoneList.number',
);
expect(propDefinition.type).to.equal(Number);
@ -72,7 +72,7 @@ describe('Connector', () => {
it('supports second level nested array property definitions', () => {
const propDefinition = connector.getPropertyDefinition(
'MyModel',
'phoneList.label.title'
'phoneList.label.title',
);
expect(propDefinition.type).to.equal(String);
@ -81,7 +81,7 @@ describe('Connector', () => {
it('supports nested property definitions on objects', () => {
const propDefinition = connector.getPropertyDefinition(
'MyModel',
'address.line1'
'address.line1',
);
expect(propDefinition.type).to.equal(String);
@ -90,7 +90,7 @@ describe('Connector', () => {
it('supports nested property definitions on array within object', () => {
const propDefinition = connector.getPropertyDefinition(
'MyModel',
'someProp.innerArray.date'
'someProp.innerArray.date',
);
expect(propDefinition.type).to.equal(Date);

View File

@ -66,7 +66,7 @@ describe('ModelKeyComposer', function() {
},
function onError(err) {
expect(err).to.have.property('code', 'NO_MODEL_PREFIX');
}
},
);
});

View File

@ -275,10 +275,10 @@ describe('sql connector', function() {
{name: 'John', vip: true, unknown: 'Random'});
expect(fields.names).to.eql(['`NAME`', '`VIP`']);
expect(fields.columnValues[0].toJSON()).to.eql(
{sql: '?', params: ['John']}
{sql: '?', params: ['John']},
);
expect(fields.columnValues[1].toJSON()).to.eql(
{sql: '?', params: [true]}
{sql: '?', params: [true]},
);
});
@ -394,7 +394,7 @@ describe('sql connector', function() {
const where = {sql: 'WHERE `NAME`=?', params: ['John']};
stmt1 = ParameterizedSQL.append(stmt1, where);
expect(stmt1.toJSON()).to.eql(
{sql: 'SELECT * from `CUSTOMER` WHERE `NAME`=?', params: ['John']}
{sql: 'SELECT * from `CUSTOMER` WHERE `NAME`=?', params: ['John']},
);
});
@ -403,7 +403,7 @@ describe('sql connector', function() {
const where = {sql: 'WHERE `NAME`=?', params: ['John']};
stmt1 = ParameterizedSQL.append(stmt1, where);
expect(stmt1.toJSON()).to.eql(
{sql: 'SELECT * from `CUSTOMER` WHERE `NAME`=?', params: ['John']}
{sql: 'SELECT * from `CUSTOMER` WHERE `NAME`=?', params: ['John']},
);
});