Skip to content

Commit

Permalink
chore: eslint --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
trs committed Oct 30, 2017
1 parent 5fc59b5 commit 154cd5a
Show file tree
Hide file tree
Showing 36 changed files with 93 additions and 146 deletions.
35 changes: 0 additions & 35 deletions config/testUnit/istanbul.js

This file was deleted.

14 changes: 0 additions & 14 deletions config/testUnit/thresholds.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"test:unit:once": "cross-env NODE_ENV=test nyc mocha --opts config/testUnit/mocha.opts",
"upload-coverage": "cat reports/coverage/lcov.info | coveralls",
"verify": "npm run verify:js --silent",
"verify:js": "eslint -c config/verify/.eslintrc.js \"src/**/*.js\" \"test/**/*.js\" \"config/**/*.js\" && echo ✅ verify:js success",
"verify:js:fix": "eslint --fix -c config/verify/.eslintrc.js \"src/**/*.js\" \"test/**/*.js\" \"config/**/*.js\" && echo ✅ verify:js:fix success",
"verify:js": "eslint -c config/verify/.eslintrc \"src/**/*.js\" \"test/**/*.js\" \"config/**/*.js\" && echo ✅ verify:js success",
"verify:js:fix": "eslint --fix -c config/verify/.eslintrc \"src/**/*.js\" \"test/**/*.js\" \"config/**/*.js\" && echo ✅ verify:js:fix success",
"verify:js:watch": "chokidar 'src/**/*.js' 'test/**/*.js' 'config/**/*.js' -c 'npm run verify:js:fix' --initial --silent",
"verify:watch": "npm run verify:js:watch --silent"
},
Expand Down
2 changes: 1 addition & 1 deletion src/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class FtpCommands {
}

const handler = commandRegister.handler.bind(this.connection);
return when.try(handler, { log, command, previous_command: this.previousCommand })
return when.try(handler, {log, command, previous_command: this.previousCommand})
.finally(() => {
this.previousCommand = _.clone(command);
});
Expand Down
1 change: 1 addition & 0 deletions src/commands/registration/port.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
directive: 'PORT',
handler: function ({command} = {}) {
this.connector = new ActiveConnector(this);

const rawConnection = _.get(command, 'arg', '').split(',');
if (rawConnection.length !== 6) return this.reply(425);

Expand Down
2 changes: 1 addition & 1 deletion src/commands/registration/site/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
if (!registry.hasOwnProperty(subCommand.directive)) return this.reply(502);

const handler = registry[subCommand.directive].handler.bind(this);
return when.try(handler, { log: subLog, command: subCommand });
return when.try(handler, {log: subLog, command: subCommand});
},
syntax: '{{cmd}} <subVerb> [...<subParams>]',
description: 'Sends site specific commands to remote server'
Expand Down
2 changes: 1 addition & 1 deletion src/connector/active.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Active extends Connector {
this.dataSocket = new Socket();
this.dataSocket.setEncoding(this.connection.transferType);
this.dataSocket.on('error', err => this.server.emit('client-error', {connection: this.connection, context: 'dataSocket', error: err}));
this.dataSocket.connect({ host, port, family }, () => {
this.dataSocket.connect({host, port, family}, () => {
this.dataSocket.pause();

if (this.connection.secure) {
Expand Down
2 changes: 1 addition & 1 deletion src/connector/passive.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Passive extends Connector {
};

this.dataSocket = null;
this.dataServer = net.createServer({ pauseOnConnect: true }, connectionHandler);
this.dataServer = net.createServer({pauseOnConnect: true}, connectionHandler);
this.dataServer.maxConnections = 1;
this.dataServer.on('error', err => this.server.emit('client-error', {connection: this.connection, context: 'dataServer', error: err}));
this.dataServer.on('close', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const fs = whenNode.liftAll(syncFs);
const errors = require('./errors');

class FileSystem {
constructor(connection, { root, cwd } = {}) {
constructor(connection, {root, cwd} = {}) {
this.connection = connection;
this.cwd = cwd || nodePath.sep;
this.root = root || process.cwd();
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class FtpServer {
return connection.reply(220, ...greeting, features)
.finally(() => socket.resume());
};
const serverOptions = _.assign(this.isTLS ? this._tls : {}, { pauseOnConnect: true });
const serverOptions = _.assign(this.isTLS ? this._tls : {}, {pauseOnConnect: true});

this.server = (this.isTLS ? tls : net).createServer(serverOptions, serverConnectionHandler);
this.server.on('error', err => this.log.error(err, '[Event] error'));
Expand Down
6 changes: 3 additions & 3 deletions test/commands/registration/auth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ describe(CMD, function () {
});

it('TLS // supported', () => {
return cmdFn({command: { arg: 'TLS', directive: CMD}})
return cmdFn({command: {arg: 'TLS', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(234);
expect(mockClient.secure).to.equal(true);
});
});

it('SSL // not supported', () => {
return cmdFn({command: { arg: 'SSL', directive: CMD}})
return cmdFn({command: {arg: 'SSL', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(504);
});
});

it('bad // bad', () => {
return cmdFn({command: { arg: 'bad', directive: CMD}})
return cmdFn({command: {arg: 'bad', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(504);
});
Expand Down
12 changes: 6 additions & 6 deletions test/commands/registration/cwd.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe(CMD, function () {
let log = bunyan.createLogger({name: CMD});
const mockClient = {
reply: () => {},
fs: { chdir: () => {} }
fs: {chdir: () => {}}
};
const cmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(mockClient);

Expand All @@ -24,7 +24,7 @@ describe(CMD, function () {

describe('// check', function () {
it('fails on no fs', () => {
const badMockClient = { reply: () => {} };
const badMockClient = {reply: () => {}};
const badCmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(badMockClient);
sandbox.stub(badMockClient, 'reply').resolves();

Expand All @@ -35,7 +35,7 @@ describe(CMD, function () {
});

it('fails on no fs chdir command', () => {
const badMockClient = { reply: () => {}, fs: {} };
const badMockClient = {reply: () => {}, fs: {}};
const badCmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(badMockClient);
sandbox.stub(badMockClient, 'reply').resolves();

Expand All @@ -47,7 +47,7 @@ describe(CMD, function () {
});

it('test // successful', () => {
return cmdFn({log, command: { arg: 'test', directive: CMD}})
return cmdFn({log, command: {arg: 'test', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(250);
expect(mockClient.fs.chdir.args[0][0]).to.equal('test');
Expand All @@ -58,7 +58,7 @@ describe(CMD, function () {
mockClient.fs.chdir.restore();
sandbox.stub(mockClient.fs, 'chdir').resolves('/test');

return cmdFn({log, command: { arg: 'test', directive: CMD}})
return cmdFn({log, command: {arg: 'test', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(250);
expect(mockClient.fs.chdir.args[0][0]).to.equal('test');
Expand All @@ -69,7 +69,7 @@ describe(CMD, function () {
mockClient.fs.chdir.restore();
sandbox.stub(mockClient.fs, 'chdir').rejects(new Error('Bad'));

return cmdFn({log, command: { arg: 'bad', directive: CMD}})
return cmdFn({log, command: {arg: 'bad', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(550);
expect(mockClient.fs.chdir.args[0][0]).to.equal('bad');
Expand Down
10 changes: 5 additions & 5 deletions test/commands/registration/dele.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe(CMD, function () {
let log = bunyan.createLogger({name: CMD});
const mockClient = {
reply: () => {},
fs: { delete: () => {} }
fs: {delete: () => {}}
};
const cmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(mockClient);

Expand All @@ -24,7 +24,7 @@ describe(CMD, function () {

describe('// check', function () {
it('fails on no fs', () => {
const badMockClient = { reply: () => {} };
const badMockClient = {reply: () => {}};
const badCmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(badMockClient);
sandbox.stub(badMockClient, 'reply').resolves();

Expand All @@ -35,7 +35,7 @@ describe(CMD, function () {
});

it('fails on no fs delete command', () => {
const badMockClient = { reply: () => {}, fs: {} };
const badMockClient = {reply: () => {}, fs: {}};
const badCmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(badMockClient);
sandbox.stub(badMockClient, 'reply').resolves();

Expand All @@ -47,7 +47,7 @@ describe(CMD, function () {
});

it('test // successful', () => {
return cmdFn({log, command: { arg: 'test', directive: CMD}})
return cmdFn({log, command: {arg: 'test', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(250);
expect(mockClient.fs.delete.args[0][0]).to.equal('test');
Expand All @@ -58,7 +58,7 @@ describe(CMD, function () {
mockClient.fs.delete.restore();
sandbox.stub(mockClient.fs, 'delete').rejects(new Error('Bad'));

return cmdFn({log, command: { arg: 'bad', directive: CMD}})
return cmdFn({log, command: {arg: 'bad', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(550);
expect(mockClient.fs.delete.args[0][0]).to.equal('bad');
Expand Down
8 changes: 4 additions & 4 deletions test/commands/registration/help.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ describe(CMD, function () {
});

it('// successful', () => {
return cmdFn({command: { directive: CMD }})
return cmdFn({command: {directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(211);
});
});

it('help // successful', () => {
return cmdFn({command: { arg: 'help', directive: CMD}})
return cmdFn({command: {arg: 'help', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(214);
});
});

it('allo // successful', () => {
return cmdFn({command: { arg: 'allo', directive: CMD}})
return cmdFn({command: {arg: 'allo', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(214);
});
});

it('bad // unsuccessful', () => {
return cmdFn({command: { arg: 'bad', directive: CMD}})
return cmdFn({command: {arg: 'bad', directive: CMD}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(502);
});
Expand Down
4 changes: 2 additions & 2 deletions test/commands/registration/list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe(CMD, function () {

describe('// check', function () {
it('fails on no fs', () => {
const badMockClient = { reply: () => {} };
const badMockClient = {reply: () => {}};
const badCmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(badMockClient);
sandbox.stub(badMockClient, 'reply').resolves();

Expand All @@ -99,7 +99,7 @@ describe(CMD, function () {
});

it('fails on no fs list command', () => {
const badMockClient = { reply: () => {}, fs: {} };
const badMockClient = {reply: () => {}, fs: {}};
const badCmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(badMockClient);
sandbox.stub(badMockClient, 'reply').resolves();

Expand Down
6 changes: 3 additions & 3 deletions test/commands/registration/mdtm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe(CMD, function () {
let log = bunyan.createLogger({name: CMD});
const mockClient = {
reply: () => {},
fs: { get: () => {} }
fs: {get: () => {}}
};
const cmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(mockClient);

Expand All @@ -24,7 +24,7 @@ describe(CMD, function () {

describe('// check', function () {
it('fails on no fs', () => {
const badMockClient = { reply: () => {} };
const badMockClient = {reply: () => {}};
const badCmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(badMockClient);
sandbox.stub(badMockClient, 'reply').resolves();

Expand All @@ -35,7 +35,7 @@ describe(CMD, function () {
});

it('fails on no fs get command', () => {
const badMockClient = { reply: () => {}, fs: {} };
const badMockClient = {reply: () => {}, fs: {}};
const badCmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(badMockClient);
sandbox.stub(badMockClient, 'reply').resolves();

Expand Down
6 changes: 3 additions & 3 deletions test/commands/registration/mkd.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe(CMD, function () {
let log = bunyan.createLogger({name: CMD});
const mockClient = {
reply: () => {},
fs: { mkdir: () => {} }
fs: {mkdir: () => {}}
};
const cmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(mockClient);

Expand All @@ -24,7 +24,7 @@ describe(CMD, function () {

describe('// check', function () {
it('fails on no fs', () => {
const badMockClient = { reply: () => {} };
const badMockClient = {reply: () => {}};
const badCmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(badMockClient);
sandbox.stub(badMockClient, 'reply').resolves();

Expand All @@ -35,7 +35,7 @@ describe(CMD, function () {
});

it('fails on no fs mkdir command', () => {
const badMockClient = { reply: () => {}, fs: {} };
const badMockClient = {reply: () => {}, fs: {}};
const badCmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(badMockClient);
sandbox.stub(badMockClient, 'reply').resolves();

Expand Down
2 changes: 1 addition & 1 deletion test/commands/registration/pass.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe(CMD, function () {
const mockClient = {
reply: () => {},
login: () => {},
server: { options: { anonymous: false } },
server: {options: {anonymous: false}},
username: 'anonymous'
};
const cmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(mockClient);
Expand Down
4 changes: 2 additions & 2 deletions test/commands/registration/port.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ describe(CMD, function () {
});

it('// unsuccessful | invalid argument', () => {
return cmdFn({ command: { arg: '1,2,3,4,5' } })
return cmdFn({command: {arg: '1,2,3,4,5'}})
.then(() => {
expect(mockClient.reply.args[0][0]).to.equal(425);
});
});

it('// successful', () => {
return cmdFn({ command: { arg: '192,168,0,100,137,214' } })
return cmdFn({command: {arg: '192,168,0,100,137,214'}})
.then(() => {
const [ip, port] = ActiveConnector.prototype.setupConnection.args[0];
expect(mockClient.reply.args[0][0]).to.equal(200);
Expand Down
Loading

0 comments on commit 154cd5a

Please sign in to comment.