Upgrade eslint & config to latest

- eslint ^3.11.1
 - eslint-config-loopback: ^6.0.0
 - fix linter errors (mostly no-undef)
This commit is contained in:
Miroslav Bajtoš 2016-12-05 15:14:09 +01:00
parent 0fea9ebef0
commit 0f7a567f18
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
var modelBuilder = new ModelBuilder();
Color = modelBuilder.define('Color', {
const Color = modelBuilder.define('Color', {
name: String,
});

View File

@ -5,6 +5,7 @@
'use strict';
/* global window:false */
var g = require('strong-globalize')();
var util = require('util');
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
// to guarantee to create it in the same turn of even loop
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.setIdValue(model, data, id);
callback(err, self.fromDb(model, data), {isNewInstance: true});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,6 +5,8 @@
// This test written in mocha+should.js
'use strict';
/* global getSchema:false */
var should = require('./init.js');
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 User = modelBuilder.define('User', {name: String}, {
relations: {posts: {type: 'hasMany', model: 'Post'},
}});
}});
assert(!User.relations['posts']);
Post.attachTo(ds);

View File

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

View File

@ -5,6 +5,8 @@
// This test written in mocha+should.js
'use strict';
/* global getSchema:false */
var async = require('async');
var should = require('./init.js');
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() {});
} else {
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() {});
} else {
describe('PersistedModel.replaceOrCreate', function() {

View File

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

View File

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

View File

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

View File

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