upgrade eslint deps

This commit is contained in:
biniam 2017-07-24 12:48:26 -04:00
parent 5eedce280e
commit 7a7a34e77f
14 changed files with 219 additions and 212 deletions

View File

@ -67,7 +67,8 @@ function mixinMigration(MySQL, mysql) {
self.getTableStatus(model, function(err, fields, indexes) { self.getTableStatus(model, function(err, fields, indexes) {
self.discoverForeignKeys(self.table(model), {}, function(err, foreignKeys) { self.discoverForeignKeys(self.table(model), {}, function(err, foreignKeys) {
if (err) console.log('Failed to discover "' + table + '" foreign keys', err); if (err) console.log('Failed to discover "' + self.table(model) +
'" foreign keys', err);
if (!err && fields && fields.length) { if (!err && fields && fields.length) {
// if we already have a definition, update this table // if we already have a definition, update this table
@ -144,7 +145,8 @@ function mixinMigration(MySQL, mysql) {
async.eachSeries(models, function(model, done) { async.eachSeries(models, function(model, done) {
self.getTableStatus(model, function(err, fields, indexes) { self.getTableStatus(model, function(err, fields, indexes) {
self.discoverForeignKeys(self.table(model), {}, function(err, foreignKeys) { self.discoverForeignKeys(self.table(model), {}, function(err, foreignKeys) {
if (err) console.log('Failed to discover "' + table + '" foreign keys', err); if (err) console.log('Failed to discover "' + self.table(model) +
'" foreign keys', err);
self.alterTable(model, fields, indexes, foreignKeys, function(err, needAlter) { self.alterTable(model, fields, indexes, foreignKeys, function(err, needAlter) {
if (err) { if (err) {

View File

@ -22,8 +22,8 @@
}, },
"devDependencies": { "devDependencies": {
"bluebird": "~2.9.10", "bluebird": "~2.9.10",
"eslint": "^2.13.1", "eslint": "^4.3.0",
"eslint-config-loopback": "^4.0.0", "eslint-config-loopback": "^8.0.0",
"loopback-datasource-juggler": "^3.0.0", "loopback-datasource-juggler": "^3.0.0",
"mocha": "^2.1.0", "mocha": "^2.1.0",
"rc": "^1.0.0", "rc": "^1.0.0",

View File

@ -19,7 +19,8 @@ describe('connections', function() {
config = global.getConfig(); config = global.getConfig();
odb = getDataSource({collation: 'utf8_general_ci', createDatabase: true}); odb = global.getDataSource({collation: 'utf8_general_ci',
createDatabase: true});
db = odb; db = odb;
}); });
@ -53,7 +54,7 @@ describe('connections', function() {
it('should disconnect first db', function(done) { it('should disconnect first db', function(done) {
db.disconnect(function() { db.disconnect(function() {
odb = getDataSource(); odb = global.getDataSource();
done(); done();
}); });
}); });
@ -112,7 +113,8 @@ function charsetTest(test_set, test_collo, test_set_str, test_set_collo, done) {
query('DROP DATABASE IF EXISTS ' + odb.settings.database, function(err) { query('DROP DATABASE IF EXISTS ' + odb.settings.database, function(err) {
assert.ok(!err); assert.ok(!err);
odb.disconnect(function() { odb.disconnect(function() {
db = getDataSource({collation: test_set_collo, createDatabase: true}); db = global.getDataSource({collation: test_set_collo,
createDatabase: true});
DummyModel = db.define('DummyModel', {string: String}); DummyModel = db.define('DummyModel', {string: String});
db.automigrate(function() { db.automigrate(function() {
var q = 'SELECT DEFAULT_COLLATION_NAME' + var q = 'SELECT DEFAULT_COLLATION_NAME' +

View File

@ -33,7 +33,7 @@ describe('MySQL specific datatypes', function() {
]; ];
before(function(done) { before(function(done) {
require('./init.js'); require('./init.js');
db = getSchema(); db = global.getSchema();
Account = db.define('Account', { Account = db.define('Account', {
type: {type: String}, type: {type: String},
amount: { amount: {
@ -233,7 +233,7 @@ describe('MySQL specific datatypes', function() {
function setup(done) { function setup(done) {
require('./init.js'); require('./init.js');
db = getSchema(); db = global.getSchema();
ANIMAL_ENUM = db.EnumFactory('dog', 'cat', 'mouse'); ANIMAL_ENUM = db.EnumFactory('dog', 'cat', 'mouse');

View File

@ -28,7 +28,7 @@ describe('MySQL datetime handling', function() {
}); });
} }
before(function(done) { before(function(done) {
db = getSchema({ db = global.getSchema({
dateStrings: true, dateStrings: true,
}); });
Person = db.define('Person', personDefinition, {forceId: true, strict: true}); Person = db.define('Person', personDefinition, {forceId: true, strict: true});

View File

@ -30,7 +30,7 @@ global.getConfig = function(options) {
}; };
global.getDataSource = global.getSchema = function(options) { global.getDataSource = global.getSchema = function(options) {
var db = new DataSource(require('../'), getConfig(options)); var db = new DataSource(require('../'), global.getConfig(options));
return db; return db;
}; };

View File

@ -468,7 +468,7 @@ describe('migrations', function() {
function setup(done) { function setup(done) {
require('./init.js'); require('./init.js');
db = getSchema(); db = global.getSchema();
UserData = db.define('UserData', { UserData = db.define('UserData', {
email: {type: String, null: false, index: true}, email: {type: String, null: false, index: true},

View File

@ -9,7 +9,7 @@ require('./init');
var ds; var ds;
before(function() { before(function() {
ds = getDataSource(); ds = global.getDataSource();
}); });
describe('MySQL connector', function() { describe('MySQL connector', function() {

View File

@ -5,7 +5,7 @@
'use strict'; 'use strict';
process.env.NODE_ENV = 'test'; process.env.NODE_ENV = 'test';
require('should'); var should = require('should');
var assert = require('assert'); var assert = require('assert');
var DataSource = require('loopback-datasource-juggler').DataSource; var DataSource = require('loopback-datasource-juggler').DataSource;
@ -13,7 +13,7 @@ var db, config;
before(function(done) { before(function(done) {
require('./init'); require('./init');
config = getConfig(); config = global.getConfig();
config.database = 'STRONGLOOP'; config.database = 'STRONGLOOP';
db = new DataSource(require('../'), config); db = new DataSource(require('../'), config);
db.once('connected', done); db.once('connected', done);
@ -43,7 +43,7 @@ describe('discoverModels', function() {
done(err); done(err);
} else { } else {
var views = false; var views = false;
should.assert(models.length > 0, 'some models returned'); assert(models.length > 0, 'some models returned');
models.forEach(function(m) { models.forEach(function(m) {
if (m.type === 'view') { if (m.type === 'view') {
views = true; views = true;
@ -67,7 +67,7 @@ describe('discoverModels', function() {
done(err); done(err);
} else { } else {
var views = false; var views = false;
should.assert(models.length > 0, 'some models returned'); assert(models.length > 0, 'some models returned');
models.forEach(function(m) { models.forEach(function(m) {
assert.equal(m.schema.toLowerCase(), config.database.toLowerCase()); assert.equal(m.schema.toLowerCase(), config.database.toLowerCase());
}); });
@ -88,9 +88,9 @@ describe('discoverModels', function() {
console.error(err); console.error(err);
done(err); done(err);
} else { } else {
should.assert(models.length > 0, 'some models returned'); assert(models.length > 0, 'some models returned');
models.forEach(function(m) { models.forEach(function(m) {
should.not.equal(m.type, 'view', 'model type should not be a view'); should.notEqual(m.type, 'view', 'model type should not be a view');
}); });
done(null, models); done(null, models);
} }

View File

@ -5,6 +5,7 @@
'use strict'; 'use strict';
var should = require('./init.js'); var should = require('./init.js');
var sinon = require('sinon');
var Post, PostWithStringId, PostWithUniqueTitle, PostWithNumId, db; var Post, PostWithStringId, PostWithUniqueTitle, PostWithNumId, db;
@ -23,7 +24,7 @@ ObjectID.prototype.toJSON = function() {
describe('mysql', function() { describe('mysql', function() {
before(function(done) { before(function(done) {
db = getDataSource(); db = global.getDataSource();
Post = db.define('PostWithDefaultId', { Post = db.define('PostWithDefaultId', {
title: {type: String, length: 255, index: true}, title: {type: String, length: 255, index: true},
@ -257,7 +258,8 @@ describe('mysql', function() {
}); });
}); });
it('save should update the instance without removing existing properties', function(done) { it('save should update the instance without removing existing properties',
function(done) {
Post.create({title: 'a', content: 'AAA'}, function(err, post) { Post.create({title: 'a', content: 'AAA'}, function(err, post) {
delete post.title; delete post.title;
post.save(function(err, p) { post.save(function(err, p) {
@ -270,7 +272,6 @@ describe('mysql', function() {
p.content.should.be.equal(post.content); p.content.should.be.equal(post.content);
p.title.should.be.equal('a'); p.title.should.be.equal('a');
done(); done();
}); });
}); });

View File

@ -15,7 +15,8 @@ var db, Post, Review;
describe('transactions with promise', function() { describe('transactions with promise', function() {
before(function(done) { before(function(done) {
db = getDataSource({collation: 'utf8_general_ci', createDatabase: true}); db = global.getDataSource({collation: 'utf8_general_ci',
createDatabase: true});
db.once('connected', function() { db.once('connected', function() {
Post = db.define('PostTX', { Post = db.define('PostTX', {
title: {type: String, length: 255, index: true}, title: {type: String, length: 255, index: true},

View File

@ -12,7 +12,8 @@ var db, Post, Review;
describe('transactions', function() { describe('transactions', function() {
before(function(done) { before(function(done) {
db = getDataSource({collation: 'utf8_general_ci', createDatabase: true}); db = global.getDataSource({collation: 'utf8_general_ci',
createDatabase: true});
db.once('connected', function() { db.once('connected', function() {
Post = db.define('PostTX', { Post = db.define('PostTX', {
title: {type: String, length: 255, index: true}, title: {type: String, length: 255, index: true},