Skip to content

Commit be7e95c

Browse files
committed
Manually fix remaining linting violations
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
1 parent 97b3343 commit be7e95c

14 files changed

+36
-36
lines changed

lib/migration.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function mixinMigration(PostgreSQL) {
8383
return !!m.settings.indexes[name];
8484
}) : [];
8585

86-
var applyPending = function(actions, cb, err, result) {
86+
const applyPending = function(actions, cb, err, result) {
8787
const action = actions.shift();
8888
const pendingChanges = action && action() || [];
8989
if (pendingChanges.length) {
@@ -566,7 +566,7 @@ function mixinMigration(PostgreSQL) {
566566

567567
if (actualFks) {
568568
const keys = Object.keys(actualFks);
569-
for (var i = 0; i < keys.length; i++) {
569+
for (let i = 0; i < keys.length; i++) {
570570
// all existing fks are already checked in PostgreSQL.prototype.dropForeignKeys
571571
// so we need check only names - skip if found
572572
if (existingFks.filter(function(fk) {
@@ -783,7 +783,8 @@ function mixinMigration(PostgreSQL) {
783783
if (identical && siKeys.length > 1) {
784784
if (siKeys.length !== i.keys.length) {
785785
// lengths differ, obviously non-matching
786-
orderMatched = false;
786+
// ??? orderMatched is not defined and not used anywhere else
787+
// orderMatched = false;
787788
} else {
788789
siKeys.forEach(function(propName, iter) {
789790
identical = identical && self.column(model, propName) === i.keys[iter];

lib/postgresql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ PostgreSQL.prototype.buildExpression = function(columnName, operator,
435435
if (operatorValue.multiline)
436436
g.warn('{{PostgreSQL}} regex syntax does not respect the {{`m`}} flag');
437437

438-
var regexOperator = operatorValue.ignoreCase ? ' ~* ?' : ' ~ ?';
438+
const regexOperator = operatorValue.ignoreCase ? ' ~* ?' : ' ~ ?';
439439
return new ParameterizedSQL(columnName + regexOperator,
440440
[operatorValue.source]);
441441
default:

test/init.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ global.getDataSource = global.getSchema = function(useUrl) {
4848
// Return cached data source if possible to avoid too many client error
4949
// due to multiple instances of connection pools
5050
if (!useUrl && db) return db;
51-
const settings = getDBConfig(useUrl);
51+
const settings = global.getDBConfig(useUrl);
5252
db = new DataSource(require('../'), settings);
5353
db.log = function(a) {
5454
// console.log(a);
@@ -70,5 +70,3 @@ global.connectorCapabilities = {
7070
// see https://github.com/strongloop/loopback-connector-postgresql/issues/342
7171
supportsArrays: false,
7272
};
73-
74-
global.sinon = require('sinon');

test/postgresql.autocreateschema.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let Another, Post, db;
1010

1111
describe('Autocreate schema if not exists', function() {
1212
before(function() {
13-
db = getDataSource();
13+
db = global.getDataSource();
1414

1515
Post = db.define('PostInCustomSchema', {
1616
created: {

test/postgresql.autoupdate.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const _ = require('lodash');
99
let ds, properties, SimpleEmployee, Emp1, Emp2;
1010

1111
before(function() {
12-
ds = getDataSource();
12+
ds = global.getDataSource();
1313
});
1414

1515
describe('autoupdate', function() {

test/postgresql.dbdefaults.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let InvalidDefault, Post, db;
1010

1111
describe('database default field values', function() {
1212
before(function() {
13-
db = getDataSource();
13+
db = global.getDataSource();
1414

1515
Post = db.define('PostWithDbDefaultValue', {
1616
created: {

test/postgresql.discover.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const DataSource = require('loopback-datasource-juggler').DataSource;
1414
let db, City;
1515

1616
before(function() {
17-
const config = getDBConfig();
17+
const config = global.getDBConfig();
1818
config.database = 'strongloop';
1919
db = new DataSource(require('../'), config);
2020
});

test/postgresql.filterUndefined.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let Post, db;
1010

1111
describe('filter undefined fields', function() {
1212
before(function() {
13-
db = getDataSource();
13+
db = global.getDataSource();
1414

1515
Post = db.define('FilterUndefined', {
1616
defaultInt: {

test/postgresql.initialization.test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,32 @@ const should = require('should');
1212

1313
// simple wrapper that uses JSON.parse(JSON.stringify()) as cheap clone
1414
function newConfig(withURL) {
15-
return JSON.parse(JSON.stringify(getDBConfig(withURL)));
15+
return JSON.parse(JSON.stringify(global.getDBConfig(withURL)));
1616
}
1717

1818
describe('initialization', function() {
1919
it('honours user-defined pg-pool settings', function() {
20-
var dataSource = new DataSource(connector, newConfig());
21-
var pool = dataSource.connector.pg;
20+
let dataSource = new DataSource(connector, newConfig());
21+
let pool = dataSource.connector.pg;
2222
pool.options.max.should.not.equal(999);
2323

2424
const settings = newConfig();
2525
settings.max = 999; // non-default value
26-
var dataSource = new DataSource(connector, settings);
27-
var pool = dataSource.connector.pg;
26+
dataSource = new DataSource(connector, settings);
27+
pool = dataSource.connector.pg;
2828
pool.options.max.should.equal(999);
2929
});
3030

3131
it('honours user-defined url settings', function() {
3232
let settings = newConfig();
3333

34-
var dataSource = new DataSource(connector, settings);
35-
var clientConfig = dataSource.connector.clientConfig;
34+
let dataSource = new DataSource(connector, settings);
35+
let clientConfig = dataSource.connector.clientConfig;
3636
should.not.exist(clientConfig.connectionString);
3737

3838
settings = newConfig(true);
39-
var dataSource = new DataSource(connector, settings);
40-
var clientConfig = dataSource.connector.clientConfig;
39+
dataSource = new DataSource(connector, settings);
40+
clientConfig = dataSource.connector.clientConfig;
4141
clientConfig.connectionString.should.equal(settings.url);
4242
});
4343

@@ -55,7 +55,7 @@ describe('initialization', function() {
5555

5656
describe('postgresql connector errors', function() {
5757
it('Should complete these 4 queries without dying', function(done) {
58-
const dataSource = getDataSource();
58+
const dataSource = global.getDataSource();
5959
const db = dataSource.connector;
6060
const pool = db.pg;
6161
pool.options.max = 5;

test/postgresql.mapping.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const async = require('async');
1212
let db;
1313

1414
before(function() {
15-
db = getSchema();
15+
db = global.getSchema();
1616
});
1717

1818
describe('Mapping models', function() {

0 commit comments

Comments
 (0)