Merge pull request #1179 from strongloop/update/eslint

Upgrade eslint & config to latest
This commit is contained in:
Miroslav Bajtoš 2016-12-06 10:12:11 +01:00 committed by GitHub
commit 80d2264bc9
19 changed files with 32 additions and 9 deletions

View File

@ -107,7 +107,7 @@ Article.create(function(e, article) {
// should be able to attach a data source to an existing model // should be able to attach a data source to an existing model
var modelBuilder = new ModelBuilder(); var modelBuilder = new ModelBuilder();
Color = modelBuilder.define('Color', { const Color = modelBuilder.define('Color', {
name: String, name: String,
}); });

View File

@ -5,6 +5,7 @@
'use strict'; 'use strict';
/* global window:false */
var g = require('strong-globalize')(); var g = require('strong-globalize')();
var util = require('util'); var util = require('util');
var Connector = require('loopback-connector').Connector; var Connector = require('loopback-connector').Connector;
@ -823,7 +824,7 @@ Memory.prototype.replaceOrCreate = function(model, data, options, callback) {
// Calling _createSync to update the collection in a sync way and // Calling _createSync to update the collection in a sync way and
// to guarantee to create it in the same turn of even loop // to guarantee to create it in the same turn of even loop
return self._createSync(model, data, function(err, id) { return self._createSync(model, data, function(err, id) {
if (err) return process.nextTick(function() { cb(err); }); if (err) return process.nextTick(function() { callback(err); });
self.saveToFile(id, function(err, id) { self.saveToFile(id, function(err, id) {
self.setIdValue(model, data, id); self.setIdValue(model, data, id);
callback(err, self.fromDb(model, data), {isNewInstance: true}); callback(err, self.fromDb(model, data), {isNewInstance: true});

View File

@ -33,8 +33,8 @@
}, },
"devDependencies": { "devDependencies": {
"async-iterators": "^0.2.2", "async-iterators": "^0.2.2",
"eslint": "^2.13.1", "eslint": "^3.11.1",
"eslint-config-loopback": "^4.0.0", "eslint-config-loopback": "^6.0.0",
"mocha": "^2.1.0", "mocha": "^2.1.0",
"should": "^8.0.2" "should": "^8.0.2"
}, },

View File

@ -6,6 +6,7 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false, connectorCapabilities:false */
var should = require('./init.js'); var should = require('./init.js');
var async = require('async'); var async = require('async');
var db, User; var db, User;

View File

@ -6,6 +6,7 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var async = require('async'); var async = require('async');
var db, User, options, filter; var db, User, options, filter;

View File

@ -6,6 +6,7 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var db, Model; var db, Model;

View File

@ -6,6 +6,7 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var async = require('async'); var async = require('async');

View File

@ -6,6 +6,7 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var db = getSchema(); var db = getSchema();

View File

@ -6,6 +6,7 @@
'use strict'; 'use strict';
// This test written in mocha+should.js // This test written in mocha+should.js
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var j = require('../'), var j = require('../'),

View File

@ -5,6 +5,7 @@
'use strict'; 'use strict';
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var async = require('async'); var async = require('async');
var assert = require('assert'); var assert = require('assert');

View File

@ -5,6 +5,8 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var Schema = require('../').Schema; var Schema = require('../').Schema;

View File

@ -1275,7 +1275,7 @@ describe('Model define with relations configuration', function() {
var Post = modelBuilder.define('Post', {userId: Number, content: String}); var Post = modelBuilder.define('Post', {userId: Number, content: String});
var User = modelBuilder.define('User', {name: String}, { var User = modelBuilder.define('User', {name: String}, {
relations: {posts: {type: 'hasMany', model: 'Post'}, relations: {posts: {type: 'hasMany', model: 'Post'},
}}); }});
assert(!User.relations['posts']); assert(!User.relations['posts']);
Post.attachTo(ds); Post.attachTo(ds);

View File

@ -5,6 +5,8 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var async = require('async'); var async = require('async');
var should = require('./init.js'); var should = require('./init.js');
@ -442,7 +444,7 @@ describe('manipulation', function() {
.catch(done); .catch(done);
}); });
it('should save throw error on validation', function() { it('should save throw error on validation', function(done) {
Person.findOne(function(err, p) { Person.findOne(function(err, p) {
if (err) return done(err); if (err) return done(err);
p.isValid = function(cb) { p.isValid = function(cb) {
@ -454,6 +456,7 @@ describe('manipulation', function() {
'throws': true, 'throws': true,
}); });
}).should.throw(ValidationError); }).should.throw(ValidationError);
done();
}); });
}); });

View File

@ -5,6 +5,8 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var async = require('async'); var async = require('async');
var should = require('./init.js'); var should = require('./init.js');
var db, User, options, ModelWithForceId, whereCount = 0; var db, User, options, ModelWithForceId, whereCount = 0;

View File

@ -1559,7 +1559,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}); });
}); });
if (!getSchema().connector.replaceById) { if (!dataSource.connector.replaceById) {
describe.skip('replaceById - not implemented', function() {}); describe.skip('replaceById - not implemented', function() {});
} else { } else {
describe('PersistedModel.prototype.replaceAttributes', function() { describe('PersistedModel.prototype.replaceAttributes', function() {
@ -2223,7 +2223,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}); });
}); });
if (!getSchema().connector.replaceById) { if (!dataSource.connector.replaceById) {
describe.skip('replaceById - not implemented', function() {}); describe.skip('replaceById - not implemented', function() {});
} else { } else {
describe('PersistedModel.replaceOrCreate', function() { describe('PersistedModel.replaceOrCreate', function() {

View File

@ -5,6 +5,8 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var assert = require('assert'); var assert = require('assert');
var jdb = require('../'); var jdb = require('../');
@ -2945,7 +2947,7 @@ describe('relations', function() {
should.not.exist(e); should.not.exist(e);
should.exist(supplier); should.exist(supplier);
supplier.account.update({supplierName: 'Supplier A', supplier.account.update({supplierName: 'Supplier A',
supplierId: sid}, supplierId: sid},
function(err, act) { function(err, act) {
should.not.exist(e); should.not.exist(e);
act.supplierName.should.equal('Supplier A'); act.supplierName.should.equal('Supplier A');

View File

@ -5,6 +5,8 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var db = getSchema(), slave = getSchema(), Model, SlaveModel; var db = getSchema(), slave = getSchema(), Model, SlaveModel;

View File

@ -5,6 +5,8 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var db, Railway, Station; var db, Railway, Station;

View File

@ -5,6 +5,8 @@
// This test written in mocha+should.js // This test written in mocha+should.js
'use strict'; 'use strict';
/* global getSchema:false */
var should = require('./init.js'); var should = require('./init.js');
var async = require('async'); var async = require('async');