Skip to content

Commit ca08404

Browse files
committed
Update eslint & config to latest
Signed-off-by: Miroslav Bajtoš <[email protected]>
1 parent 6df92e5 commit ca08404

File tree

88 files changed

+1378
-1384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1378
-1384
lines changed

Diff for: example/before-after.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
'use strict';
77

8-
var g = require('strong-globalize')();
8+
const g = require('strong-globalize')();
99
// create a set of shared classes
10-
var remotes = require('../').create();
10+
const remotes = require('../').create();
1111

1212
// expose a simple object
13-
var user = remotes.exports.user = {
13+
const user = remotes.exports.user = {
1414
greet: function(fn) {
1515
fn(null, 'hello, world!');
1616
},
@@ -62,7 +62,7 @@ remotes.before('user.*', function(ctx, next) {
6262

6363
// do something before a dog instance method
6464
remotes.before('dog.prototype.*', function(ctx, next) {
65-
var dog = this;
65+
const dog = this;
6666
g.log('calling a method on %s', dog.name);
6767
next();
6868
});

Diff for: example/documentation/index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
'use strict';
77

8-
var g = require('strong-globalize')();
9-
var http = require('http');
10-
var remotes = require('./remotes');
11-
var meta = require('../../ext/meta');
12-
var swagger = require('../../ext/swagger');
13-
var port = process.argv[2] || 3000;
14-
var handler, adapter;
8+
const g = require('strong-globalize')();
9+
const http = require('http');
10+
const remotes = require('./remotes');
11+
const meta = require('../../ext/meta');
12+
const swagger = require('../../ext/swagger');
13+
const port = process.argv[2] || 3000;
14+
let handler, adapter;
1515

1616
// The installation order sets which routes are captured by Swagger.
1717
swagger(remotes, {

Diff for: example/documentation/remotes/contract-class.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
'use strict';
77

88
// This example shows using the helper for a type in a "definitive" fashion.
9-
var helper = require('../../../').extend(module.exports);
10-
var clshelper;
9+
const helper = require('../../../').extend(module.exports);
1110

1211
/**
1312
* A simple class that contains a name, this time with a custom HTTP contract.
1413
*/
15-
clshelper = helper.type(ContractClass, {
14+
const clshelper = helper.type(ContractClass, {
1615
accepts: [{name: 'name', type: 'string', required: true}],
1716
http: {path: '/:name'},
1817
});

Diff for: example/documentation/remotes/contract.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
'use strict';
77

8-
var helper = require('../../../').extend(module.exports);
8+
const helper = require('../../../').extend(module.exports);
99

1010
/**
1111
* Returns a secret message.

Diff for: example/documentation/remotes/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
'use strict';
77

8-
var remotes = require('../../../').create();
8+
const remotes = require('../../../').create();
99

1010
/**
1111
* Example API

Diff for: example/documentation/remotes/simple-class.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'use strict';
77

88
// This example shows using the helper for a type in a "post-definition" style.
9-
var helper = require('../../../').extend(module.exports);
9+
const helper = require('../../../').extend(module.exports);
1010

1111
/**
1212
* A simple class that contains a name.

Diff for: example/documentation/remotes/simple.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// This helper adds methods to a module that we assume will be added to the remotes.
99
// TODO(schoon) - Make this _the_ API, not a "helper".
1010
// TODO(schoon) - Document EVERYTHING
11-
var helper = require('../../../').extend(module.exports);
11+
const helper = require('../../../').extend(module.exports);
1212

1313
/**
1414
* Returns a secret message.

Diff for: example/remote-fs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
'use strict';
77

88
// create a set of shared classes
9-
var remotes = require('../').create();
9+
const remotes = require('../').create();
1010

1111
// share some fs module code
12-
var fs = remotes.exports.fs = require('fs');
12+
const fs = remotes.exports.fs = require('fs');
1313

1414
// specifically the createReadStream function
1515
fs.createReadStream.shared = true;

Diff for: example/root.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
'use strict';
77

88
// create a set of shared classes
9-
var remotes = require('../').create();
9+
const remotes = require('../').create();
1010

1111
// expose a simple object
12-
var products = remotes.exports.products = {
12+
const products = remotes.exports.products = {
1313
find: function(fn) {
1414
fn(null, ['tv', 'vcr', 'radio']);
1515
},

Diff for: example/shared-class.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
'use strict';
77

8-
var express = require('express');
8+
const express = require('express');
99

1010
// define a vanilla JavaScript class
1111
function Dog(name) {
@@ -33,12 +33,12 @@ Dog.prototype.speak.returns = {arg: 'result', type: 'string', root: true};
3333
Dog.prototype.speak.shared = true;
3434

3535
// create a set of shared classes
36-
var remotes = require('../').create();
36+
const remotes = require('../').create();
3737

3838
// expose the Dog class
3939
remotes.exports.dog = Dog;
4040

41-
var app = express();
41+
const app = express();
4242
app.use(remotes.handler('rest'));
4343

4444
app.listen(3000);

Diff for: example/simple-types.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
'use strict';
77

88
// create a set of shared classes
9-
var remotes = require('../').create();
9+
const remotes = require('../').create();
1010

1111
// expose a simple object
12-
var user = remotes.exports.user = {
12+
const user = remotes.exports.user = {
1313
greet: function(fn) {
1414
fn(null, {msg: 'hello, world!'});
1515
},

Diff for: example/simple.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@
66
'use strict';
77

88
// create a set of shared classes
9-
var remoting = require('../');
10-
var SharedClass = remoting.SharedClass;
11-
var remotes = remoting.create();
12-
var express = require('express');
13-
var app = express();
9+
const remoting = require('../');
10+
const SharedClass = remoting.SharedClass;
11+
const remotes = remoting.create();
12+
const express = require('express');
13+
const app = express();
1414

1515
// define a class-like object (or constructor)
16-
var user = {
16+
const user = {
1717
greet: function(fn) {
1818
fn(null, 'hello, world!');
1919
},
2020
};
2121

2222
// create a shared class to allow strong-remoting to map
2323
// http requests to method invocations on your class
24-
var userSharedClass = new SharedClass('user', user);
24+
const userSharedClass = new SharedClass('user', user);
2525

2626
// tell strong-remoting about your greet method
2727
userSharedClass.defineMethod('greet', {

Diff for: example/socket-io/client.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
'use strict';
77

8-
var g = require('strong-globalize')();
8+
const g = require('strong-globalize')();
99

10-
var Remotes = require('../../client/js/client');
11-
var SocketIOAdapter = require('../../client/js/socket-io-adapter');
12-
var remotes = Remotes.connect('http://localhost:3000', SocketIOAdapter);
10+
const Remotes = require('../../client/js/client');
11+
const SocketIOAdapter = require('../../client/js/socket-io-adapter');
12+
const remotes = Remotes.connect('http://localhost:3000', SocketIOAdapter);
1313

1414
remotes.invoke('fs.readFile', {path: 'test.txt'}, function(err, data) {
1515
g.log(data.toString());

Diff for: example/socket-io/server.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
'use strict';
77

88
// create a set of shared classes
9-
var remotes = require('../../').create();
9+
const remotes = require('../../').create();
1010

1111
// share some fs module code
12-
var fs = remotes.exports.fs = require('fs');
12+
const fs = remotes.exports.fs = require('fs');
1313

1414
// specifically the readFile function
1515
fs.readFile.shared = true;
@@ -21,8 +21,8 @@ fs.readFile.accepts = {arg: 'path', type: 'string'};
2121
fs.readFile.returns = {arg: 'data', type: 'buffer'};
2222

2323
// event emitter
24-
var EventEmitter = require('events').EventEmitter;
25-
var ee = remotes.exports.ee = new EventEmitter();
24+
const EventEmitter = require('events').EventEmitter;
25+
const ee = remotes.exports.ee = new EventEmitter();
2626

2727
// expose the on method
2828
ee.on.shared = true;
@@ -35,7 +35,7 @@ setInterval(function() {
3535
}, 1000);
3636

3737
// expose it over http
38-
var server =
38+
const server =
3939
require('http')
4040
.createServer()
4141
.listen(3000);

Diff for: example/streams.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
'use strict';
77

88
// faux remote stream
9-
var destination = process.stdout;
10-
var fs = require('fs');
11-
var path = require('path');
9+
const destination = process.stdout;
10+
const fs = require('fs');
11+
const path = require('path');
1212

1313
// create a set of shared classes
14-
var remotes = require('../').create();
14+
const remotes = require('../').create();
1515

1616
// our modules
17-
var fileService = remotes.exports.files = {
17+
const fileService = remotes.exports.files = {
1818
upload: function() {
1919
return destination;
2020
},

Diff for: ext/meta.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ module.exports = Meta;
1313
/**
1414
* Module dependencies.
1515
*/
16-
var Remoting = require('../');
16+
const Remoting = require('../');
1717

1818
/**
1919
* Create a remotable Meta module for plugging into `RemoteObjects`.
2020
*/
2121
function Meta(remotes, options) {
2222
// Unfold options.
23-
var name = (options && options.name) || 'meta';
23+
const name = (options && options.name) || 'meta';
2424

2525
// We need a temporary REST adapter to discover our available routes.
26-
var adapter = remotes.handler('rest').adapter;
27-
var extension = {};
28-
var helper = Remoting.extend(extension);
26+
const adapter = remotes.handler('rest').adapter;
27+
const extension = {};
28+
const helper = Remoting.extend(extension);
2929

3030
helper.method(routes, {returns: {type: 'object', root: true}});
3131
function routes(callback) {

Diff for: index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* remotes ~ public api
1010
*/
1111

12-
var SG = require('strong-globalize');
12+
const SG = require('strong-globalize');
1313
SG.SetRootDir(__dirname);
1414

1515
module.exports = require('./lib/remote-objects');

Diff for: lib/context-base.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
'use strict';
77

8-
var assert = require('assert');
9-
var EventEmitter = require('events').EventEmitter;
10-
var TypeRegistry = require('./type-registry');
11-
var inherits = require('util').inherits;
8+
const assert = require('assert');
9+
const EventEmitter = require('events').EventEmitter;
10+
const TypeRegistry = require('./type-registry');
11+
const inherits = require('util').inherits;
1212

1313
module.exports = ContextBase;
1414

@@ -34,7 +34,7 @@ inherits(ContextBase, EventEmitter);
3434
ContextBase.prototype.getScope = function() {
3535
// Static methods are invoked on the constructor (this = constructor fn)
3636
// Prototype methods are invoked on the instance (this = instance)
37-
var method = this.method;
37+
const method = this.method;
3838
return this.instance ||
3939
method.ctor ||
4040
method.sharedMethod && method.sharedMethod.ctor;

Diff for: lib/exports-helper.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ module.exports = ExportsHelper;
1313
/*!
1414
* Module dependencies.
1515
*/
16-
var debug = require('debug')('strong-remoting:exports-helper');
16+
const debug = require('debug')('strong-remoting:exports-helper');
1717

1818
/*!
1919
* Constants
2020
*/
21-
var PASSTHROUGH_OPTIONS = ['http', 'description', 'notes'];
21+
const PASSTHROUGH_OPTIONS = ['http', 'description', 'notes'];
2222

2323
/**
2424
* @class A wrapper to make manipulating the exports object easier.
@@ -40,10 +40,10 @@ function ExportsHelper(obj) {
4040
*/
4141
ExportsHelper.prototype.setPath = setPath;
4242
function setPath(path, value) {
43-
var self = this;
44-
var obj = self._obj;
45-
var split = path.split('.');
46-
var name = split.pop();
43+
const self = this;
44+
let obj = self._obj;
45+
const split = path.split('.');
46+
const name = split.pop();
4747

4848
split.forEach(function(key) {
4949
if (!obj[key]) {
@@ -65,10 +65,10 @@ function setPath(path, value) {
6565
ExportsHelper.prototype.addType = type;
6666
ExportsHelper.prototype.type = type;
6767
function type(fn, options) {
68-
var self = this;
69-
var path = options.path || options.name || fn.name || null;
70-
var sharedCtor = options.sharedCtor || null;
71-
var accepts = options.accepts || null;
68+
const self = this;
69+
const path = options.path || options.name || fn.name || null;
70+
let sharedCtor = options.sharedCtor || null;
71+
const accepts = options.accepts || null;
7272

7373
if (!path) {
7474
// TODO: Error.
@@ -80,7 +80,7 @@ function type(fn, options) {
8080
// constructor". Instead, this is the lazy find/create sl-remoting uses when
8181
// a prototype method is called. `getInstance`? `findOrCreate`? `load`?
8282
sharedCtor = function() {
83-
var _args = [].slice.call(arguments);
83+
const _args = [].slice.call(arguments);
8484
_args.pop()(null, fn.apply(null, _args));
8585
};
8686
}
@@ -114,11 +114,11 @@ function type(fn, options) {
114114
ExportsHelper.prototype.addMethod = method;
115115
ExportsHelper.prototype.method = method;
116116
function method(fn, options) {
117-
var self = this;
118-
var path = options.path || options.name || fn.name || null;
119-
var accepts = options.accepts || null;
120-
var returns = options.returns || null;
121-
var errors = options.errors || null;
117+
const self = this;
118+
const path = options.path || options.name || fn.name || null;
119+
const accepts = options.accepts || null;
120+
const returns = options.returns || null;
121+
const errors = options.errors || null;
122122

123123
if (!path) {
124124
// TODO: Error.

0 commit comments

Comments
 (0)