Skip to content

Commit

Permalink
removed unnecesary comments and corrected styling for new eslint
Browse files Browse the repository at this point in the history
Signed-off-by: itavy <itavyg@gmail.com>
  • Loading branch information
itavy committed Sep 1, 2015
1 parent 84a3cb8 commit 4c6ba65
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 74 deletions.
23 changes: 13 additions & 10 deletions .eslintrc
Expand Up @@ -13,17 +13,15 @@
0,
false
],
"no-underscore-dangle": [
0,
false
],
"no-underscore-dangle": 0,
"yoda": [
1,
"always"
],
"indent": [
2,
2
2,
{"SwitchCase": 1}
],
"brace-style": [
2,
Expand All @@ -43,7 +41,7 @@
"no-nested-ternary": 2,
"no-undefined": 2,
"radix": 2,
"space-after-function-name": [
"space-before-function-paren": [
1,
"always"
],
Expand All @@ -52,21 +50,26 @@
"always"
],
"space-before-blocks": 2,
"spaced-line-comment": [
"spaced-comment": [
2,
"always",
{
"exceptions": [
"-"
]
],
"markers": [
"eslint",
"jshint",
"global"
]
}
],
"strict": [
2,
"global"
],
"wrap-iife": 2,
"camelcase": false,
"new-cap": false
"camelcase": 0,
"new-cap": 0
}
}
60 changes: 30 additions & 30 deletions test/abstract_client.js
Expand Up @@ -216,7 +216,7 @@ module.exports = function (server, config) {
client.once('connect', function () {
done(new Error('Should not emit connect'));
});
client.once('error', function (/*error*/) {
client.once('error', function (/* error */) {
// to do
// check for error message
// and validate it is the expected one
Expand Down Expand Up @@ -263,7 +263,7 @@ module.exports = function (server, config) {

server.once('client', function (serverClient) {
serverClient.on('subscribe', function () {
serverClient.on('publish', function (/*packet*/) {
serverClient.on('publish', function () {
done();
});
});
Expand Down Expand Up @@ -311,7 +311,7 @@ module.exports = function (server, config) {
client.publish('test', 'test', { qos: 1 }, function () {
client.end();
});
client.on('message', function (/*t, p, packet*/) {
client.on('message', function () {
done();
});
});
Expand Down Expand Up @@ -566,7 +566,7 @@ module.exports = function (server, config) {

it('should checkPing at keepalive interval', function (done) {
var interval = 3,
client = connect({keepalive: interval});
client = connect({keepalive: interval});

client._checkPing = sinon.spy();

Expand Down Expand Up @@ -634,7 +634,7 @@ module.exports = function (server, config) {
client.subscribe('test');

server.once('client', function (serverClient) {
serverClient.once('subscribe', function (/*packet*/) {
serverClient.once('subscribe', function () {
done();
});
});
Expand Down Expand Up @@ -663,7 +663,7 @@ module.exports = function (server, config) {
var client = connect(),
subs = ['test1', 'test2'];

client.once('connect', function (/*args*/) {
client.once('connect', function () {
client.subscribe(subs);
});

Expand Down Expand Up @@ -713,7 +713,7 @@ module.exports = function (server, config) {
topic = 'test',
opts = {qos: 1};

client.once('connect', function (/*args*/) {
client.once('connect', function () {
client.subscribe(topic, opts);
});

Expand All @@ -731,7 +731,7 @@ module.exports = function (server, config) {
var client = connect(),
topic = 'test';

client.once('connect', function (/*args*/) {
client.once('connect', function () {
client.subscribe(topic, {qos: 2}, function (err, granted) {
if (err) {
done(err);
Expand Down Expand Up @@ -785,7 +785,7 @@ module.exports = function (server, config) {
});

server.once('client', function (serverClient) {
serverClient.on('subscribe', function (/*packet*/) {
serverClient.on('subscribe', function () {
serverClient.publish(testPacket);
});
});
Expand All @@ -794,12 +794,12 @@ module.exports = function (server, config) {
it('should support binary data', function (done) {
var client = connect({ encoding: 'binary' }),
testPacket = {
topic: 'test',
payload: 'message',
retain: true,
qos: 1,
messageId: 5
};
topic: 'test',
payload: 'message',
retain: true,
qos: 1,
messageId: 5
};

client.subscribe(testPacket.topic);
client.once('message',
Expand All @@ -812,7 +812,7 @@ module.exports = function (server, config) {
});

server.once('client', function (serverClient) {
serverClient.on('subscribe', function (/*packet*/) {
serverClient.on('subscribe', function () {
serverClient.publish(testPacket);
});
});
Expand Down Expand Up @@ -840,7 +840,7 @@ module.exports = function (server, config) {
});

server.once('client', function (serverClient) {
serverClient.on('subscribe', function (/*packet*/) {
serverClient.on('subscribe', function () {
serverClient.publish(testPacket);
});
});
Expand Down Expand Up @@ -868,7 +868,7 @@ module.exports = function (server, config) {
});

server.once('client', function (serverClient) {
serverClient.on('subscribe', function (/*packet*/) {
serverClient.on('subscribe', function () {
serverClient.publish(testPacket);
// twice, should be ignored
serverClient.publish(testPacket);
Expand All @@ -879,12 +879,12 @@ module.exports = function (server, config) {
it('should support chinese topic', function (done) {
var client = connect({ encoding: 'binary' }),
testPacket = {
topic: '国',
payload: 'message',
retain: true,
qos: 1,
messageId: 5
};
topic: '国',
payload: 'message',
retain: true,
qos: 1,
messageId: 5
};

client.subscribe(testPacket.topic);
client.once('message',
Expand All @@ -897,7 +897,7 @@ module.exports = function (server, config) {
});

server.once('client', function (serverClient) {
serverClient.on('subscribe', function (/*packet*/) {
serverClient.on('subscribe', function () {
serverClient.publish(testPacket);
});
});
Expand All @@ -916,7 +916,7 @@ module.exports = function (server, config) {
});

server.once('client', function (serverClient) {
serverClient.once('subscribe', function (/*packet*/) {
serverClient.once('subscribe', function () {
serverClient.publish({
topic: test_topic,
payload: test_message,
Expand All @@ -934,12 +934,12 @@ module.exports = function (server, config) {
test_message = 'message',
mid = 50;

client.once('connect', function (/*args*/) {
client.once('connect', function () {
client.subscribe(test_topic, {qos: 1});
});

server.once('client', function (serverClient) {
serverClient.once('subscribe', function (/*packet*/) {
serverClient.once('subscribe', function () {
serverClient.publish({
topic: test_topic,
payload: test_message,
Expand All @@ -966,7 +966,7 @@ module.exports = function (server, config) {
});

server.once('client', function (serverClient) {
serverClient.once('subscribe', function (/*packet*/) {
serverClient.once('subscribe', function () {
serverClient.publish({
topic: test_topic,
payload: test_message,
Expand All @@ -975,7 +975,7 @@ module.exports = function (server, config) {
});
});

serverClient.once('pubcomp', function (/*packet*/) {
serverClient.once('pubcomp', function () {
done();
});
});
Expand Down
12 changes: 6 additions & 6 deletions test/abstract_store.js
Expand Up @@ -61,7 +61,7 @@ module.exports = function abstractStoreTest (build) {
store.del(packet, function () {
store
.createStream()
.on('data', function (/*data*/) {
.on('data', function () {
done(new Error('this should never happen'));
})
.on('end', done);
Expand All @@ -71,11 +71,11 @@ module.exports = function abstractStoreTest (build) {

it('should replace a packet when doing put with the same messageId', function (done) {
var packet1 = {
topic: 'hello',
payload: 'world',
qos: 2,
messageId: 42
},
topic: 'hello',
payload: 'world',
qos: 2,
messageId: 42
},
packet2 = {
qos: 2,
messageId: 42
Expand Down
4 changes: 2 additions & 2 deletions test/browser/server.js
Expand Up @@ -70,7 +70,7 @@ handleClient = function (client) {
client.pubrel(packet);
});

client.on('pubcomp', function (/*packet*/) {
client.on('pubcomp', function () {
// Nothing to be done
});

Expand All @@ -94,7 +94,7 @@ handleClient = function (client) {
client.unsuback(packet);
});

client.on('pingreq', function (/*packet*/) {
client.on('pingreq', function () {
client.pingresp();
});
};
Expand Down
15 changes: 8 additions & 7 deletions test/client.js
Expand Up @@ -57,7 +57,7 @@ function buildServer () {
client.pubrel(packet);
});

client.on('pubcomp', function (/*packet*/) {
client.on('pubcomp', function () {
// Nothing to be done
});

Expand All @@ -74,7 +74,7 @@ function buildServer () {
client.unsuback(packet);
});

client.on('pingreq', function (/*packet*/) {
client.on('pingreq', function () {
client.pingresp();
});
});
Expand Down Expand Up @@ -233,11 +233,12 @@ describe('MqttClient', function () {
this.timeout(2500);

var server2 = buildServer().listen(port + 45),
client = mqtt.connect({
port: port + 45,
host: 'localhost',
connectTimeout: 350,
reconnectPeriod: 300 });
client = mqtt.connect({
port: port + 45,
host: 'localhost',
connectTimeout: 350,
reconnectPeriod: 300
});

server2.on('client', function (c) {
client.publish('hello', 'world', { qos: 1 }, function () {
Expand Down

0 comments on commit 4c6ba65

Please sign in to comment.