Skip to content

Commit af4933d

Browse files
committed
Add the 'no-var' eslint rule for node files, replace them by let or const
1 parent bab4521 commit af4933d

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

.eslintrc-node.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = {
1717
"semi": ["error", "always"],
1818
"comma-dangle": ["error", "only-multiline"],
1919
"camelcase": "off",
20+
"no-var": "error",
2021

2122
// Override some eslint base rules because we're using node.
2223
"no-console": "off",

app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ boot.executeInParallel([
494494
}
495495

496496
let key = '';
497-
var match;
497+
let match;
498498
switch (data.name) {
499499
case 'cloud9':
500500
// Extract a valid SSH public key from the user's input.

lib/db.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Copyright © 2016 Jan Keromnes. All rights reserved.
22
// The following code is covered by the AGPL-3.0 license.
33

4-
var fs = require('fs');
4+
const fs = require('fs');
55

66
// The datastore.
7-
var file = './db.json';
8-
var store = {};
7+
const file = './db.json';
8+
let store = {};
99
load();
1010

1111
// Load the datastore from disk synchronously.
1212

1313
function load () {
14-
var json = '{}';
14+
let json = '{}';
1515

1616
try {
1717
json = fs.readFileSync(file, 'utf8');
@@ -31,7 +31,7 @@ exports.load = load;
3131
// Save the datastore to disk asynchronously. TODO gzip?
3232

3333
function save () {
34-
var json = JSON.stringify(store, null, 2);
34+
const json = JSON.stringify(store, null, 2);
3535

3636
fs.writeFile(file, json + '\n', function (error) {
3737
if (error) {

lib/log.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Log messages to the console with a timestamp.
55

66
function log () {
7-
var args = [].slice.call(arguments);
7+
let args = [].slice.call(arguments);
88
args.unshift('[' + new Date().toISOString() + ']');
99

1010
console.log.apply(console, args);

lib/streams.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// Copyright © 2016 Jan Keromnes. All rights reserved.
22
// The following code is covered by the AGPL-3.0 license.
33

4-
var stream = require('stream');
4+
const stream = require('stream');
55

66
const log = require('./log');
77

88
// Streams that are currently in progress, per object.
9-
var objectStreams = new Map();
9+
let objectStreams = new Map();
1010

1111
// Get `object[key]` as a stream (may still be receiving new data).
1212

1313
function get (object, key) {
14-
var passthrough = new stream.PassThrough();
15-
var streams = objectStreams.get(object);
14+
let passthrough = new stream.PassThrough();
15+
let streams = objectStreams.get(object);
1616

1717
if (object[key]) {
1818
passthrough.write(object[key], 'utf8');
@@ -32,7 +32,7 @@ exports.get = get;
3232
// Read a stream into `object[key]`.
3333

3434
function set (object, key, readable) {
35-
var streams = objectStreams.get(object);
35+
let streams = objectStreams.get(object);
3636

3737
if (!streams) {
3838
streams = {};
@@ -67,7 +67,7 @@ exports.set = set;
6767
// Remove any stream affected to `object[key]`.
6868

6969
function remove (object, key) {
70-
var streams = objectStreams.get(object);
70+
let streams = objectStreams.get(object);
7171

7272
// If the stream doesn't exist, do nothing.
7373
if (!streams || !streams[key]) {

0 commit comments

Comments
 (0)