diff --git a/lib/remote-objects.js b/lib/remote-objects.js
index 03666ddd..27dddbd6 100644
--- a/lib/remote-objects.js
+++ b/lib/remote-objects.js
@@ -574,7 +574,8 @@ function searchListenerTree(handlers, type, tree, i) {
for (branch in tree) {
if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
listeners = listeners.concat(
- searchListenerTree(handlers, type, tree[branch], i + 1));
+ searchListenerTree(handlers, type, tree[branch], i + 1)
+ );
}
}
return listeners;
@@ -583,7 +584,8 @@ function searchListenerTree(handlers, type, tree, i) {
if (endReached && tree._listeners) {
// The next element has a _listeners, add it to the handlers.
listeners = listeners.concat(
- searchListenerTree(handlers, type, tree, typeLength));
+ searchListenerTree(handlers, type, tree, typeLength)
+ );
}
for (branch in tree) {
@@ -591,17 +593,21 @@ function searchListenerTree(handlers, type, tree, i) {
if (branch === '*' || branch === '**') {
if (tree[branch]._listeners && !endReached) {
listeners = listeners.concat(
- searchListenerTree(handlers, type, tree[branch], typeLength));
+ searchListenerTree(handlers, type, tree[branch], typeLength)
+ );
}
listeners = listeners.concat(
- searchListenerTree(handlers, type, tree[branch], i));
+ searchListenerTree(handlers, type, tree[branch], i)
+ );
} else if (branch === nextType) {
listeners = listeners.concat(
- searchListenerTree(handlers, type, tree[branch], i + 2));
+ searchListenerTree(handlers, type, tree[branch], i + 2)
+ );
} else {
// No match on this one, shift into the tree but not in the type array.
listeners = listeners.concat(
- searchListenerTree(handlers, type, tree[branch], i));
+ searchListenerTree(handlers, type, tree[branch], i)
+ );
}
}
}
@@ -609,7 +615,8 @@ function searchListenerTree(handlers, type, tree, i) {
}
listeners = listeners.concat(
- searchListenerTree(handlers, type, tree[currentType], i + 1));
+ searchListenerTree(handlers, type, tree[currentType], i + 1)
+ );
}
xTree = tree['*'];
@@ -805,7 +812,8 @@ RemoteObjects.prototype.defineType = function(name, converter) {
'%s is no longer supported. Use one of the new APIs instead: %s or %s',
'remoteObjects.defineType(name, fn)',
'remoteObjects.defineObjectType(name, factoryFn)',
- 'remoteObjects.defineType(name, converter)'));
+ 'remoteObjects.defineType(name, converter)'
+ ));
}
this._typeRegistry.defineType(name, converter);
};
@@ -849,11 +857,13 @@ RemoteObjects.convert =
RemoteObjects.prototype.convert = function(name, fn) {
throw new Error(g.f(
'RemoteObjects.convert(name, fn) is no longer supported. ' +
- 'Use remoteObjects.defineType(name, converter) instead.'));
+ 'Use remoteObjects.defineType(name, converter) instead.'
+ ));
};
RemoteObjects.defineType = function(name, fn) {
throw new Error(g.f(
'RemoteObjects.defineType(name, fn) is no longer supported. ' +
- 'Use remoteObjects.defineType(name, converter) instead.'));
+ 'Use remoteObjects.defineType(name, converter) instead.'
+ ));
};
diff --git a/lib/rest-adapter.js b/lib/rest-adapter.js
index e9d4d3ac..703adbc5 100644
--- a/lib/rest-adapter.js
+++ b/lib/rest-adapter.js
@@ -434,7 +434,8 @@ RestAdapter.errorHandler = function(options) {
g.warn(
'{{strong-remoting}} no longer supports ' +
'"{{errorHandler.disableStackTrace}}" option. ' +
- 'Use the new option "{{errorHandler.debug}}" instead.');
+ 'Use the new option "{{errorHandler.debug}}" instead.'
+ );
}
var strongErrorHandlerInstance = strongErrorHandler(options);
diff --git a/lib/shared-method.js b/lib/shared-method.js
index 3d411404..72079054 100644
--- a/lib/shared-method.js
+++ b/lib/shared-method.js
@@ -544,7 +544,8 @@ SharedMethod.toResult = function(returns, raw, ctx) {
message = g.f(
'Invalid return value for argument \'%s\' of type ' +
'\'%s\': %s. Received type was %s.',
- argName, targetType, val, typeof val);
+ argName, targetType, val, typeof val
+ );
throw internalServerError(message);
}
@@ -552,7 +553,8 @@ SharedMethod.toResult = function(returns, raw, ctx) {
message = g.f(
'Unsafe integer value returned for argument \'%s\' of type ' +
'\'%s\': %s.',
- argName, targetType, val);
+ argName, targetType, val
+ );
throw internalServerError(message);
}
return val;
diff --git a/package.json b/package.json
index 07a99c4d..cae00a74 100644
--- a/package.json
+++ b/package.json
@@ -44,8 +44,8 @@
"chai": "^4.1.2",
"coveralls": "^3.0.1",
"dirty-chai": "^2.0.1",
- "eslint": "^4.13.1",
- "eslint-config-loopback": "^10.0.0",
+ "eslint": "^5.4.0",
+ "eslint-config-loopback": "^11.0.0",
"eslint-plugin-mocha": "^5.0.0",
"event-stream": "^3.3.1",
"eventsource": "^1.0.5",
diff --git a/test/authorize-hook.test.js b/test/authorize-hook.test.js
index bdede536..5b034d6f 100644
--- a/test/authorize-hook.test.js
+++ b/test/authorize-hook.test.js
@@ -46,8 +46,7 @@ describe('authorization hook', function() {
// vvvvvvvv - local before hook
expect(callStack).to.eql(['before', 'authorization', 'before']);
done();
- }
- );
+ });
});
});
diff --git a/test/rest.browser.test.js b/test/rest.browser.test.js
index 33e6b4e0..5d2bbb62 100644
--- a/test/rest.browser.test.js
+++ b/test/rest.browser.test.js
@@ -276,8 +276,7 @@ describe('strong-remoting-rest', function() {
assert.equal(b, false);
done();
});
- }
- );
+ });
it('should reject empty string when string required',
function(done) {
@@ -300,8 +299,7 @@ describe('strong-remoting-rest', function() {
expect(err).to.be.an.instanceof(Error);
done();
});
- }
- );
+ });
it('should reject falsy required arguments of incorrect type', function(done) {
var method = givenSharedStaticMethod(
diff --git a/test/rest.test.js b/test/rest.test.js
index 041a04f0..218275d3 100644
--- a/test/rest.test.js
+++ b/test/rest.test.js
@@ -148,7 +148,8 @@ describe('strong-remoting-rest', function() {
it('should exclude stack traces by default', function(done) {
var method = givenSharedStaticMethod(
- function(cb) { cb(new Error('test-error')); });
+ function(cb) { cb(new Error('test-error')); }
+ );
// reset the errorHandler options
objects.options.errorHandler = {};
@@ -157,7 +158,8 @@ describe('strong-remoting-rest', function() {
.expect('Content-Type', /json/)
.expect(500)
.end(expectErrorResponseContaining(
- {message: 'Internal Server Error'}, ['stack'], done));
+ {message: 'Internal Server Error'}, ['stack'], done
+ ));
});
it('should turn off url-not-found handler', function(done) {
@@ -261,7 +263,8 @@ describe('strong-remoting-rest', function() {
{
accepts: {arg: 'value', type: 'string'},
returns: {arg: 'result', type: 'object'},
- });
+ }
+ );
request(app).post(method.url)
.set('Accept', ACCEPT_XML_OR_ANY)
@@ -754,7 +757,8 @@ describe('strong-remoting-rest', function() {
},
},
],
- });
+ }
+ );
request(app).get(method.url)
.set('Accept', 'application/json')
@@ -946,7 +950,8 @@ describe('strong-remoting-rest', function() {
accepts: {arg: 'arg', type: ['integer']},
returns: {arg: 'data', type: ['integer'], root: true},
http: {method: 'POST'},
- });
+ }
+ );
request(app).post(method.url)
.send({arg: [1, 2]})
@@ -963,7 +968,8 @@ describe('strong-remoting-rest', function() {
accepts: {arg: 'arg', type: ['number']},
returns: {arg: 'data', type: ['integer']},
http: {method: 'POST'},
- });
+ }
+ );
request(app).post(method.url)
.send({arg: [1, 2]})
@@ -1024,7 +1030,8 @@ describe('strong-remoting-rest', function() {
accepts: {arg: 'arg', type: 'any'},
returns: {arg: 'data', type: 'any', root: true},
http: {method: 'POST'},
- });
+ }
+ );
request(app).post(method.url)
.send({arg: ['single']})
@@ -1039,7 +1046,8 @@ describe('strong-remoting-rest', function() {
accepts: {arg: 'arg', type: ['any']},
returns: {arg: 'data', type: ['any'], root: true},
http: {method: 'POST'},
- });
+ }
+ );
request(app).post(method.url)
.send({arg: ['single']})
@@ -1054,7 +1062,8 @@ describe('strong-remoting-rest', function() {
accepts: {arg: 'arg', type: 'array'},
returns: {arg: 'data', type: 'array', root: true},
http: {method: 'POST'},
- });
+ }
+ );
request(app).post(method.url)
.send({arg: ['single']})
@@ -1069,7 +1078,8 @@ describe('strong-remoting-rest', function() {
accepts: {arg: 'arg', type: 'array'},
returns: {arg: 'data', type: 'array', root: true},
http: {method: 'POST'},
- });
+ }
+ );
request(app).post(method.url)
.send({arg: [1]})
@@ -1084,7 +1094,8 @@ describe('strong-remoting-rest', function() {
accepts: {arg: 'arg', type: 'array'},
returns: {arg: 'data', type: 'array', root: true},
http: {method: 'POST'},
- });
+ }
+ );
request(app).post(method.url)
.send({arg: [{foo: 'bar'}]})
@@ -1123,7 +1134,8 @@ describe('strong-remoting-rest', function() {
{
accepts: {arg: 'a', type: ['number']},
returns: {arg: 'data', type: 'object'},
- });
+ }
+ );
json('post', method.url + '?a=1,2|3')
.expect({data: [1, 2, 3]}, done);
@@ -1136,7 +1148,8 @@ describe('strong-remoting-rest', function() {
{
accepts: {arg: 'a', type: ['number']},
returns: {arg: 'data', type: 'object'},
- });
+ }
+ );
json('post', method.url + '?a=')
.expect({ /* data is undefined */ }, done);
@@ -1149,7 +1162,8 @@ describe('strong-remoting-rest', function() {
{
accepts: {arg: 'a', type: ['number']},
returns: {arg: 'data', type: 'object'},
- });
+ }
+ );
json('post', method.url + '?a=[1,2,3]')
.expect({data: [1, 2, 3]}, done);
@@ -1347,7 +1361,8 @@ describe('strong-remoting-rest', function() {
'\n ' +
'1\n ' +
'2\n' +
- '');
+ ''
+ );
done(err, res);
});
});
@@ -1375,7 +1390,8 @@ describe('strong-remoting-rest', function() {
'\n ' +
'1\n ' +
'2\n' +
- '');
+ ''
+ );
done(err, res);
});
});
@@ -1403,7 +1419,8 @@ describe('strong-remoting-rest', function() {
expect(res.text).to.equal(
'\n' +
'a quick brown fox jumps over the lazy dog' +
- '');
+ ''
+ );
done(err, res);
});
});
@@ -1430,9 +1447,10 @@ describe('strong-remoting-rest', function() {
.expect(200, function(err, res) {
expect(res.text).to.equal(
'\n' +
- '\n ' +
+ '\n ' +
'fooÁáĂΩasd><=$~!@#$%^&*()-_=+/.,;\'"[]{}?\n' +
- '');
+ ''
+ );
done();
});
});
@@ -2189,7 +2207,8 @@ describe('strong-remoting-rest', function() {
it('should send back Buffer body', function(done) {
var method = givenSharedStaticMethod(
function(cb) { cb(null, new Buffer('some-text'), 'text/plain'); },
- METHOD_SIGNATURE);
+ METHOD_SIGNATURE
+ );
request(app).get(method.url)
.expect(200)
@@ -2201,7 +2220,8 @@ describe('strong-remoting-rest', function() {
it('should send back String body', function(done) {
var method = givenSharedStaticMethod(
function(cb) { cb(null, 'some-text', 'text/plain'); },
- METHOD_SIGNATURE);
+ METHOD_SIGNATURE
+ );
request(app).get(method.url)
.expect(200)
@@ -2218,7 +2238,8 @@ describe('strong-remoting-rest', function() {
stream.push(null); // EOF
cb(null, stream, 'text/plain');
},
- METHOD_SIGNATURE);
+ METHOD_SIGNATURE
+ );
request(app).get(method.url)
.expect(200)
@@ -2230,7 +2251,8 @@ describe('strong-remoting-rest', function() {
it('should fail for unsupported value type', function(done) {
var method = givenSharedStaticMethod(
function(cb) { cb(null, [1, 2]); },
- METHOD_SIGNATURE);
+ METHOD_SIGNATURE
+ );
request(app).get(method.url)
.expect(500)
@@ -2281,7 +2303,8 @@ describe('strong-remoting-rest', function() {
{
accepts: {arg: 'arg', type: 'string'},
returns: {arg: 'arg', type: 'string'},
- });
+ }
+ );
request(app).get(method.url + '?arg=1&arg=2')
.expect(200)
@@ -2298,7 +2321,8 @@ describe('strong-remoting-rest', function() {
{
accepts: {arg: 'arg', type: 'any', http: {source: 'form'}},
returns: {arg: 'arg', type: 'any'},
- });
+ }
+ );
request(app).post(method.url)
.set('Content-Type', 'application/json;charset=UTF-8')
@@ -2315,7 +2339,8 @@ describe('strong-remoting-rest', function() {
it('rejects multi-item array passed to a number argument', function(done) {
var method = givenSharedStaticMethod(
function(arg, cb) { cb(); },
- {accepts: {arg: 'arg', type: 'number'}});
+ {accepts: {arg: 'arg', type: 'number'}}
+ );
request(app).get(method.url + '?arg=1&arg=2')
.expect(400)
@@ -2326,7 +2351,8 @@ describe('strong-remoting-rest', function() {
function(done) {
var method = givenSharedStaticMethod(
function(arg, cb) { cb(); },
- {accepts: {arg: 'arg', type: 'integer'}});
+ {accepts: {arg: 'arg', type: 'integer'}}
+ );
request(app).get(method.url + '?arg=2&arg=3')
.expect(400)
@@ -2336,7 +2362,8 @@ describe('strong-remoting-rest', function() {
it('supports "Object" type string', function(done) {
var method = givenSharedStaticMethod(
function(arg, cb) { cb(); },
- {accepts: {arg: 'arg', type: 'Object'}});
+ {accepts: {arg: 'arg', type: 'Object'}}
+ );
request(app)
.get(method.url + '?arg={"x":1}')
@@ -2347,7 +2374,8 @@ describe('strong-remoting-rest', function() {
it('supports custom type string', function(done) {
var method = givenSharedStaticMethod(
function(arg, cb) { cb(); },
- {accepts: {arg: 'arg', type: 'Model'}});
+ {accepts: {arg: 'arg', type: 'Model'}}
+ );
request(app)
.get(method.url + '?arg={"x":1}')
@@ -2358,7 +2386,8 @@ describe('strong-remoting-rest', function() {
it('returns correct content-type in an empty XML response', function(done) {
var method = givenSharedStaticMethod(
function(arg, cb) { cb(); },
- {accepts: {arg: 'arg', type: 'Model'}});
+ {accepts: {arg: 'arg', type: 'Model'}}
+ );
request(app)
.get(method.url + '?arg={"x":1}&_format=xml')
@@ -2372,7 +2401,8 @@ describe('strong-remoting-rest', function() {
it('defaults content-type to application/json', function(done) {
var method = givenSharedStaticMethod(
function(arg, cb) { cb(); },
- {accepts: {arg: 'arg', type: 'Model'}});
+ {accepts: {arg: 'arg', type: 'Model'}}
+ );
request(app)
.get(method.url + '?arg={"x":1}')
@@ -2624,7 +2654,8 @@ describe('strong-remoting-rest', function() {
sharedClass,
'echoMessage',
function echoMessage(cb) { cb(); },
- {isStatic: true});
+ {isStatic: true}
+ );
let requestUrl = 'hook not triggered';
objects.before(sharedMethod.stringName, (ctx, next) => {
@@ -2646,7 +2677,8 @@ describe('strong-remoting-rest', function() {
sharedClass,
'echoMessage',
function echoMessage(cb) { cb(); },
- {isStatic: true});
+ {isStatic: true}
+ );
restHandlerOptions = {normalizeHttpPath: true};
objects.serverAdapter.options = {normalizeHttpPath: true};
@@ -2990,7 +3022,8 @@ describe('strong-remoting-rest', function() {
it('can replace the error object', function(done) {
var method = givenSharedStaticMethod(function(cb) {
cb(new Error(
- 'error from the method, should have been shadowed by the hook'));
+ 'error from the method, should have been shadowed by the hook'
+ ));
});
objects.afterError(method.name, function(ctx, next) {
next(new Error('error from the hook'));
diff --git a/test/shared-class.test.js b/test/shared-class.test.js
index f8aaf294..4f1addc9 100644
--- a/test/shared-class.test.js
+++ b/test/shared-class.test.js
@@ -186,8 +186,7 @@ describe('SharedClass', function() {
sharedClass.defineMethod(METHOD_NAME, {});
var methods = sharedClass.methods().map(getName);
expect(methods).to.contain(METHOD_NAME);
- }
- );
+ });
});
describe('sharedClass.resolve(resolver)', function() {
diff --git a/test/shared-method.test.js b/test/shared-method.test.js
index 01f539f3..efc6bc67 100644
--- a/test/shared-method.test.js
+++ b/test/shared-method.test.js
@@ -200,7 +200,8 @@ describe('SharedMethod', function() {
},
{
accepts: {arg: 'num', type: 'integer'},
- });
+ }
+ );
method.invoke('ctx', {num: 2343546576878989879789}, {}, ctx(method),
function(err) {
@@ -220,7 +221,8 @@ describe('SharedMethod', function() {
},
{
accepts: {arg: 'num', type: 'integer'},
- });
+ }
+ );
method.invoke('ctx', {num: 12.0}, {}, ctx(method), function(result) {
setImmediate(function() {
@@ -238,7 +240,8 @@ describe('SharedMethod', function() {
},
{
returns: {arg: 'value', type: 'integer'},
- });
+ }
+ );
method.invoke('ctx', {}, {}, ctx(method), function(err, result) {
setImmediate(function() {
@@ -257,7 +260,8 @@ describe('SharedMethod', function() {
},
{
returns: {arg: 'value', type: 'integer'},
- });
+ }
+ );
method.invoke('ctx', {}, {}, ctx(method), function(err, result) {
setImmediate(function() {
@@ -278,7 +282,8 @@ describe('SharedMethod', function() {
},
{
returns: {arg: 'value', type: 'date'},
- });
+ }
+ );
method.invoke('ctx', {}, {}, ctx(method), function(err, result) {
setImmediate(function() {
@@ -322,7 +327,8 @@ describe('SharedMethod', function() {
{arg: 'first', type: 'string'},
{arg: 'second', type: 'string'},
],
- });
+ }
+ );
method.invoke('ctx', {}, {}, ctx(method), function(err, result) {
setImmediate(function() {
@@ -343,7 +349,8 @@ describe('SharedMethod', function() {
returns: [
{arg: 'value', type: 'string'},
],
- });
+ }
+ );
method.invoke('ctx', {}, {}, ctx(method), function(err, result) {
setImmediate(function() {
@@ -364,7 +371,8 @@ describe('SharedMethod', function() {
returns: [
{arg: 'value', type: ['string']},
],
- });
+ }
+ );
method.invoke('ctx', {}, {}, ctx(method), function(err, result) {
setImmediate(function() {