1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Replace jshint with eslint and add lots of rules

Fix eslint errors accordingly
This commit is contained in:
Ruben Bridgewater
2016-03-26 04:05:43 +01:00
parent 12579e5e8e
commit 94e9f1fcfc
98 changed files with 1621 additions and 1551 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
var assert = require("assert");
var config = require("./lib/config");
var assert = require('assert');
var config = require('./lib/config');
var fs = require('fs');
var helper = require('./helper');
var path = require('path');
@@ -9,9 +9,9 @@ var redis = config.redis;
var utils = require('../lib/utils');
var tls_options = {
servername: "redis.js.org",
servername: 'redis.js.org',
rejectUnauthorized: true,
ca: [ String(fs.readFileSync(path.resolve(__dirname, "./conf/redis.js.org.cert"))) ]
ca: [ String(fs.readFileSync(path.resolve(__dirname, './conf/redis.js.org.cert'))) ]
};
var tls_port = 6380;
@@ -21,14 +21,14 @@ var skip = false;
// Wait until stunnel4 is in the travis whitelist
// Check: https://github.com/travis-ci/apt-package-whitelist/issues/403
// If this is merged, remove the travis env checks
describe("TLS connection tests", function () {
describe('TLS connection tests', function () {
before(function (done) {
// Print the warning when the tests run instead of while starting mocha
if (process.platform === 'win32') {
skip = true;
console.warn('\nStunnel tests do not work on windows atm. If you think you can fix that, it would be warmly welcome.\n');
} else if (process.env.TRAVIS === 'true') {
} else if (process.env.TRAVIS === 'true') {
skip = true;
console.warn('\nTravis does not support stunnel right now. Skipping tests.\nCheck: https://github.com/travis-ci/apt-package-whitelist/issues/403\n');
}
@@ -50,8 +50,8 @@ describe("TLS connection tests", function () {
client.end(true);
});
describe("on lost connection", function () {
it("emit an error after max retry timeout and do not try to reconnect afterwards", function (done) {
describe('on lost connection', function () {
it('emit an error after max retry timeout and do not try to reconnect afterwards', function (done) {
if (skip) this.skip();
var connect_timeout = 500; // in ms
client = redis.createClient({
@@ -61,15 +61,15 @@ describe("TLS connection tests", function () {
});
var time = 0;
client.once('ready', function() {
client.once('ready', function () {
helper.killConnection(client);
});
client.on("reconnecting", function (params) {
client.on('reconnecting', function (params) {
time += params.delay;
});
client.on('error', function(err) {
client.on('error', function (err) {
if (/Redis connection in broken state: connection timeout.*?exceeded./.test(err.message)) {
setTimeout(function () {
assert(time === connect_timeout);
@@ -80,9 +80,9 @@ describe("TLS connection tests", function () {
});
});
describe("when not connected", function () {
describe('when not connected', function () {
it("connect with host and port provided in the options object", function (done) {
it('connect with host and port provided in the options object', function (done) {
if (skip) this.skip();
client = redis.createClient({
host: 'localhost',
@@ -103,7 +103,7 @@ describe("TLS connection tests", function () {
it('fails to connect because the cert is not correct', function (done) {
if (skip) this.skip();
var faulty_cert = utils.clone(tls_options);
faulty_cert.ca = [ String(fs.readFileSync(path.resolve(__dirname, "./conf/faulty.cert"))) ];
faulty_cert.ca = [ String(fs.readFileSync(path.resolve(__dirname, './conf/faulty.cert'))) ];
client = redis.createClient({
host: 'localhost',
connect_timeout: 1000,