Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit df5a466

Browse files
author
Alec Gibson
committed
Reset no-unused-vars linting rule to default
1 parent 3dfc938 commit df5a466

15 files changed

+77
-59
lines changed

.eslintrc.js

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const SHAREDB_RULES = {
2424
ignoreUrls: true,
2525
}
2626
],
27+
// Google overrides the default ESLint behaviour here, which is slightly better for catching erroneously unused variables
28+
'no-unused-vars': ['error', {vars: 'all', args: 'after-used'}],
2729
// as-needed quote props are easier to write
2830
'quote-props': ['error', 'as-needed'],
2931
'require-jsdoc': 'off',

examples/counter/server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function startServer() {
2929

3030
// Connect any incoming WebSocket connection to ShareDB
3131
var wss = new WebSocket.Server({server: server});
32-
wss.on('connection', function(ws, req) {
32+
wss.on('connection', function(ws) {
3333
var stream = new WebSocketJSONStream(ws);
3434
backend.listen(stream);
3535
});

examples/leaderboard/server/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ server.listen(8080);
1818
console.log('Listening on http://localhost:8080');
1919

2020
// Connect any incoming WebSocket connection with ShareDB
21-
wss.on('connection', function(ws, req) {
21+
wss.on('connection', function(ws) {
2222
var stream = new WebSocketJSONStream(ws);
2323
share.listen(stream);
2424
});

examples/rich-text/server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function startServer() {
3232

3333
// Connect any incoming WebSocket connection to ShareDB
3434
var wss = new WebSocket.Server({server: server});
35-
wss.on('connection', function(ws, req) {
35+
wss.on('connection', function(ws) {
3636
var stream = new WebSocketJSONStream(ws);
3737
backend.listen(stream);
3838
});

examples/textarea/server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function startServer() {
2929

3030
// Connect any incoming WebSocket connection to ShareDB
3131
var wss = new WebSocket.Server({server: server});
32-
wss.on('connection', function(ws, req) {
32+
wss.on('connection', function(ws) {
3333
var stream = new WebSocketJSONStream(ws);
3434
backend.listen(stream);
3535
});

lib/db/memory.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ MemoryDB.prototype.query = function(collection, query, fields, options, callback
122122
// two properties:
123123
// - snapshots: array of query result snapshots
124124
// - extra: (optional) other types of results, such as counts
125-
MemoryDB.prototype._querySync = function(snapshots, query, options) {
125+
MemoryDB.prototype._querySync = function(snapshots) {
126126
return {snapshots: snapshots};
127127
};
128128

test/client/number-type.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ function apply(snapshot, op) {
1818
return snapshot + op;
1919
}
2020

21-
function transform(op1, op2, side) {
21+
function transform(op1) {
2222
return op1;
2323
}

test/client/query-subscribe.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ module.exports = function(options) {
306306
if (err) return done(err);
307307
connection.get('dogs', 'fido').create({});
308308
});
309-
query.on('insert', function(docs, index) {
309+
query.on('insert', function(docs) {
310310
expect(util.pluck(docs, 'id')).eql(['fido']);
311311
done();
312312
});
@@ -320,7 +320,7 @@ module.exports = function(options) {
320320
if (err) return done(err);
321321
connection.get('dogs', 'fido').create({});
322322
});
323-
query.on('insert', function(docs, index) {
323+
query.on('insert', function(docs) {
324324
expect(util.pluck(docs, 'id')).eql(['fido']);
325325
done();
326326
});

test/client/snapshot-timestamp-request.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ describe('SnapshotTimestampRequest', function() {
227227
it('starts pending, and finishes not pending', function(done) {
228228
var connection = backend.connect();
229229

230-
connection.fetchSnapshotByTimestamp('books', 'time-machine', null, function(error, snapshot) {
230+
connection.fetchSnapshotByTimestamp('books', 'time-machine', null, function(error) {
231+
if (error) return done(error);
231232
expect(connection.hasPending()).to.be(false);
232233
done();
233234
});
@@ -357,7 +358,7 @@ describe('SnapshotTimestampRequest', function() {
357358
}
358359
];
359360

360-
backend.connect().fetchSnapshotByTimestamp('books', 'time-machine', day1, function(error, snapshot) {
361+
backend.connect().fetchSnapshotByTimestamp('books', 'time-machine', day1, function(error) {
361362
expect(error.message).to.be('foo');
362363
done();
363364
});

test/client/snapshot-version-request.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ describe('SnapshotVersionRequest', function() {
165165
it('starts pending, and finishes not pending', function(done) {
166166
var connection = backend.connect();
167167

168-
connection.fetchSnapshot('books', 'don-quixote', null, function(error, snapshot) {
168+
connection.fetchSnapshot('books', 'don-quixote', null, function(error) {
169+
if (error) return done(error);
169170
expect(connection.hasPending()).to.be(false);
170171
done();
171172
});
@@ -295,7 +296,7 @@ describe('SnapshotVersionRequest', function() {
295296
}
296297
];
297298

298-
backend.connect().fetchSnapshot('books', 'don-quixote', 0, function(error, snapshot) {
299+
backend.connect().fetchSnapshot('books', 'don-quixote', 0, function(error) {
299300
expect(error.message).to.be('foo');
300301
done();
301302
});

test/client/subscribe.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ module.exports = function() {
229229
if (err) return done(err);
230230
doc.submitOp({p: ['age'], na: 1}, function(err) {
231231
if (err) return done(err);
232-
doc2.on('op', function(op, context) {
232+
doc2.on('op', function() {
233233
done();
234234
});
235235
doc2[method]();
@@ -396,7 +396,7 @@ module.exports = function() {
396396
if (err) return done(err);
397397
doc2.subscribe(function(err) {
398398
if (err) return done(err);
399-
doc2.on('op', function(op, context) {
399+
doc2.on('op', function() {
400400
expect(doc2.version).eql(2);
401401
expect(doc2.data).eql({age: 4});
402402
done();
@@ -413,7 +413,7 @@ module.exports = function() {
413413
if (err) return done(err);
414414
doc2.subscribe(function(err) {
415415
if (err) return done(err);
416-
doc2.on('op', function(op, context) {
416+
doc2.on('op', function() {
417417
done();
418418
});
419419
doc2.connection.close();
@@ -430,7 +430,7 @@ module.exports = function() {
430430
if (err) return done(err);
431431
doc2.subscribe(function(err) {
432432
if (err) return done(err);
433-
doc2.on('op', function(op, context) {
433+
doc2.on('op', function() {
434434
done();
435435
});
436436
backend.suppressPublish = true;
@@ -446,7 +446,7 @@ module.exports = function() {
446446
if (err) return done(err);
447447
doc2.subscribe(function(err) {
448448
if (err) return done(err);
449-
doc2.on('op', function(op, context) {
449+
doc2.on('op', function() {
450450
done();
451451
});
452452
doc2.unsubscribe(function(err) {
@@ -466,7 +466,7 @@ module.exports = function() {
466466
if (err) return done(err);
467467
doc2.subscribe(function(err) {
468468
if (err) return done(err);
469-
doc2.on('op', function(op, context) {
469+
doc2.on('op', function() {
470470
done(new Error('Should not get op event'));
471471
});
472472
doc2.destroy(function(err) {
@@ -516,7 +516,7 @@ module.exports = function() {
516516
}
517517
], function(err) {
518518
if (err) return done(err);
519-
fido.on('op', function(op, context) {
519+
fido.on('op', function() {
520520
done();
521521
});
522522
doc.submitOp({p: ['age'], na: 1}, done);
@@ -534,7 +534,7 @@ module.exports = function() {
534534
if (err) return done(err);
535535
doc2.subscribe(function(err) {
536536
if (err) return done(err);
537-
doc2.on('op', function(op, context) {
537+
doc2.on('op', function() {
538538
expect(doc2.version).eql(2);
539539
expect(doc2.data).eql({age: 4});
540540
done();
@@ -558,7 +558,7 @@ module.exports = function() {
558558
doc2.unsubscribe();
559559
doc2.subscribe(function(err) {
560560
if (err) return done(err);
561-
doc2.on('op', function(op, context) {
561+
doc2.on('op', function() {
562562
done();
563563
});
564564
doc.submitOp({p: ['age'], na: 1});
@@ -578,7 +578,7 @@ module.exports = function() {
578578
[{p: ['age'], na: 1}],
579579
[{p: ['age'], na: 5}]
580580
];
581-
doc2.on('op', function(op, context) {
581+
doc2.on('op', function(op) {
582582
var item = expected.shift();
583583
expect(op).eql(item);
584584
if (expected.length) return;
@@ -610,7 +610,7 @@ module.exports = function() {
610610
doc2.subscribe(function(err) {
611611
if (err) return done(err);
612612
var wait = 4;
613-
doc2.on('op', function(op, context) {
613+
doc2.on('op', function() {
614614
if (--wait) return;
615615
expect(doc2.version).eql(5);
616616
expect(doc2.data).eql({age: 122});

test/db-memory.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function BasicQueryableMemoryDB() {
6464
BasicQueryableMemoryDB.prototype = Object.create(MemoryDB.prototype);
6565
BasicQueryableMemoryDB.prototype.constructor = BasicQueryableMemoryDB;
6666

67-
BasicQueryableMemoryDB.prototype._querySync = function(snapshots, query, options) {
67+
BasicQueryableMemoryDB.prototype._querySync = function(snapshots, query) {
6868
if (query.filter) {
6969
snapshots = snapshots.filter(function(snapshot) {
7070
for (var queryKey in query.filter) {

0 commit comments

Comments
 (0)